Download MetaTrader 5
To add comments, please log in or register
Do you have Linux? Find out how to install MetaTrader on it!
Abdou Solyman
135
Abdou Solyman 2014.04.12 07:04 

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;
         }
      }
   }

Tjipke de Vries
6280
Tjipke de Vries 2014.04.12 08:40  
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;

Abdou Solyman
135
Abdou Solyman 2014.04.12 09:10  
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--)
qjol
3243
qjol 2014.04.13 00:20  
warnings doeasn't stop a EA
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.04.13 00:35  
Errors will stop the EA from compiling.
/
To add comments, please log in or register