Expert Stopped any one can please check this code

 

after the last update my EA stopped open new trades when i check it for errors it gives me this message

return value of 'OrderSelect' should be checked

 total = CountTrades();
   if (total == 0) flag = FALSE;
   for (cnt = OrdersTotal() - 1; cnt >= 0; cnt--) {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
         if (OrderType() == OP_BUY) {
            LongTrade = TRUE;
            ShortTrade = FALSE;
            break;
         }
      }
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
         if (OrderType() == OP_SELL) {
            LongTrade = FALSE;
            ShortTrade = TRUE;
            break;
         }
      }
   }

 
abdouamer:

after the last update my EA stopped open new trades when i check it for errors it gives me this message

return value of 'OrderSelect' should be checked



that is a warning message not an error

for not getting this warning you can change the line to

if(!OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES))break;

but then also it will not change your EA stopped

might be there is no open buy and open sell

you restarted the program and have that way

LongTrade = FALSE;

ShortTrade = FALSE;

 
deVries:


that is a warning message not an error

for not getting this warning you can change the line to

but then also it will not change your EA stopped

might be there is no open buy and open sell

you restarted the program and have that way

LongTrade = FALSE;

ShortTrade = FALSE;


thanks for your reply, i have also this warnings maybe its the reason

this one on ordermodify

if (NewOrdersPlaced) {
      if (flag == TRUE) {
         for (cnt = OrdersTotal() - 1; cnt >= 0; cnt--) {
            if(!OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES))break;
            if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
            if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) OrderModify(OrderTicket(), NormalizeDouble(AveragePrice,Digits), NormalizeDouble(OrderStopLoss(),Digits), NormalizeDouble(PriceTarget,Digits), 0, Yellow);
            NewOrdersPlaced = FALSE;
         }
      }
   }
   return (0);

and this one on declaration of 'cnt' hides global declaration at line 40


 for (int cnt = OrdersTotal() - 1; cnt >= 0; cnt--)
 
warnings doeasn't stop a EA
 
Errors will stop the EA from compiling.
Reason: