Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 08/22/26 08:44
Max Number of Strategies in /Strategy folder
by Martin_HH. 08/17/26 07:54
Pause button for evaluation shell?
by AndrewAMD. 08/13/26 17:16
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 08/10/26 12:46
phantom() not defined in indicators.c
by jcl. 08/07/26 11:45
Accepting new programming clients
by AndrewAMD. 08/06/26 21:25
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 1,045 guests, and 25 spiders.
Key: Admin, Global Mod, Mod
Newest Members
riggi89, shuhari, KD1990, Student_64151, Koti
19230 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,132
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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