New free code from MQL5: indicators, EAs, and scripts for traders.
But this function is not included 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.
Unique stair-step trend trading with the Stairsteps Expert Advisor. Innovative approach for consistent results. Learn more.
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.

As a side note, iBarShift() isn't always the best way to realize some task in MQL5. Depending of your algorithm, there can be better method.
Edit: 2014.10.03. Version 1.02 posted (fixed a bug if requested time is superior to last bar start time).
Level up your trading with professional RobotFX expert advisors and indicators. Visit www.robotfx.org for proven MT4/MT5 tools.
1864