iMAONARRAY problem

To add comments, please log in or register
Abdelrahman Shehata
114
Abdelrahman Shehata  

I'm trying to put ma on rsi in expert advisor but it says Array out of range

  double limit=Bars-1;
   double ma[];
   double ima[];
  
   ArrayResize(ima,Bars);
   ArrayResize(ma,Bars);
   for(int i=0;i<limit;i++){
   ma[i]=iRSI(Symbol(),0,14,0,i);
   ima[i]=iMAOnArray(ma,0,10,0,0,i);
   }
Abdelrahman Shehata
114
Abdelrahman Shehata  
Any one?
William Roeder
20207
William Roeder  
Do you really expect an answer? We can't see your broken code. There are no mind readers here and our crystal balls are cracked.

The code you posted isn't the problem, except you are trying to compute MA before you have populated your data array.

Abdelrahman Shehata
114
Abdelrahman Shehata  
William Roeder:
Do you really expect an answer? We can't see your broken code. There are no mind readers here and our crystal balls are cracked.

The code you posted isn't the problem, except you are trying to compute MA before you have populated your data array.

this is all the code inside the OnTick function and this is the only code i wrote!
I'm just trying to use it before applying it to my main EA

Abdelrahman Shehata
114
Abdelrahman Shehata  
Then i Think i should populate the array first
can you please explain how?
Keith Watford
Moderator
20313
Keith Watford  
   for(int i=0;i<limit;i++){
   ma[i]=iRSI(Symbol(),0,14,0,i);
   }

   for(int i=0;i<limit;i++){
   ima[i]=iMAOnArray(ma,0,10,0,0,i);
   }
To add comments, please log in or register