High Low range of indicator

393

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
23533

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

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?
393

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
23533

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;
}

.
38087

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

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
23533

Never mind. try James Cater's suggestion
Moderator
2312

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]);

393

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

21915

Neal_Van: I don't understand your code.
1. MT4: Learn to code it.
MT5: Begin learning to code it. If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into yours.
2. or pay (Freelance) someone to code it.
Hiring to write script - General - MQL5 programming forum