Ive been stuck trying to figure out how to solve this. Could some kind soul help me out or point in me the right direction please.
Basically Ive got 2 time points, a starting and ending time. I want to get the total number of bars shown on chart between these 2 points. Ive tried using (EndTimeRange -StartTimeRange * 60 * Period() ) but this included weekends into the total number.
Is the below code correct or is that a much simplier way to handle this?
Code: Select all
string STR ="2015.08.06 15:30" ; //Starting time example
string ETR ="2015.08.07 15:30" ; //Ending time example
datetime StartTimeRange = StrToTime(STR) ;
datetime EndTimeRange = StrToTime(ETR);
int XDBars1=iBarShift(Symbol(),0,StartTimeRange,true);
int XDBars2=iBarShift(Symbol(),0,EndTimeRange,true);
int XDBars= XDBars1-XDBars2;
Much appreciated!