iBarShift problems
Posted: Sat Aug 15, 2015 10:10 am
Hi, I've seen that systematically the metatrader function iBarShift returns the wrong values in the backtester.
Here you see my code:
previousday_start = iTime(NULL,PERIOD_D1,i);
previousday_end = previousday_start + 24*60*60 -1;
Print ("yesterday start = ", TimeToStr(previousday_start,TIME_DATE|TIME_SECONDS));
Print ("yesterday end = ", TimeToStr(previousday_end ,TIME_DATE|TIME_SECONDS));
start_bar = iBarShift(NULL,PERIOD_M1,previousday_start);
end_bar = iBarShift(NULL,PERIOD_M1,previousday_end);
Print ("start-bar - end-bar = ", start_bar-end_bar);
Print ("start_bar = ", start_bar);
Print ("end_bar = ", end_bar);
When I run this program on the M1 timeframe in the backtester I should expect 1440 as the result of "start_bar-end_bar";
Testing over a long period I never reach 1440 bars (the number of M1 bars in a day).
The maximum result it returns is 1380 instead of 1440
Is this a problem with the function "iBarShift" or is it a problem with Tickstory ?
Does somebody discouvered the same issues ?
Regards,
Danny
Here you see my code:
previousday_start = iTime(NULL,PERIOD_D1,i);
previousday_end = previousday_start + 24*60*60 -1;
Print ("yesterday start = ", TimeToStr(previousday_start,TIME_DATE|TIME_SECONDS));
Print ("yesterday end = ", TimeToStr(previousday_end ,TIME_DATE|TIME_SECONDS));
start_bar = iBarShift(NULL,PERIOD_M1,previousday_start);
end_bar = iBarShift(NULL,PERIOD_M1,previousday_end);
Print ("start-bar - end-bar = ", start_bar-end_bar);
Print ("start_bar = ", start_bar);
Print ("end_bar = ", end_bar);
When I run this program on the M1 timeframe in the backtester I should expect 1440 as the result of "start_bar-end_bar";
Testing over a long period I never reach 1440 bars (the number of M1 bars in a day).
The maximum result it returns is 1380 instead of 1440
Is this a problem with the function "iBarShift" or is it a problem with Tickstory ?
Does somebody discouvered the same issues ?
Regards,
Danny