Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
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
3 registered members (dBc, clonman, TipmyPip), 18,816 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
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,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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