Backtest Lab Docs
Advanced Execution Rules
Backtest Lab provides additional execution settings that control how trades are managed during a backtest.
These settings apply to the backtest as a whole, without requiring changes to the underlying trading strategy.
Intraday Square-Off Time
Intraday trades must be closed before the end of the trading session.
The Intraday Square-Off Time determines when Backtest Lab automatically closes any intraday positions that remain open.
By default, this time is set to 3:20 PM (15:20).
For example, if an intraday trade is still open at the configured square-off time, Backtest Lab automatically initiates its closure, even if the strategy has not generated an exit signal.
This setting applies to all intraday trades in the backtest.
Maximum Holding Period
The Maximum Holding Period setting limits how long trades are allowed to remain open.
If a trade remains open beyond the configured duration, Backtest Lab automatically closes it.
This works in the same way as the Maximum Holding Period risk management rule configured within an individual Trade Entry action.
The difference is its scope:
- Trade Entry Risk Management: Applies to trades opened by that particular entry action.
- Backtest Maximum Holding Period: Applies to all trades opened during the backtest.
This provides a convenient way to enforce a common holding-period limit across the entire strategy without configuring the same rule on every trade-entry state.
Learn more about Risk Management Rule Types.
Closing Open Trades at the End of a Backtest
A backtest may reach its configured end date while some trades are still open.
Backtest Lab allows you to choose whether these remaining trades should be automatically closed.
When Enabled
All trades that remain open at the end of the backtest are forcibly closed.
This ensures that the backtest results contain only closed trades, with their profits and losses realized.
When Disabled
Trades that remain open at the end of the backtest are left open.
Their profits or losses are reported as unrealized, based on the available market prices at the end of the testing period.
This distinction can affect how the resulting strategy performance is presented and interpreted.
For example, a strategy with profitable open positions may show substantial unrealized gains if those positions are not forcibly closed.
Slippage and Real-World Execution Effects
In live markets, an order may execute at a price different from the expected price because of factors such as liquidity, market impact, and order execution delays.
These effects are commonly represented in backtesting through slippage models.
Backtest Lab does not currently provide configurable slippage simulation.
Slippage and additional real-world execution effects are planned for future versions of the platform.