geting zero values from indecators in the init function

 
int init()
  {
//---- 
 
  
   double adx,ma5,maxp13,maxp21;    // the graphs value
 
   
   ma5=iMA(NULL,PERIOD_H1,5,0,MODE_SMA,PRICE_CLOSE,0);
   maxp13=iMA(NULL,PERIOD_H1,13,0,MODE_EMA,PRICE_CLOSE,0);
   maxp21=iMA(NULL,PERIOD_H1,21,0,MODE_EMA,PRICE_CLOSE,0);
   adx=iADX(NULL,PERIOD_H1,14,PRICE_CLOSE,0,0);
   Print("ADX="+adx + "  MA5 " +ma5 +"  MAXP13 :"+maxp13+"  MAXP21 :"+maxp21);
}



when i run this in the tester i get 0 in all the 4 vars

what's the reason
how can i fix this???

 
please analyze result from GetLastError function
 
please analyze result from GetLastError function


the returend value is 0 no error
 
GetLastError after first indicator call (ma5=...)
it may be 4066. it may be no data when initialization. there are no reasons to call indicators in the init function
 
1). Try using 60 instead of PERIOD_H1.
2). Put that code in the start() function instead of inside the init() function.

- Vooch
Reason: