Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 20:05
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, kzhao), 901 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
adjusting for daylight savings time in M1 T6 #483161
05/06/21 15:09
05/06/21 15:09
Joined: May 2018
Posts: 134
S
SBGuy Offline OP
Member
SBGuy  Offline OP
Member
S

Joined: May 2018
Posts: 134

I'm creating a 1-minute bar .t6 file from a US data source that only specifies the time in New York market hours: 9:30-16:00 ET. However .t6 files require timestamps to be in UTC zone.

Is there anyway to check to see if the particular M1 bar is in daylight savings time, so I can +4 or +5 hours accordingly to get UTC time?

checking (dst(ET,0)) doesn't work because the 2nd argument is a bar offset, and there are no bars yet in main(). If I do it in run(), the first asset does not evaluate dst() correctly, subsequent assets do evaluate dst() correctly. Strange.

I looked at the sample CSVtoHistory.c sample script and it hardcodes any hour adjustment. Surely that's not a good solution if my historical data crossed DST periods.

There used to be a HistoryZone system variable, but it appears to be removed in recent releases.

Any ideas?

Many thanks!

Re: adjusting for daylight savings time in M1 T6 [Re: SBGuy] #483162
05/06/21 15:31
05/06/21 15:31
Joined: Feb 2017
Posts: 1,731
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,731
Chicago

Re: adjusting for daylight savings time in M1 T6 [Re: SBGuy] #483163
05/06/21 15:51
05/06/21 15:51
Joined: May 2018
Posts: 134
S
SBGuy Offline OP
Member
SBGuy  Offline OP
Member
S

Joined: May 2018
Posts: 134
Dude! You're awesome! That worked.

But just to be safe I need to set Now back to the actual current UTC time right - like this?

Code
	var adj = 5.0;
	Now = dataVar(34,i,0);
	if (dst(ET,NOW)) {	
		adj = 4.0;
		printf("[%s] DST ACTIVE !!!\n",myAsset);
	}
	printf("adj = %.0f\n",adj);
	Now = wdate(NOW);

	for (i=records-1; i>=0; i--)	{
		var mytime = dataVar(34,i,0) + adj/24.0;
		dataSet(34,i,0,mytime);		
	}



Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1