No bar 0 is the newest or current one and the highest number is the oldest bar.
Documentation on MQL5: Timeseries and Indicators Access / iBarShift
- www.mql5.com
//| Script program start function | //
Documentation on MQL5: Timeseries and Indicators Access
- www.mql5.com
These are functions for working with timeseries and indicators. A timeseries differs from the usual data array by its reverse ordering - elements of timeseries are indexed from the end of an array to its begin (from the most recent data to the oldest ones). To copy the time-series values and indicator data, it's recommended to use dynamic...
I read them... I just can't connect that info to what I see in the debug output. Even the bit that the doc says that time[0] should be the newest one, but in the screen I posted above you see that it's the other way round.
By the way, the doc you linked says:
Arrays passed
to the function reflect price data, i.e.
these arrays have the sign of a timeseries and function ArrayIsSeries() will
return true when checking these arrays.
But the first thing I call in OnCalculate is:
bool as_ser1 = ArrayGetAsSeries(time); bool as_ser2 = ArrayGetAsSeries(open);
and both values are false contrary to what the doc says
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
Hello all,
I have trouble understanding the basic concept of bar indexes.
From what I see, bar with index 0 is the oldest one on the chart.
The current one has index:
rates_total - 1
I was trying to use iBarShift, but it seems to give me opposite results? This is what confuses me. In the example below time[0] is the oldest time available. But
Gives a big number... Then calling it again with time[1] will give a smaller number. The code below runs in a M15 chart.
Could you help?
I'm trying to get a hang on iBarShift as an indicator I want to develop depends on data from 3 different time intervals.
Cheers!