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
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 859 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Using BarZone vs lhour with timezone #475829
01/09/19 09:00
01/09/19 09:00
Joined: Feb 2017
Posts: 369
D
Dalla Offline OP
Senior Member
Dalla  Offline OP
Senior Member
D

Joined: Feb 2017
Posts: 369
I'm a bit puzzled as to the behavior of lhour() I'm seeing with the below two snippets.
The manual says:
"Closing local hour of the given bar in the given time zone (see timeOffset below), considering daylight saving time (see dst below). F.i. lhour(EST) returns the current hour at the New York Stock Exchange. If BarZone is set to the local zone, lhour() is identical to hour()."

Here we pass JST as timezone to lhour()
Code:
void run() {
	set(LOGFILE);
	int timezone = JST;
	//BarZone = JST;
	BarPeriod = 15;
   StartDate = 2010;
   EndDate = 2019;
	asset("USD/JPY");
	
	if(lhour(timezone) == 10 && minute() == 00) {
		enterShort();
	}
	if(lhour(timezone) == 12 && minute() == 30) {
		exitShort();
	}
}



Here instead we use BarZone, which if I understand correctly would set the zone of all bars to JST, meaning hour should return identical values to the code above.
Code:
void run() {
	set(LOGFILE);
	//int timezone = JST;
	BarZone = JST;
	BarPeriod = 15;
   StartDate = 2010;
   EndDate = 2019;
	asset("USD/JPY");
	
	if(hour() == 10 && minute() == 00) {
		enterShort();
	}
	if(hour() == 12 && minute() == 30) {
		exitShort();
	}
}



However these two snippets result in totally different backtests.
Did I missunderstand for BarZone vs lhour() works?

Re: Using BarZone vs lhour with timezone [Re: Dalla] #475835
01/09/19 19:21
01/09/19 19:21
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
I thought hour() is UTC. You could print the hour and lhour to the log for checking.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1