Download MetaTrader 5
To add comments, please log in or register
Have you developed an application? Publish it in Code Base!
Stefano Specia
44
Stefano Specia 2014.06.19 13:29 

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

qjol
3243
qjol 2014.06.19 13:44  

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]);
   }
/
To add comments, please log in or register