Download MetaTrader 5

Get lowest Lows in 10 bar intervals from 100 previous bars

To add comments, please log in or register
Gerardo Bustos
746
Gerardo Bustos  

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 

Drazen Penic
2580
Drazen Penic  

Size of LowestLow array is zero (0).

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

Marco vd Heijden
Moderator
4753
Marco vd Heijden  

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(...
Gerardo Bustos
746
Gerardo Bustos  
Marco vd Heijden:

yes arrayresize

maybe also look at 

And

Thanks guys! I'll correct my code.

 

Best regards,

Gerardo 

To add comments, please log in or register