• Sign up >>

Using iBarShift

To add comments, please log in or register
Jim Van
6
Jim Van  
I am writting a custom indicator using iBarShift to select the bars to anylize. When I use the following code to implement the iBarShift() funtion it returns 4999 no matter what
datetime I use. The only change that i have made to the chart is under Tools-Options->Max Bars on chart was change from the default setting to 5000. Can anyone help me
understand this? Thanks

extern string StartYear = "2005";
extern string StartMonth = "4";
extern string NumberOfMmonths = "1";

int init()
{
return(0);
}

int deinit()
{
return(0);
}
int start()
{
int counted_bars=IndicatorCounted();
string Start = StringConcatenate(StartYear,".",StartMonth,".", "01," 00:00");
Print(Start);
datetime start_time = StrToTime(Start);
int shift=iBarShift(NULL,PERIOD_H1,start_time,false);
Print("shift of bar with open time ",TimeToStr(start_time)," is ",shift);

return(0);
}
To add comments, please log in or register