[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: forex backtesting



PureBytes Links

Trading Reference Links

Thank you Mike!
Here is the code I found to work:

------------------------------------------------------
SetOption("MaxOpenPositions", 5 );
SetBacktestMode( backtestRegularRawMulti ); 
SetOption( "FuturesMode", True);                    
PositionSize = -20; // use 20 percent of equity
MarginDeposit = 1500; // deposit required for 1 pair
RoundLotSize = 1; // trade only round contracts
PointValue = 10/TickSize; //this adjusts profit so for 1 pip = $10 
[tick
//sizes: 0.01 for yen AND 0.0001 for others]

Cond1 = DayOfWeek () == 1 ;
Cond2 = DayOfWeek () == 2 ;
Cond3 = DayOfWeek () == 3 ;
Cond4 = DayOfWeek () == 4 ;
Cond5 = DayOfWeek () == 5 ;
Cond777 = Cond1 OR Cond2 OR Cond3 OR Cond4 OR Cond5;

//buy
Buy = Ref ( Close , -1 ) > Ref ( Open , -1)
	AND Cond777;
//short
Short = Ref ( Close , -1 ) < Ref ( Open , -1)
	AND Cond777;
//exit trade
Sell = Cover = DayOfWeek() == 5 ;
------------------------------------------------------
The problem I got now is that I cannot get the stop function to 
work, I tried applystop, the build-in stop from settings, nothing 
seems to work? 
I'm looking for an individual trade stop. Let's suppose I have 3 
open trades right now, and one of them is 300 points loss, I want to 
exit this one but keep the other ones, what do I have to do? How do I 
implement this in afl code?
 
Any help appreciated!




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/