Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, Quad, EternallyCurious, 1 invisible), 726 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 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,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

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