TomorrowOpen
TomorrowOpen delays a ProBacktest or ProOrder order until the next trading day's open, as in BUY 1 CONTRACT AT MARKET TomorrowOpen for daily strategies.
Syntax
AT MARKET TomorrowOpenHow it works
By default a market order sent by a strategy executes at the next available price. Appending TomorrowOpen postpones the fill until the opening of the next trading day. The conditions are still evaluated on the current bar, only the execution moves to the next session's first price.
The modifier suits strategies built around daily closing data. A signal computed on the finished daily bar cannot realistically be filled at that same close, and filling somewhere inside the overnight session is not what an end-of-day model intends either. Executing at the official next-day open keeps the backtest honest and matches how such systems are traded manually.
TomorrowOpen differs from NextBarOpen in the unit of delay. NextBarOpen waits for the open of the next bar in the chart's timeframe, whatever that timeframe is. TomorrowOpen always waits for the open of the next trading day, even if several intraday bars occur in between. On a daily chart the two coincide.
Examples
Example 1, Entering a long at the next day's open (ProOrder)
// Signal: close above the 50-day average, evaluated at end of day
LongConditions = close > average[50](close)
IF NOT LongOnMarket AND LongConditions THEN
BUY 1 CONTRACT AT MARKET TomorrowOpen
ENDIFThe condition is checked on the completed daily bar, and when it holds, one contract is bought at the opening price of the following day. This mirrors the reference example for the instruction.
Example 2, Exiting at the next open instead of overnight (ProBacktest)
// Leave the trade at tomorrow's open once momentum fades
exitSignal = close < close[3]
IF LongOnMarket AND exitSignal THEN
SELL AT MARKET TomorrowOpen
ENDIFRather than dumping the position into the close or the overnight session, the exit is scheduled for the next day's opening auction, where daily strategies typically transact.
Example 3, Short entry on a weak daily close (ProOrder)
// Short setups detected on the daily close, filled at the next open
weakClose = close < lowest[10](low)[1]
IF NOT onmarket AND weakClose THEN
SELLSHORT 1 CONTRACT AT MARKET TomorrowOpen
SET STOP LOSS 40
ENDIFA close below the prior 10-day low triggers a short that opens at the next session's first price, with a 40-point protective stop attached.
Common errors and gotchas
- Market orders only. The modifier extends
AT MARKET. It does not combine with pendingSTOPorLIMITprice levels, those order forms carry their own trigger logic. - Wrong delay unit on intraday charts. On an intraday chart
TomorrowOpenwaits for the next day, not the next bar. Code that intends a one-bar delay needsNextBarOpeninstead. On daily charts the distinction disappears. - Signal can go stale overnight. Conditions are evaluated on the current close, but the fill happens after the overnight gap. A large adverse gap executes the order anyway, so gap risk must be handled by the position sizing or the stop, not by the entry condition.
- Scope errors. Because the keyword belongs to the order engine, indicators and screeners that mention
TomorrowOpenfail to compile. Signal logic can live in an indicator, but the order line must stay in the strategy code.
Related instructions
NextBarOpen, delays execution to the open of the next bar in the chart timeframe.BUY, opens or adds to a long position.SELLSHORT, opens or adds to a short position.SELL, closes a long position.EXITSHORT, closes a short position.MARKET, immediate execution at the current price.LONGONMARKET, true while a long position is open.DEFPARAM, strategy-level parameters such as CumulateOrders.
