Download MetaTrader 5
To add comments, please log in or register
Find out how your rating can be improved
kai197
17
kai197 2016.09.12 08:26 

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

Thank you. 

JC
1394
JC 2016.09.12 08:45  
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.

/
To add comments, please log in or register