# High Low range of indicator

334

Is there an easy way to determine the high low range going 10 bars back of an indicator?  *This is not bars.. Specifically the highest high and lowest low of 10 bars

back of the indicator.  Again this is not price but the buffer value..

Moderator
10645

Loop through the indicator values and store the lowest / highest values in variables
334

Keith Watford:
Loop through the indicator values and store the lowest / highest values in variables
how do i get the high low of the buffer values?
334

Keith Watford:
Loop through the indicator values and store the lowest / highest values in variables
iLowest / iHighest are int's.. need double values for indicator.  won't work..
Moderator
10645

Neal_Van:
iLowest / iHighest are int's.. need double values for indicator.  won't work..

I didn't suggest that you use iHighest or iLowest

double highest_value=0;
double lowest_value=EMPTY_VALUE;

for(int i=1;i<11;i++)
{
double indicator_value[i]=??;
if (indicator_value>highest_value)
highest_value=indicator_value;
if (indicator_value<lowest_value)
lowest_value=indicator_value;
}

.
5572

ArrayMaximum - Array Functions - MQL4 Reference
• docs.mql4.com
ArrayMaximum - Array Functions - MQL4 Reference
334

Keith Watford:

I didn't suggest that you use iHighest or iLowest

double highest_value=0;
double lowest_value=EMPTY_VALUE;

for(int i=1;i<11;i++)
{
double indicator_value[i]=??;
if (indicator_value>highest_value)
highest_value=indicator_value;
if (indicator_value<lowest_value)
lowest_value=indicator_value;
}

.
Moderator
10645

Never mind. try James Cater's suggestion
Moderator
2326

Neal_Van:

If either of these don't make sense to you, you probably need to look to the Freelance section.

double highest_value, lowest_value;         // variables to hold the highest/lowest value
highest_value = lowest_value = MyBuffer[0]; // set both to the current buffer value (bar 0)
for(int i=1; i<10; i++)                     // go back over the previous 9 bars
{
double buffer_value = MyBuffer[i];                             // store the buffer value for this bar
if(buffer_value > highest_value) highest_value = buffer_value; // if buffer > highest so far, update highest_value
if(buffer_value < lowest_value)  lowest_value  = buffer_value; // if buffer < lowest so far, update lowest_value
}
printf("Highest value: %f",highest_value);
printf("Lowest value: %f",lowest_value);

or

int highest_index=ArrayMaximum(MyBuffer,10), // store the index of the bar with the highest value
lowest_index =ArrayMinimum(MyBuffer,10); // store the index of the bar with the lowest value
printf("Highest value: %f",MyBuffer[highest_index]);
printf("Lowest value: %f",MyBuffer[lowest_index]);

334

honest_knave:

If either of these don't make sense to you, you probably need to look to the Freelance section.

double highest_value, lowest_value;         // variables to hold the highest/lowest value
highest_value = lowest_value = MyBuffer[0]; // set both to the current buffer value (bar 0)
for(int i=1; i<10; i++)                     // go back over the previous 9 bars
{
double buffer_value = MyBuffer[i];                             // store the buffer value for this bar
if(buffer_value > highest_value) highest_value = buffer_value; // if buffer > highest so far, update highest_value
if(buffer_value < lowest_value)  lowest_value  = buffer_value; // if buffer < lowest so far, update lowest_value
}
printf("Highest value: %f",highest_value);
printf("Lowest value: %f",lowest_value);

or

int highest_index=ArrayMaximum(MyBuffer,10), // store the index of the bar with the highest value
lowest_index =ArrayMinimum(MyBuffer,10); // store the index of the bar with the lowest value
printf("Highest value: %f",MyBuffer[highest_index]);
printf("Lowest value: %f",MyBuffer[lowest_index]);

thanks