Download MetaTrader 5

High Low range of indicator

To add comments, please log in or register
Neal_Van
334
Neal_Van  

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.

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


.
Blahtech Limited
5572
James Cater  
ArrayMaximum - Array Functions - MQL4 Reference
ArrayMaximum - Array Functions - MQL4 Reference
  • docs.mql4.com
ArrayMaximum - Array Functions - MQL4 Reference
Neal_Van
334
Neal_Van  
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.
Keith Watford
Moderator
10645
Keith Watford  
Never mind. try James Cater's suggestion
honest_knave
Moderator
2326
honest_knave  
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]);


 

Neal_Van
334
Neal_Van  
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
 
To add comments, please log in or register