What error message is in the logs if any? Also it's better to loop down for order_close process ex) for(i=OrdersTotal()-1;i>=0;i--){do whatever;}
Hi! I corrected my EA. It worked. :D
for ( Count = 0 ; Count <= Total ; Count ++ )
You must count down when closing orders (multiple orders/multiple charts) Also the EA should only handle its own orders on its own chart.
for(pos = OrdersTotal()-1; pos >= 0 ; pos--) if ( OrderSelect(pos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() ){ // and my pair.
if ( OrderType () == OP_BUY ) { OrderClose ( OrderTicket () , OrderLots () , MarketInfo ( OrderSymbol () , MODE_BID ) , 10 , NULL ) ; } if ( OrderType () == OP_SELL ) { OrderClose ( OrderTicket () , OrderLots () , MarketInfo ( OrderSymbol () , MODE_ASK ) , 10 , NULL ) ; } if ( !OrderType () == OP_SELL && !OrderType () == OP_BUY ) { OrderDelete ( OrderTicket () ) ; }
The !OrderType == x could be interpretered as (!OrderType) == x which is wrong. Simplified:if ( OrderType () <= OP_SELL ) { OrderClose ( OrderTicket () , OrderLots () , OrderClosePrice() , 10 , NULL ) ; } else { OrderDelete ( OrderTicket () ) ; }
HI,
i'm kinda newbi in this staffs.
my strategy tester "start" button don't even work, what's the problem?
anybody can help guys?
HajAmir_75 #:
HI,
i'm kinda newbi in this staffs.
my strategy tester "start" button don't even work, what's the problem?
anybody can help guys?
Check your strategy tester journal for errors, usually some settings are wrong.
Or maybe not enough history
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi! Everyone
I have a question. Why doesn't my EA close all orders when I back test it ? It means my EA doesn't close all orders when it earn enough money in Strategy Tester. How to fix it?