- Joined
- 28 May 2020
- Posts
- 127
- Reactions
- 229
I've only skimmed your logic, so if this comment is incorrect just ignore it...All trades are taken at the close of the market – difficult to achieve without good tools – ie automation.
But, if your system has backtested market on close (MOC) orders, and if you can pre-calculate what the price action must be to enter the trade on MOC orders, and your broker is Interactive Brokers (perhaps others?), and your exchange is US, then investigate IB's Market on Close order type.
Market-on-Close (MOC) Orders | Interactive Brokers LLC
A Market-on-Close order is a market order submitted to execute as close to the closing price as possible
www.interactivebrokers.com
Make sure you click on "View Supported Exchanges". MOC orders are not supported on the ASX .
You could try to simulate a MOC order by setting the Good After Time order property on the ASX, but it gets tricky in determining the date portion of the GAT property: are you running your code before midnight for tomorrow's orders, after midnight for tomorrow's (actually today's) orders, is tomorrow a weekend or holiday, etc, etc.