Hello,
Which will be more effective, reliable and faster?
Code 1 :
Code 2 :
Using not Equal to (or) using Equal to?
Which will be more effective, reliable and faster?
Code 1 :
MQL4:
void CloseOpenAndPendingTrades(int trade_close_magic) { for(int pos_0 = OrdersTotal() - 1; pos_0 >= 0; pos_0--) { OrderSelect(pos_0, SELECT_BY_POS, MODE_TRADES); if(OrderSymbol() != Symbol() || OrderMagicNumber() != trade_close_magic) continue; if(OrderType() > OP_SELL) OrderDelete(OrderTicket()); else { if(OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, 3, CLR_NONE); else OrderClose(OrderTicket(), OrderLots(), Ask, 3, CLR_NONE); } } }
Code 2 :
MQL4:
void CloseOpenAndPendingTrades(int trade_close_magic) { for(int pos_0 = OrdersTotal() - 1; pos_0 >= 0; pos_0--) { OrderSelect(pos_0, SELECT_BY_POS, MODE_TRADES); if(OrderSymbol() == Symbol() && OrderMagicNumber() == trade_close_magic) { if(OrderType() > OP_SELL) OrderDelete(OrderTicket()); else { if(OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, 3, CLR_NONE); else OrderClose(OrderTicket(), OrderLots(), Ask, 3, CLR_NONE); } } } }
Using not Equal to (or) using Equal to?