Counting past Stochastic data backwards

 

Hello everybody, I'm trying desperatedly to get the value of past stochastic values over n amount of bars.
The error i get is "'[' array required".
Could you please explain me why iStochastic function wouldn't start on a simple for loop?
Here is my code.

int init(){


int i;  
int Bar=10;
                   
for(i=0;i<Bar-1;i++)
double Stoch=iStochastic(NULL,PERIOD_CURRENT,5,3,3,MODE_SMA,0,MODE_MAIN,0);

Alert(Stoch[i]);
return(0);
}

Many thanks

 

first of all, don't do it on "init" section, you will probably ran into error 4066

int i;  
int Bar=10;
double Stoch[];
ArrayResize(Stoch, Bar);
for(i=0;i<Bar-1;i++)
   {
   Stoch[i]=iStochastic(NULL,PERIOD_CURRENT,5,3,3,MODE_SMA,0,MODE_MAIN,i);
   Alert(Stoch[i]);
   }
Reason: