Gamestudio Links
Zorro Links
Newest Posts
Camera always moves upwards?
by NeoDumont. 11/17/25 09:56
Future of ZorroHFT
by TipmyPip. 11/16/25 13:52
COT Download with Quandl does not work
by Petra. 11/15/25 09:35
Training with the R bridge does not work
by Petra. 11/15/25 09:31
Zorro 2.70
by jcl. 11/15/25 08:43
brokerCommand PLOT_HLINE parameters
by M_D. 11/13/25 10:42
ZorroGPT
by TipmyPip. 11/10/25 11:04
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, Nymphodora, TipmyPip), 6,604 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
tritom, sheliepaley, Blueguy, blobplayintennis, someone2
19178 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,030
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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