Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (dr_panther, Ayumi, 1 invisible), 877 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 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,726
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,726
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