Download MetaTrader 5
To add comments, please log in or register
Hundreds of articles will help you to create a trading robot. Come and read them!
Mom_markets1
88
Mom_markets1 2010.10.07 02:48 

Hello, after the most recent meta editor update, I get a warning for several variables that they have not been initialized.

   int tick;
   int cat;

   int dog;

That is how they have been initialized, but I cannot find any difference between how mine are initialized, and how they are being initialized in other indicators that come with metatrader 5.

Thanks a lot.

Mom_markets1
88
Mom_markets1 2010.10.07 03:12  

It is a problem with initializing counters. Here, the error is that tick has been "possibly uninitialized", and the code does not work. 

int limit;

   if(prev_calculated==0)
      limit=0;
   else limit=prev_calculated-1;
   int tick;

//--- calculate MACD
   for(int i=limit;i<rates_total;i++)
     {
     double a = Close[i]>0;
      if(a==true )
        {
         tick++;
         BufferFlat[i]=tick;
        }

     }

//---- done
   return(rates_total);
  }

/
To add comments, please log in or register