Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Quad, M_D), 1,217 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Simulate trading shortly after market open with daily bars #484100
09/07/21 20:40
09/07/21 20:40
Joined: Aug 2021
Posts: 101
M
MegaTanker Offline OP
Member
MegaTanker  Offline OP
Member
M

Joined: Aug 2021
Posts: 101
Using daily bars, I want to simulate running a script somewhere shortly after the market open, so the open price is the last thing the script processes and then it enters/exits near this price as well (With much more slippage).

Fill = 3 lets me delay entries until the next price quote but if using this method the script would have to assume the next day's open is equal to the previous close but it trades stocks where gaps can be huge between the last close and the current open.

Is there any way to do this?

Last edited by MegaTanker; 09/07/21 20:42.
Re: Simulate trading shortly after market open with daily bars [Re: MegaTanker] #484116
09/09/21 16:28
09/09/21 16:28
Joined: Dec 2014
Posts: 206
Germany
Smon Offline
Member
Smon  Offline
Member

Joined: Dec 2014
Posts: 206
Germany
Maybe BarOffset could help you, but I think it changes the D1 bars completely. You could go to a lower bar period and use Timeframe

The most robust implementation I found is

Code
TimeFrame = frameSync(1440 / BarPeriod);

//do your D1 stuff here, like
//PricesD1 = series(priceOpen());

TimeFrame = 1;

//make your trades here

Re: Simulate trading shortly after market open with daily bars [Re: MegaTanker] #484123
09/10/21 16:07
09/10/21 16:07
Joined: Apr 2008
Posts: 586
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 586
Austria
The obvious way to do that is intraday bars but if you have only eod bars you can use Fill = 3 but get the price from priceOpen(-1). You also need the PEEK flag.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1