Download MetaTrader 5
To add comments, please log in or register
Share your program via Code Base. Gain access to millions of traders!
Gerardo Bustos
746
Gerardo Bustos 2015.06.13 20:36 

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
2500
Drazen Penic 2015.06.13 21:52  

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
4506
Marco vd Heijden 2015.06.13 22:55  

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 2015.06.17 18:31  
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