Get lowest Lows in 10 bar intervals from 100 previous bars

 

Hello forum, good day.

I need your help to get the lowest Lows in 10 bar intervals from 100 previous bars into an array. Your help will be much appreciated.

 

This is what I'm trying but I get an array out of range error:

double LowestLow[];
int    limit = MathMin( 100, iBars( NULL, 0 ) );

for ( int i = 1; i <= limit; i += 10 )
  {
    LowestLow[i] = Low[iLowest( NULL, 0, MODE_LOW, 10, i )];
  }


Best regards and thank you in advance,

Gerardo 

 

Size of LowestLow array is zero (0).

You need to call ArrayResize() or you should define LowestLow array size at declaration.

 

yes arrayresize

double LowestLow[];
ArrayResize(LowestLow,100,0);
int    limit = MathMin( 100, iBars( NULL, 0 ) );

for ( int i = 1; i <= limit; i += 10 )
  {
    LowestLow[i] = Low[iLowest( NULL, 0, MODE_LOW, 10, i )];
  }

maybe also look at 

ArrayMinimum(....

And

ArraySort(...
 
Marco vd Heijden:

yes arrayresize

maybe also look at 

And

Thanks guys! I'll correct my code.

 

Best regards,

Gerardo 

Reason: