Help Please on iHighest - page 2

 
dkpmba:

Damn man! so it works backward and I was thinking forward. So when we say

 for(int i=0; i<Bars; i++)

 

i = 0 is the most recent bar and i = 1 is the bar previous to the most recent one. And I was thinking that i = 0 is the first (historical) bar in the current chart. Thanks guys you rock! 

 

My pleasure.

(in mql5 indexation is like you thought and it is uncomfortable) 

 
dkpmba: Damn man! so it works backward and I was thinking forward. So when we say

 for(int i=0; i<Bars; i++)

i = 0 is the most recent bar and i = 1 is the bar previous to the most recent one. And I was thinking that i = 0 is the first (historical) bar in the current chart.

In indicators (only) you can use the arguments in OnCalculate (high, low, etc. ) and set them to series (Bars-1, ..., 2,1, 0=current) or not series (0=oldest, 1,2,... Bars-1) Buffers default to series and you have to set them to not series, to match.

The Predefined Variables - MQL4 Reference High, Low, etc., are always series and thus work with iHighest - Timeseries and Indicators Access - MQL4 Reference, etc. 

Note the difference high vs High and low vs Low.

Reason: