Backtest order fills
Understand next-bar fills, close processing, price orders and same-candle stop and target assumptions.
Before you start
A signal time is not necessarily a fill time. The engine normally evaluates a closed candle and fills a queued market order at the next candle's open. Historical OHLC candles describe a range, not every tick or a live order book. Backtest rules and protective exits describe the available assumptions.
Follow the workflow
- Find the candle where the entry condition first becomes true, then locate the entry marker and trade price.
- For a normal market order on bar i, inspect the open of bar i+1. A signal appearing only on the final available bar can remain pending.
- If using supported close processing, inspect the signal bar's close. Final-bar signals still remain pending; close processing is not permission to invent another tradable bar.
- For a stop or limit, inspect the opening gap and the remaining assumed path after the entry. If both a stop and target fall inside one candle, record the path assumption.
Worked example
If a condition is true on a candle closing at 10 and the next candle opens at 12, the ordinary queued entry uses that next open before applicable costs. A backtest using the signal close instead answers a different question. Open the SMA example and inspect one crossing and its following entry marker, then compare the trade list with the chart.
Limits and interpretation
For same-candle protection the assumed path visits the nearer extreme first: open → high → low when high−open ≤ open−low, otherwise open → low → high. Protection after a price entry sees the remaining path. A gap can fill at the open rather than the order level. Settings-based protection and exits based on a newly updated average position price can become active at different times. None of these rules proves a real exchange fill.