error out of range for mql4

ali88005
15
ali88005  

please help me to solve this error 

in last line of loop , error array out of range???

why?

double ma_valum(int shift=0,int number_of_day=100,int period=5)

{



double arrayvolume[];

for(int i=0;i<number_of_day;i++)

{



int new_size=i+1;

ArrayResize(arrayvolume,new_size);

arrayvolume[i]=(double)iVolume(NULL,PERIOD_M5,i);


}


double khrooji=iMAOnArray(arrayvolume,0,10,0,MODE_EMA,shift);

return khrooji; 

}


William Roeder
24833
William Roeder  
  1. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
              Messages Editor

  2. ali88005: why?
    The resize failed, when number_of_day is greater than 2.1 billion. Or you didn't compile after changing the code.