StartDate causing excessive lookback period

Posted By: ozgur

StartDate causing excessive lookback period - 12/26/23 08:13

Tested in Version 2.6 (output also same in 2.53).
Below are a couple of iterations of the same code, commenting out/in StartDate and MinutesPerDay.

Code
void run()
{
	Verbose 	= 3;
	BarPeriod 	= 60;
	LookBack 	= 10000;
	
	StartDate 	= 20110624;
	EndDate 	= 20110625;
	NumYears    	= 3;
	MinutesPerDay 	= 1440;
}

Log:
Quote

testlb compiling............
EUR/USD 1849709 ticks read
12233(17621) bars 2009-06-21..2011-06-26 generated
Test: testlb EUR/USD 2011..2013



Code
void run()
{
	Verbose 	= 3;
	BarPeriod 	= 60;
	LookBack 	= 10000;
	
	// StartDate 	 = 20110624;
	EndDate 	= 20110625;
	NumYears    	= 3;
	MinutesPerDay	= 1440;
}

Log:
Quote
testlb compiling...........
EUR/USD 1105694 ticks read
15054(21716) bars 2009-01-02..2011-06-26 generated
Test: testlb EUR/USD 2009..2011



Code
void run()
{
	Verbose 	= 3;
	BarPeriod 	= 60;
	LookBack 	= 10000;
	
	// StartDate 	 = 20110624;
	EndDate 	= 20110625;
	NumYears    	= 3;
	// MinutesPerDay = 1440;
}

Log:
Quote
testlb compiling...........
EUR/USD 1105694 ticks read
15054(21716) bars 2009-01-02..2011-06-26 generated
Test: testlb EUR/USD 2009..2011



Code
void run()
{
	Verbose 	= 3;
	BarPeriod 	= 60;
	LookBack 	= 10000;
	
	StartDate 	= 20110624;
	EndDate 	= 20110625;
	NumYears    	= 3;
	// MinutesPerDay = 1440;
}

Log:
Quote
testlb compiling...........
Error 047: EUR/USD no 2004 history (History\EURUSD_2004.t6)
EUR/USD 3243025 ticks read
39196(56756) bars 2005-01-03..2011-06-26 generated
Test: testlb EUR/USD 2011..2013


I understand Zorro is trying to estimate max Lookback with MinutesPerDay parameter but there seems to be an inconsistent behaviour when StartDate is used.

Thanks.
Posted By: Spirit

Re: StartDate causing excessive lookback period - 12/26/23 13:46

When you give a start date, the lookback period is before that start date. You can check the lookback start when you assume a year has 252 trading days, and a day has 6 bars.
Posted By: ozgur

Re: StartDate causing excessive lookback period - 12/26/23 22:31

Yeah I see but comparing Case 3 and Case 4 in the above example, there is only 1 day difference between StartDate and EndDate however required lookback period jumps 4 years back suddenly.

Looking at all cases above, the MinutesPerDay parameter seems to be defaulted to some value other than 360 if StartDate isn't defined.
Posted By: jcl

Re: StartDate causing excessive lookback period - 01/02/24 12:01

"Default" means that it has this value unless you explicitely set a different value. When no start date is defined, the first date is NumYears in the past. If a start date is defined, the first date is the startdate minus the lookback period. If you have a 4 years lookback period, then the first date is 4 years before the start date, even if you test only one day.
Posted By: ozgur

Re: StartDate causing excessive lookback period - 01/02/24 21:40

I see now. In other words NumYears is inclusive of Lookback. Thanks.
© 2024 lite-C Forums