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?
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
iLowest / iHighest are int's.. need double values for indicator. won't work..
Loop through the indicator values and store the lowest / highest values in variables
Neal_Van:
iLowest / iHighest are int's.. need double values for indicator. won't work..
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
- docs.mql4.com
ArrayMaximum - Array Functions - MQL4 Reference
Keith Watford:
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.
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;
}
Never mind. try James Cater's suggestion
Neal_Van:
I don't understand your code.
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);
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]);
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:
thanks
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);
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]);
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: I don't understand your code.
-
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. - or pay (Freelance) someone to code it.
Hiring to write script - General - MQL5 programming forum
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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.