Download MetaTrader 5
To add comments, please log in or register
What are the latest MQL5.community news? The Wall section will tell you!
Tom
34
Tom 2015.06.21 11:31 
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;
Alain Verleyen
Moderator
28524
Alain Verleyen 2015.06.21 12:36  
You have to use static arrays, or to resize dynamic arrays.
Tom
34
Tom 2015.06.21 16:05  
Big thanks. It works now properly.
/
To add comments, please log in or register