High Low range of indicator

 

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..

Kind regards comrades.

 
Loop through the indicator values and store the lowest / highest values in variables
 
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?
 
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..
 
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;
     }


.
 
ArrayMaximum - Array Functions - MQL4 Reference
ArrayMaximum - Array Functions - MQL4 Reference
  • docs.mql4.com
ArrayMaximum - Array Functions - MQL4 Reference
 
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;
     }


.
I don't understand your code.
 
Never mind. try James Cater's suggestion
 
Neal_Van:
I don't understand your code.

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


 

 
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
 
 
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
Reason: