Skip to content

When orders fill

A live order records the time it was sent and the price the exchange filled. Backtests and paper trading use the candle rules below, so their results can differ. The rules apply to entries and exits. A candle is one chart bar. A slot is that stretch of time, traded or not.

Backtest and paper trading

  • On candle close: an order decided at a candle's close fills in the next candle's slot. A market order fills at that candle's open.
  • If the next slot has no candle, a market order still fills there: at the slot's start, at the decision candle's close plus your slippage (fees as usual). It does not wait for the next candle with trades. The backtest and paper trading fill the same way.
  • A limit order never fills in an empty slot. It stays open for the candle after that. It fills if price reaches your limit; otherwise it expires, including when that candle has no trades either.
  • An empty-slot fill happens only if the bot was running at the decision candle's close (it checked prices within 2 minutes after the close). If it was stopped, paused, or offline, that close is skipped. The log says "Missed a candle close while not running", and nothing fills in the past.
  • If an exit decided at the close and a time stop are both due before an empty slot, the exit fills in the empty slot first. A time stop on its own fills at the next candle that has trades. See Session-end exit.
  • Rarely, the exchange reports trades for a slot after the bot already filled it as empty. This is most likely on 1-minute candles. The fill is not changed. The log says "Late candle after empty-slot fill". A later backtest on the corrected candles can differ from paper trading for that order.

Live trading

Live results follow the exchange fill, not the next-candle price the backtest and paper trading use.