iBarShift() as well as other time-series functions treats the data as a series array where the current bar is located at index/shift [0].
In contrast, for MQL5 by default, the OnCalculate() event handler, presents the argument data as a non-series array where the current bar is index/shift [rates_total-1].
This is explained in the very documentation you have linked where it is explained that you should be using the ArrayGetAsSeries() to find out which form is being used and/or to set the form you wish to use with ArraySetAsSeries().
iBarShift() as well as other time-series functions treats the data as a series array where the current bar is located at index/shift [0].
In contrast, for MQL5, by default the OnCalculate() event handler, presents the argument data as a non-series array where the current bar is index/shift [rates_total-1].
This is explained in the very documentation you have linked where it is explained that you should be using the ArrayGetAsSeries() to find out the which form is being used and/or to set the form you wish to use with ArraySetAsSeries().
Ah and I even remember you commenting on one of the threads I was digging thru. Ugh if it was a snake id be bitten about 33 times haha. Very much appreciated and hope one day to contribute as much as you all have to this community. Thank you sir :) Muito Obrigado Fernando!
iBarShift() as well as other time-series functions treats the data as a series array where the current bar is located at index/shift [0].
In contrast, for MQL5, by default the OnCalculate() event handler, presents the argument data as a non-series array where the current bar is index/shift [rates_total-1].
This is explained in the very documentation you have linked where it is explained that you should be using the ArrayGetAsSeries() to find out the which form is being used and/or to set the form you wish to use with ArraySetAsSeries().
Hey Fernando, Again thank you for taking the time to reply to this, very much appreciated. I had a chance to sit down with my partner and try what you suggested but realized that the issue doesn't appear to be with the arrays. When we send in a value from time[] things earlier in the array are coming back with higher numbers and current bars are coming back lower. We have double checked the time array is not a series, as shown by the false flag, we've double checked the obvBuffer[] is also not set as series and matches up with time[] in that regard. While we could potentially solve this by setting these arrays to series this would require a through rework and would like to understand why this is happening.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Somehow when printing out iBarShift() it appears to be going in reverse order from high to low while our time is being printed from past to present. We are sending in the most recent time and getting back the lowest index in our indicator buffer (obvBuffer[]) . We would expect the current index to be the highest as our indicator processes data from left to right. We have triple checked the indexing direction https://www.mql5.com/en/docs/series/bufferdirection and iBarShift https://www.mql5.com/en/docs/series/ibarshift details a few times but not seeing what im missing. Thanks for any insights and help understanding these details.