Gamestudio Links
Zorro Links
Newest Posts
bar time, right side open or close?
by qin. 01/02/26 02:15
long time to load data
by qin. 12/31/25 09:57
The new evaluation shell
by jcl. 12/29/25 09:56
about Zorro S (monthly)
by AndrewAMD. 12/29/25 03:24
Xor Memory Problem.
by TipmyPip. 12/26/25 19:14
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (qin, SBGuy, PeroPero), 3,251 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Syndrela, HDRSEO, AOUNZA, digitalboy381, agasior
19190 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Trading only certain times of day #433620
12/03/13 15:21
12/03/13 15:21
Joined: Jul 2013
Posts: 110
B
bfleming Offline OP
Member
bfleming  Offline OP
Member
B

Joined: Jul 2013
Posts: 110
I want a strategy to only trade certain times of day. I've read through the relevant part of the manual, but I'm pretty sure I don't have the code right for only trading between say 17h and 8h, but this is what I have:

Code:
if(hour() >= 17 && hour() <=8){
   	if(crossUnder(Signal,-Threshold)) 
		reverseLong(1); 
	   else if(crossOver(Signal,Threshold)) 
		reverseShort(1);



Could someone help me get this correct?

Many thanks!

Re: Trading only certain times of day [Re: bfleming] #433631
12/03/13 16:24
12/03/13 16:24
Joined: Jul 2000
Posts: 28,044
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,044
Frankfurt
If you want to trade in the evening after 17h or in the morning before 8h, you need an "or" condition:

if(hour() >= 17 or hour() <=8) ...

Re: Trading only certain times of day [Re: jcl] #433633
12/03/13 16:46
12/03/13 16:46
Joined: Jul 2013
Posts: 110
B
bfleming Offline OP
Member
bfleming  Offline OP
Member
B

Joined: Jul 2013
Posts: 110
ah, ok. thanks!

Re: Trading only certain times of day [Re: bfleming] #449189
03/07/15 09:32
03/07/15 09:32
Joined: Sep 2013
Posts: 73
M
Mangal Offline
Junior Member
Mangal  Offline
Junior Member
M

Joined: Sep 2013
Posts: 73
Can anyone tell me why it gives a syntax error the following:

if(hour()>=10EST and hour()<=17EST and....)

Even the following expresion gives a syntax error:

if(hour()>=10 and hour(0)<=17);

Just trying to trade at certain New York time window.

Re: Trading only certain times of day [Re: Mangal] #449193
03/07/15 13:31
03/07/15 13:31
Joined: Sep 2013
Posts: 64
Spain
yosoytrader Offline
Junior Member
yosoytrader  Offline
Junior Member

Joined: Sep 2013
Posts: 64
Spain
hour() returns an int, so EST has no sense here.
moreover in the second if statement, the instruction is missing: (f.i. x = 10)

if(hour()>=10 and hour(0)<=17)
X = 10;


Happy trading laugh
Re: Trading only certain times of day [Re: yosoytrader] #449230
03/09/15 12:37
03/09/15 12:37
Joined: Sep 2013
Posts: 73
M
Mangal Offline
Junior Member
Mangal  Offline
Junior Member
M

Joined: Sep 2013
Posts: 73
Thank you Yosoy.


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