What is the difference between the function iHigh and iHighest?

 

As stated in the title, I'm wondering what's the different and when to use iHigh and iHighest?

Thank you. 

 
kai197:

As stated in the title, I'm wondering what's the different and when to use iHigh and iHighest?

iHigh gives you the high price of a particular bar, based on its offset. https://docs.mql4.com/series/ihigh

iHighest gives you the offset of a bar - not the price - which is the highest in a specified range. https://docs.mql4.com/series/ihighest 

For example:

int idx = iHighest(Symbol(), PERIOD_H1, MODE_HIGH, 10, 0);

... gives you the index of the highest of the last 10 H1 bars. It will return a bar shift, such as 5, not the high price of that bar.

Therefore, iHigh and iHighest are frequently used together. In order to get the high price of the last 10 bars, you would use:

double vHighOfLast10Bars = iHigh(Symbol(), PERIOD_H1, iHighest(Symbol(), PERIOD_H1, MODE_HIGH, 10, 0));

In other words: you take the output of iHighest and feed it into iHigh.

Reason: