[MQL4 Coding Advise] Which is best for filtering order with symbol and Magic Number?

Hello,

Which will be more effective, reliable and faster?

Code 1 :

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 :

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?

They should both be about the same in terms of speed. Lookup the order that an if statement is evaluated in (left to right or right to left) and in your multiple clause if statements put the least restrictive one so that it gets evaluated first. That way the code does not waste time evaluating conditions when there is no need to. As you are using an OR that will avoid evaluating the second part of the if statement.
However, look and see if the functions you are calling within the loop can be cached to save time.