Fast iBarShift and Bars for MT5 – library MetaTrader 5
There are many versions of the iBarShift functions for MetaTrader 5. However, this version is especially simple, fast, and correct. int iBarShift(const string Symb,const ENUM_TIMEFRAMES TimeFrame,datetime time,bool exact=false) { int Res=iBars(Symb,TimeFrame,time+1,UINT_MAX); if(exact) if((TimeFrame!=PERIOD_MN1 || time>TimeCurrent()) && Res==iBars(Symb,TimeFrame,time-PeriodSeconds(TimeFrame)+1,UINT_MAX)) return(-1); return(Res); } As of the publication of this code, the integrated Bars function used … Read more