Download MetaTrader 5

Warning with build 604

To add comments, please log in or register
manu
78
manu  

Hello,

Sorry for my bad English.

I compile my old EA in the build 604 format and I receive a warning "Check operator precedence for possible error; use parentheses to clarify precedence" on the OrderSelect line.

I try to integrate parentheses, but the warning stay.

If someone had a idea to delete this message, thanks

Emmanuel


Total_Orders = OrdersTotal();
   Compteur_cet_EA = 0;
   
   for(Position_Index = Total_Orders - 1; Position_Index >= 0 ; Position_Index --)
      {        
      if (
         OrderSelect(Position_Index, SELECT_BY_POS, MODE_TRADES) &&
         (OrderType() == OP_BUY && OrderMagicNumber()==Colombanaise_MACD_Magic_Number) ||
         (OrderType() == OP_SELL && OrderMagicNumber()==Colombanaise_MACD_Magic_Number)||
         (OrderType() == OP_BUYLIMIT && OrderMagicNumber()==Colombanaise_MACD_Magic_Number)||
         (OrderType() == OP_SELLLIMIT  && OrderMagicNumber()==Colombanaise_MACD_Magic_Number)
         )   
         
         {
         Compteur_cet_EA = Compteur_cet_EA + 1;
         }     
      }
Simon Gniadkowski
Moderator
18024
Simon Gniadkowski  
arsouille:

Hello,

Sorry for my bad English.

I compile my old EA in the build 604 format and I receive a warning "Check operator precedence for possible error; use parentheses to clarify precedence" on the OrderSelect line.

I try to integrate parentheses, but the warning stay.

If someone had a idea to delete this message, thanks

Which first && or || ?

OrderSelect(Position_Index, SELECT_BY_POS, MODE_TRADES)    &&       
         (OrderType() == OP_BUY && OrderMagicNumber()==Colombanaise_MACD_Magic_Number)    ||      
Alain Verleyen
Moderator
32418
Alain Verleyen  
arsouille:

Hello,

...
Voilà.
   Total_Orders = OrdersTotal();
   Compteur_cet_EA = 0;
   
   for(Position_Index = Total_Orders - 1; Position_Index >= 0 ; Position_Index --)
      {        
      if (
         OrderSelect(Position_Index, SELECT_BY_POS, MODE_TRADES) &&
         ((OrderType() == OP_BUY && OrderMagicNumber()==Colombanaise_MACD_Magic_Number) ||
         (OrderType() == OP_SELL && OrderMagicNumber()==Colombanaise_MACD_Magic_Number)||
         (OrderType() == OP_BUYLIMIT && OrderMagicNumber()==Colombanaise_MACD_Magic_Number)||
         (OrderType() == OP_SELLLIMIT  && OrderMagicNumber()==Colombanaise_MACD_Magic_Number))
         )   
         
         {
         Compteur_cet_EA = Compteur_cet_EA + 1;
         }     
      }
aaaacom
117
aaaacom  
      int Position_Index, Colombanaise_MACD_Magic_Number;
      bool X = (
         OrderSelect(Position_Index, SELECT_BY_POS, MODE_TRADES) &&
         ((OrderType() == OP_BUY && OrderMagicNumber()==Colombanaise_MACD_Magic_Number) ||
         (OrderType() == OP_SELL && OrderMagicNumber()==Colombanaise_MACD_Magic_Number)||
         (OrderType() == OP_BUYLIMIT && OrderMagicNumber()==Colombanaise_MACD_Magic_Number)||
         (OrderType() == OP_SELLLIMIT  && OrderMagicNumber()==Colombanaise_MACD_Magic_Number))
         );   
   

a && b || c || d || e -> new code: a && (b || c || d || e)

manu
78
manu  

Thanks a lot, you have corrected my warning and above, I understood.

Regards

To add comments, please log in or register