Gamestudio Links
Zorro Links
Newest Posts
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 827 guests, and 6 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
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