Download MetaTrader 5
To add comments, please log in or register
Join MQL5 Cloud Network. Millions of traders are waiting for this!
Vasyl Nosal
18448
Vasyl Nosal 2016.03.07 00:02  
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) 

whroeder1
14201
whroeder1 2016.03.07 16:03  
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.

/ /12
To add comments, please log in or register