Hi Ange, can I ask you as a non-programmer but a curios trader what is a iBarShift and what benefits can receive by using this program? Thanks
Hi Ronnie,
Unfortunately for non-programmer, it's of little interest. iBarshift() is a function who permits to retrieve a bar/candle index from a date/time. It can be used in indicators and EA. There is direct benefit for traders.
Before you publish code with such loud claims, you should have tested it or something.... It just hangs the terminal:
Before you post code with such rhetoric, would check it, that is ... He just hangs terminal:
What kind of rhetoric are you talking about?
Don't worry, I checked it. It's not my code that hangs terminal, it's a new MT5/mql5 bug (build 858? - 868).
All versions, including yours, are bugged when tested with DateTime not matching the bar open time.
There is currently a bug with mql5 build 868 (maybe also 858) which results to a very slow execution of my iBarshift() version. Bug is reported to service desk. All is working well with build 842.
Hi,
the fact that it works well with 842 will not help as everybody is forced to update to latest version, or do you have a method to avoid the live updates?
well done for the updated routine
thanks
iBarShift:
There is a lot of users who searched for iBarShift function like in MQL4.
But this function is no more include in MQL5, mainly because MQL5 provides all necessary basic, low-level, functions to process such operation in a library.
As an alternative, several programmers provided their MQL5 version. I found 4 different versions from circlesquares, komposter (from Codebase), dc2008 (from famous article Migrating From MQL4 to MQL5) or marketeer (Russian forum).
What I discovered, remarkably, is that all four versions are bugged, in the sense they don't reproduce exactly the MQL4 iBarShift(). Indeed, when the datetime given as input parameter, don't match with the opening of a candle, all versions return a wrong value.
So I decided to make some tests about accuracy and speed of these various functions, and of course to develop my version. You can find attached both the library with this new version, and a little script used to benchmark the functions.
Author: Alain Verleyen