LookBack and StartBar

Posted By: gamadeus

LookBack and StartBar - 02/07/19 07:44

I am a bit puzzled about how Lookback and simulation Periods work.
Im using the following testscript:

function run()
{

StartDate = 20180104;
EndDate = 20180104;
BarPeriod = 60;
LookBack = 0;

if(!is(INITRUN) && !is(LOOKBACK)) printf("n%02i-%02i-%02i %04i",year(),month(),day(),tod());

}

What is strange about it, is that first timestamp printed is 2am, not 1am as expected.
However, when I change Lookback to any non zero value it prints at 1am as it is supposed to.

What is going on here?
Its not really a big issue, I would just like to understand Zorros idiosyncrasies.
Posted By: gamadeus

Re: LookBack and StartBar - 02/07/19 07:57

Printing the Bar number somwhat explains my question but leads to another question.
Without Lookback the bar that ends at 2am is 1, which is the first period that can be printed.

However any Lookback up to 7 shifts Bar by 46, i.e. the 2am Bar is 47 now. Incremental increases thereafter seem to shift Bar in non linear fashion (didnt try to figure out the pattern).

So my question now is, what the heck is Lookback doing here? I thought that integer is the number of bars prior to StartBar, which clearly is not the case here.
© 2024 lite-C Forums