Gamestudio Links
Zorro Links
Newest Posts
Lapsa's very own thread
by rki. 06/18/24 15:32
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Harry Potter), 688 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
squik, AemStones, LucasJoshua, Baklazhan, Hanky27
19060 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to buy tomorrow at open? #487534
06/01/23 19:58
06/01/23 19:58
Joined: Jun 2023
Posts: 3
F
frutza Offline OP
Guest
frutza  Offline OP
Guest
F

Joined: Jun 2023
Posts: 3
During backtesting, it seems that the enterLong() or enterShort() functions enter trades at the CLOSE of the next day (after a buy or sell signal was generated today by whatever strategy is used).
How can I enter a trade at the OPEN of the next day?

Thank you in advance! Any answer and/or example is highly appreciated, as I couldn't find anything in the manual or this forum.

Last edited by frutza; 06/01/23 20:00.
Re: How to buy tomorrow at open? [Re: frutza] #487536
06/02/23 03:19
06/02/23 03:19
Joined: Apr 2023
Posts: 23
V
vicknick Offline
Newbie
vicknick  Offline
Newbie
V

Joined: Apr 2023
Posts: 23
Maybe you could run tick() once at the end of each bar? This will trigger the function upon the next incoming price tick (which should be the open of the new bar).

Re: How to buy tomorrow at open? [Re: vicknick] #487551
06/04/23 21:06
06/04/23 21:06
Joined: Jun 2023
Posts: 3
F
frutza Offline OP
Guest
frutza  Offline OP
Guest
F

Joined: Jun 2023
Posts: 3
Sound interesting, although a bit complicated. Can you please provide a code example? Thank you, much appreciated!

Re: How to buy tomorrow at open? [Re: frutza] #487554
06/05/23 09:21
06/05/23 09:21
Joined: Jun 2023
Posts: 8
Denia
Mishiwaka Offline
Newbie
Mishiwaka  Offline
Newbie

Joined: Jun 2023
Posts: 8
Denia
Hard to say without seeing a code, but my suggestion will be to go to the lower timeframes and apply something like
if (hour(0)==0) cycle, but anyway if a signal would not be generated before the day opening that will be no deal.

Re: How to buy tomorrow at open? [Re: frutza] #487558
06/05/23 14:16
06/05/23 14:16
Joined: Jul 2000
Posts: 27,987
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,987
Frankfurt
You need normally no complex code. For simply entering at the next bar open, set Fill = 3.

https://zorro-project.com/manual/en/fill.htm

Re: How to buy tomorrow at open? [Re: jcl] #487566
06/06/23 02:26
06/06/23 02:26
Joined: Jun 2023
Posts: 3
F
frutza Offline OP
Guest
frutza  Offline OP
Guest
F

Joined: Jun 2023
Posts: 3
Thank you all for your replies. Interesting, and much appreciated!

JCL, thank you for coming to the rescue. Fill = 3 is EXACTLY what I was looking for. Does this work the same on any bars, or only on daily bars? I couldn't figure out the answer by reading the page you indicated. Thanks in advance!

Last edited by frutza; 06/06/23 02:27.

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1