Download MetaTrader 5
To add comments, please log in or register
Make screenshots in MetaTrader and manage them in the gallery!
sd59
499
sd59 2014.09.25 07:12 

Please can someone explain why I get the following warning from this code? (I know it's only a warning but why?)

int CheckTrades()
{
 int num_orders;
 for(int i=0;i<OrdersTotal();i++)
 { 
  if(OrderSelect(i, SELECT_BY_POS,MODE_TRADES)== True)       
  {                                                     
   //if order isn't for this symbol
   if(OrderSymbol()!= Symbol()) continue;
   
   num_orders++;
  }
 } 
  return(num_orders);
}

 After compiling

 

Halley
198
Halley 2014.09.25 07:31  
sd59:

Please can someone explain why I get the following warning from this code? (I know it's only a warning but why?)

 After compiling

 

Simply initialize it:

int num_orders=0; 

sd59
499
sd59 2014.09.25 07:46  
DeepThought:

Simply initialize it:

int num_orders=0; 

thanks (i'm not a programmer as you can tell!)
/
To add comments, please log in or register