QTrader
Menu

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

  1. Find the candle where the entry condition first becomes true, then locate the entry marker and trade price.
  2. 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.
  3. 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.
  4. 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.

Open the working example

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.

The interactive workbench needs JavaScript. Reload this page if interactive controls could not load.