Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
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
1 registered members (TipmyPip), 17,605 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
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: 594
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 594
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