Over trading
I have back tested many EA's over the years and one problem i find in alot of EA's is that they can "over trade". I say this because i have often back tested an EA and found that it would make 1,2 or even 3 profitable trades in a row and then create a losing trade or maybe even two. For this reason i would like to enter coding into an EA that would only allow it to make one trade per day and then stop until the next trading day. I have tried using the "Sleep" function but found it to be ineffective when back testing. Does anybody know how to write a code that would overcome this problem?
- Templates to create EAs and Indicators
- How to code?
- Going Crazy: OrdersTotal in backtest indicator Not work?
stedyer:
I have back tested many EA's over the years and one problem i find in alot of EA's is that they can "over trade". I say this because i have often back tested an EA and found that it would make 1,2 or even 3 profitable trades in a row and then create a losing trade or maybe even two. For this reason i would like to enter coding into an EA that would only allow it to make one trade per day and then stop until the next trading day. I have tried using the "Sleep" function but found it to be ineffective when back testing. Does anybody know how to write a code that would overcome this problem?
I have back tested many EA's over the years and one problem i find in alot of EA's is that they can "over trade". I say this because i have often back tested an EA and found that it would make 1,2 or even 3 profitable trades in a row and then create a losing trade or maybe even two. For this reason i would like to enter coding into an EA that would only allow it to make one trade per day and then stop until the next trading day. I have tried using the "Sleep" function but found it to be ineffective when back testing. Does anybody know how to write a code that would overcome this problem?
int TradeDay=888; if(GlobalVariableCheck("TradeDay")) TradeDay=GlobalVariableGet("TradeDay"); if(!TradeDay==DayOfYear()) { int ticket=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,0,0,"",0,0,Green); if(ticket>0) { TradeDay=DayOfYear(); GlobalVariableSet("TradeDay",TradeDay); } }Cheers