Array out of range error

 
long volume[];
double candlesize[];

for(int z=5; z>=0; z--)
{  
   volume[z] = iVolume(Symbol(), Period(), z);
   
   if(Close[z]>Open[z])
   candlesize[z] = ((Close[z]-Open[z])*100000);
   
   if(Close[z]<Open[z])
   candlesize[z] = ((Open[z]-Close[z])*100000);
}

Wrote this to caclutate out the candlesize in pips. Getting the Array out of range error. If i remove "#property strict" it works.

Also tried a loop limit function but getting error "void function returns a value".

 
int limit;

int counted_bars=IndicatorCounted();

if(counted_bars<0) 
return(-1);

if(counted_bars>0) 
counted_bars--;

limit=Bars-counted_bars;
 
You have to use static arrays, or to resize dynamic arrays.
 
Big thanks. It works now properly.
Reason: