for(cnt = OrdersTotal(); cnt >= 0; cnt--) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); mode = OrderType(); //---- if(OrderSymbol() == Symbol()) { if(mode == OP_BUY) OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), slippage, Blue);
If you close an order all the higher numbered one are renumbered. Always count DOWN when closing orders. I count down always.
if(OpenOrders >= MaxTrades) ContinueOpening = False; else ContinueOpening = True;Simplify
ContinueOpening = (OpenOrders < MaxTrades);Check for errors
OrderSend(Symbol(), OP_SELL, mylotsi, SellPrice, slippage, sl, tp, //...becomes
ticket = OrderSend(Symbol(), operation, size, now.open, SlippagePips * pips2points, 0, 0, // SL,TP order.comment, MagicNumber + Period.index, NO_EXPIRATION, clr ); if (ticket < 0) { Alert( "OrderSend(type=", operation, " (", operation.text, "), lots=", lots.new, ", price=", DoubleToStr( now.open, Digits ), " (", DoubleToStr((now.open-Bid)/pips2dbl,Digits.pips), "), SL=0, TP=0, '", order.comment, "', ...) failed: ", GetLastError()); //...I suspect your problem is
if(MaxTrades > 12) mylotsi = NormalizeDouble(mylotsi*1.5, 1); else mylotsi = NormalizeDouble(mylotsi*2, 1);Lots must be a multiple of MarketInfo( Symbol(), MODE_LOTSTEP )
mylotsi = MathFloor( mylotsi / LotStep )*LotStep; // truncate if (mylotsi < MarketInfo( Symbol(), MODE_MINLOT )) { // too small...

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
Hello,
I've an EA that's based on Multi-lot Scalper and I want to make it trade for micro-lots "0.01"
The problem is that it start the first trade successfully but when it comes to take the second trade, it doesn't respond though it works well for lots "1" and mini-lots "0.1" quantities.
I wish anyone can help me with that, thank you so much in advance.
I'm attaching the complete code for it in a file because it doesn't allow me to put the code here "too long"