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 (Quad, Ayumi, AndrewAMD), 1,092 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
hour() and lhour() #462473
10/03/16 04:13
10/03/16 04:13
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
I noticed in the manual that if BarZone is set to the local time, that hour() and lhour() are equivalent. I don't think this is the case. I think that hour() actually always refers to the UTC hour.

The following script:

Code:
function run()
{
	StartDate = 20150101;
	BarZone = ET;
	BarPeriod = 1440;
	BarOffset = 9*60;
	vars Close = series(priceClose());
	printf("\nhour: %d, lhour: %d, Close: %f", hour(), lhour(ET), Close[0]);
}



generates the following example output:

Code:
hour: 13, lhour: 9, Close: 1.109865
hour: 13, lhour: 9, Close: 1.115435
hour: 13, lhour: 9, Close: 1.116505
hour: 13, lhour: 9, Close: 1.120315
hour: 13, lhour: 9, Close: 1.119425
hour: 13, lhour: 9, Close: 1.114395
hour: 13, lhour: 9, Close: 1.108410
hour: 13, lhour: 9, Close: 1.108720
hour: 13, lhour: 9, Close: 1.107920
hour: 13, lhour: 9, Close: 1.118925
hour: 13, lhour: 9, Close: 1.118165
Chart... ok



which to me suggests that hour() is returning the UTC hour, while lhour(ET) is returning the ET hour, even though BarZone is set.

Re: hour() and lhour() [Re: boatman] #462481
10/03/16 17:13
10/03/16 17:13
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
The BarZone determines when the bar starts and ends. hour() and lhour() is the UTC and local time at the end of a bar. You let a bar end at 9:00 ET. At that time lhour is always 9 and UTC is 13 or 14, dependent on daylight saving.

Re: hour() and lhour() [Re: jcl] #462488
10/04/16 11:10
10/04/16 11:10
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
Thanks - that makes sense.


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