Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (dBc), 17,971 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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: 28,022
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,022
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 | 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