StartDate of LookBack period with YYYYMMDD

Posted By: AndrewAMD

StartDate of LookBack period with YYYYMMDD - 02/16/22 18:32

jcl,

Currenly, StartDate has two input methods: YYYY, and YYYYMMDD.

From the manual:
Quote
- A 4-digit number (f.i. 2006) gives the number of the historical data file with which the simulation begins (f.i. EURUSD_2006.t6). If the data file has no year number (f.i. MSFT.t6), the simulation starts with the earliest record in the file.
- A date in yyyymmdd format starts the simulation at a certain date (f.i. 20090401 = April 1st, 2009). The LookBack period is added in front of the date and begins accordingly earlier. Due to the lookback period, StartDate = 2006 is not the same as StartDate = 20060101.
For YYYYMMDD, can there be a mode where StartDate defines the beginning of the lookback period rather than the first bar after lookback? (In other words, "the simulation starts with the earliest record in the file.") Maybe input a negative YYYYMMDD to enable it?

This can be useful if I know how much historical data I have and I want the Lookback period to end as early as possible.
Posted By: jcl

Re: StartDate of LookBack period with YYYYMMDD - 02/17/22 07:28

In that case use the YYYY method. The lookback period will then start with the earliest record in the file.
Posted By: AndrewAMD

Re: StartDate of LookBack period with YYYYMMDD - 02/17/22 13:56

Just to confirm my understanding, which of the following are correct?
1) Intraday data is in format MSFT.t6. StartDate is defined as 2022. Therefore, the first bar is at the very beginning of 2022 and will be within the lookback period (if there is lookback).
2) Intraday data is in format MSFT_YYYY.t6 and includes 2020, 2021, and 2022. StartDate is defined as 2022. Therefore, the first bar is at the very beginning of 2022 and will be within the lookback period (if there is lookback).
3) Daily data is in format MSFT.t6. StartDate is defined as 2022. Therefore, the first bar is at the very beginning of 2022 and will be within the lookback period (if there is lookback).
Posted By: Petra

Re: StartDate of LookBack period with YYYYMMDD - 02/19/22 12:12

All but 2) is wrong. The first lookback bar is just the first bar in the file. With limited data, enter YYYY and the lookback period then ends as early as possible.
Posted By: AndrewAMD

Re: StartDate of LookBack period with YYYYMMDD - 02/19/22 21:48

I was puzzled by this response, so I ran the test myself. Below are the results.

Based on this, I would re-word the manual a bit. I think the phrase "If the data file has no year number (f.i. MSFT.t6)" is misleading, since the first record in the t6 file (in November of 1999) is completely ignored.

Code
//#define INTRADAY
#define EXACTDATE

function run() {
#ifdef INTRADAY
	LogNumber = BarPeriod = 1;
#else
	LogNumber = BarPeriod = 1440;
#endif
#ifdef EXACTDATE
	LogNumber += 10000;
	StartDate = 20210712;
#else
	StartDate = 2021;
#endif

	set(LOGFILE);
	LookBack = 5;
	
	EndDate = 2022;
	assetList("AssetsIB");
#ifdef INTRADAY
	asset("EUR/USD"); // EURUSD_YYYY.t6, 2005 thru Feb 2022
#else
	asset("DIS"); // DIS.t6,  Nov 1999 thru Feb 2022
#endif
}

/*   ********* LOG OUTPUTS *********

BARPERIOD = 1440 (DAILY, YYYY)

V 2.464 on Sat 22-02-19 16:04:01 (Zorro S Subscription)
Test: test_startdate DIS 2021..2022
Assets AssetsIB

[1: Tue 21-01-05 15:40] (178.44)
[2: Wed 21-01-06 15:40] (179.12)
[3: Thu 21-01-07 15:40] (178.58)
[4: Fri 21-01-08 15:40] (178.69)
End of lookback period

[5: Mon 21-01-11 15:40] (179.09)
[6: Tue 21-01-12 15:40] (175.99)
[7: Wed 21-01-13 15:40] (176.12)
[8: Thu 21-01-14 15:40] (173.43)
...

BARPERIOD = 1440 (DAILY, YYYYMMDD)

V 2.464 on Sat 22-02-19 16:14:43 (Zorro S Subscription)
Test: test_startdate DIS 2021..2022
Assets AssetsIB

[1: Tue 21-07-06 15:40] (173.69)
[2: Wed 21-07-07 15:40] (172.82)
[3: Thu 21-07-08 15:40] (172.80)
[4: Fri 21-07-09 15:40] (177.04)
End of lookback period

[5: Mon 21-07-12 15:40] (184.38)
[6: Tue 21-07-13 15:40] (183.65)
[7: Wed 21-07-14 15:40] (183.42)
[8: Thu 21-07-15 15:40] (184.15)

BARPERIOD = 1 (INTRADAY, YYYY)

V 2.464 on Sat 22-02-19 16:04:01 (Zorro S Subscription)
Test: test_startdate EUR/USD 2021..2022
Assets AssetsIB

[1: Sun 21-01-03 23:01] (1.22375)
[2: Sun 21-01-03 23:02] (1.22344)
[3: Sun 21-01-03 23:03] (1.22358)
[4: Sun 21-01-03 23:04] (1.22364)
End of lookback period

[5: Sun 21-01-03 23:05] (1.22342)
[6: Sun 21-01-03 23:06] (1.22334)
[7: Sun 21-01-03 23:07] (1.22342)
[8: Sun 21-01-03 23:08] (1.22379)
...

BARPERIOD = 1 (INTRADAY, YYYYMMDD)

V 2.464 on Sat 22-02-19 16:13:30 (Zorro S Subscription)
Test: test_startdate EUR/USD 2021..2022
Assets AssetsIB

[1288: Sun 21-07-11 23:55] (1.18720)
[1289: Sun 21-07-11 23:56] (1.18726)
[1290: Sun 21-07-11 23:57] (1.18735)
[1291: Sun 21-07-11 23:58] (1.18734)
[1292: Sun 21-07-11 23:59] (1.18735)
End of lookback period

[1293: Mon 21-07-12 00:00] (1.18731)
[1294: Mon 21-07-12 00:01] (1.18731)
[1295: Mon 21-07-12 00:02] (1.18726)
[1296: Mon 21-07-12 00:03] (1.18734)
...

*/
Posted By: Petra

Re: StartDate of LookBack period with YYYYMMDD - 02/20/22 09:14

Hmm, in the DIS / YYYY case I would expect that the first bar is 1999, at least that's what my documentation says. Does it change when you set a different startdate, like 2000? Is DIS.t6 the only DIS history or have you maybe additionally DIS_YYYY.t6 files?
Posted By: AndrewAMD

Re: StartDate of LookBack period with YYYYMMDD - 02/21/22 12:25

Originally Posted by Petra
Is DIS.t6 the only DIS history or have you maybe additionally DIS_YYYY.t6 files?
I don't happen to have DIS_YYYY.t6 files, so I used EUR/USD instead for intraday.

I attached the DIS.t6 file for your reference.

Attached File
DIS.t6.zip  (35 downloads)
Posted By: Petra

Re: StartDate of LookBack period with YYYYMMDD - 02/26/22 10:12

I learned that the documentation was wrong. You must set the year number to the earliest year in your history for starting with the earliest record.

The corrected manual text:

"- A 4-digit year number (f.i. 2006) gives the number of the historical data file with which the simulation begins (f.i. EURUSD_2006.t6). If the data file has no year number (f.i. MSFT.t6), the simulation starts with the earliest record in the file that matches the year number. "
Posted By: AndrewAMD

Re: StartDate of LookBack period with YYYYMMDD - 02/26/22 12:01

I concur. Thank you!
© 2024 lite-C Forums