August 22, 2026 · research

Why Your Backtest’s Open Orders Need a Clock

Why Your Backtest’s Open Orders Need a Clock

A strategy submits a limit order at 10:00. Its signal changes at 10:03. The backtest quietly replaces the order at 10:04, then counts a fill at 10:05. In paper trading, the original order may still be resting at the venue. If it fills while the replacement is also working, the strategy has two orders and one position model pretending there was only one.

Open orders need their own state and clock. A backtest should know when each order was submitted, when it could be canceled, whether the cancellation reached the venue, and what happens if a fill races with that cancellation. Three shortcuts regularly erase those facts.

Mistake 1: Treating a new signal as an instant cancel

Many backtests recalculate the target position every bar, then overwrite the resting order with whatever the latest signal wants. That makes the order disappear at the exact moment the strategy changes its mind. Real venues don't work that way. A cancel request takes time, and an order may execute before the venue processes it.

Consider a buy limit for 100 shares at $50.00. At 10:03 the signal weakens, so the strategy sends a cancel. At 10:03:00.080 the order gets 60 shares filled; the cancel is acknowledged at 10:03:00.110. The remaining 40 shares are canceled, but the position now includes 60 shares. A bar-based backtest that deletes the order at 10:03 may report zero. One that assumes immediate cancellation and still records a later fill has invented exposure in the opposite direction.

Track the order lifecycle explicitly: submitted, acknowledged, partially filled, cancel pending, canceled, or fully filled. Keep fills that happen before cancellation is confirmed. For a coarse bar simulation, choose and disclose a conservative ordering rule when both events could fit inside the bar.

Mistake 2: Giving a resting order an infinite shelf life

A limit order priced from a signal at 10:00 can become stale even if the signal has no explicit exit rule. The book moves, volatility changes, and the market's value of the instrument can drift. Yet a simulator that leaves the order active until it fills may eventually get a fill months later and credit it to a thesis that no longer exists.

Set an order time-in-force policy that matches the strategy. A one-minute signal might use a 30-second expiry; a daily rebalance might keep an order alive until the close. Those are strategy choices, not universal defaults. If the strategy reprices every bar, model the cancel and replacement sequence rather than magically teleporting the order to its new price.

Order policyTypical useBacktest question
Immediate or cancelTake available liquidity, then stopWhat portion could fill at submission?
Short expiryFast signal with a brief execution windowWas the order still valid when price returned?
Until session endSlow rebalance or close auction intentDoes the venue actually support that lifetime?

Mistake 3: Counting every touch as a fill

If a candle's low reaches a buy limit, the order did not necessarily fill. There may have been a queue ahead of it, little traded volume at that price, or a brief print that occurred before the order arrived. A stale order model often combines all three errors: it keeps the order alive too long, assumes it was first in line, then awards a full fill on a price touch.

At minimum, prevent fills before the order's arrival time and cap simulated quantity by plausible traded volume at the limit. For strategies where queue position matters, use trade and order-book data or a deliberately conservative queue model. A touch-based fill can still be useful for rough screening, but label it as an optimistic approximation and compare it with a harsher assumption.

One practical audit: log every order's creation time, active window, cancel request and acknowledgment, fill time, filled quantity, and remaining quantity. Then replay a few trades around signal reversals. If you can't explain why each order was still live when it filled, the backtest's fill count needs work.

Model the order you mean to paper-trade

Order state connects the strategy's intent to its actual exposure. The position should change on fills, not on signal targets or cancel requests. Replacements should leave an auditable trail, and partial fills should survive into the next decision. This makes the backtest more cumbersome, but it also makes the paper-trading comparison meaningful: both systems can disagree about execution for identifiable reasons.

When an order model is uncertain, preserve that uncertainty in the result. Run short-lived and long-lived orders, vary cancel delay, and show how much performance depends on optimistic queue assumptions. The strategy may be fine. Its apparent edge may also be the interest earned by an order that the real system would have canceled hours ago.

order managementbacktestingexecutionpaper trading
← All posts