int start() { //----Order Processing for(int pos = OrdersTotal()-1; pos >= 0 ; pos--) { if ( OrderSelect(pos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == MagicNumber // my magic number && OrderSymbol() == Symbol() ) // and my pair. { // Analyzing orders: if (OrderSymbol()!=Symb)continue; // Another security if (OrderType()>1) // Pending order found { Print("Pending order detected. EA does not work."); return(0); // Exit start() } Total++; // Counter of market orders } } if(Total>0)Before starting the for loop what is the value of Total and what is Symb and why are you checking OrderSymbol() twice?
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
I created a extremely basic EA to test the relationship between risk/reward ratio and winning %.
The basic idea is that the EA will alternate between buying and selling trades with specific TP and SL parameters. As soon as 1 trade closes, the trade in the opposite direction should open. The code looks fine to me, and compiles properly, but when I try to backtest it, it only places the first trade.
I think the issue may be with the Bought_Last or Sold_Last flags, but I can't figure out the solution for the life of me (been at it an hour and a half already). Could someone please point out my oversight?
Thanks!