here is an example :
Sell = short = Cover = pos = 0;
Buy = 1;
increment = 100 * TickSize ;
orders = 5;
PositionSize = 10000;
for( i = 0 ; i < BarCount ; i ++ )
{
if( pos )
{
count = 0;
for( n = 1 ; n <= orders ; n ++ )
{
if( order[n] )
{
if( High [i] > order [n] )
{
Buy [i] = sigScaleIn;
count ++;
order[n] = 0; // executed
}
}
}
PositionSize [i] = count * 10000;
}
else
{
if( Buy [i] )
{
order = Null ;
for( n = 1 ; n <= orders ; n ++ )
{
order [n] = Close [i] + n * increment;
}
pos = True;
}
}
}
Dear all,
I'm about to start writing code for a specific trading system which, and I'm thinking about different possibilities to do it.
Before I start I would like to hear from you, what you think is the best approach for this (just the general approach, not afl itself).
This simulation works like this: When a specific trading condition occurs, for simplicity, let's say it's a moving average crossover, I place several pending orders (for example 5 pending orders) with the same profit target and with the same stop loss, but each position is opened at different price level and with different position size.
For example in EUR/USD:
When buy signal occurs, price is trading at 1.1000 and the five long pending orders are placed at the following price levels: 1.1050, 1.1075, 1.1100, 1.1115, 1.1125, 1.1130, with the following position sizes (respectively): 1 lot, 1 lot, 2 lots, 2 lots and 3 lots. The profit target, and stop loss for all orders is 1.1135 and 1.1000.
This is just a simplified example of what I'm trying to replicate, but if anyone has tried something similar, what would you advice.
Since AB, is not event based, the concept of pending orders might be tricky to implement. For example in one bar, just one order might get triggered and on another one, all the orders might get triggered at once (I'm using 1min bars, so if the High of the bar is > order price level, I assume the order is triggered).
Do you think it would be better to use sigscale-in/out, or use backtestRegularRawMulti to handle the various entries in the same symbol; or do you think that CBT would be better for this.
Any input is appreciated.
Thanks,
pm
Attachment(s) from Aron Pipa | View attachments on the web
1 of 1 Photo(s)
Posted by: Aron Pipa <aron@myafl.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (0) |
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
EmoticonEmoticon