Please help me with " return value of "OrderSelect" should be checked"

 

Hello,

I am trying to solve "return value of "orderSelect" should be checked" from the following code.

for(cnt=0;cnt<OrdersTotal();cnt++)
   {
      OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
         if(OrderType()==OP_BUY&&OrderSymbol()==Symbol()&&((OrderMagicNumber()==Magic)||Magic==0))
            {
               if(CB==1)
               {
                  OrderClose(OrderTicket(),OrderLots(),Bid,Slip,Red);return(0);
               }
            }
      
         if(OrderType()==OP_SELL&&OrderSymbol()==Symbol()&&((OrderMagicNumber()==Magic)||Magic==0))
            {
               if(CS==1)
               {
                  OrderClose(OrderTicket(),OrderLots(),Ask,Slip,Red);return(0);
               }
            }
   }
double SLI=0,TPI=0;int TK=0;
Thanks for the help.
 

It's a bool value.

if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)==true){ /* do something here for true */ }

When in doubt, read the documentation.

https://www.mql5.com/en/docs/trading/orderselect

Documentation on MQL5: Trade Functions / OrderSelect
Documentation on MQL5: Trade Functions / OrderSelect
  • www.mql5.com
Trade Functions / OrderSelect - Reference on algorithmic/automated trading language for MetaTrader 5
 

You could try this:  http://bit.ly/2u9zHin

Or this: http://bfy.tw/Ckiy

LMGTFY
LMGTFY
  • lmgtfy.com
LMGTFY