Basic Prerequisites: 01 · From Zero.
1. Intuition & Practical Objective
An execution backtest lies for the same reason a weather forecast lies: it substitutes a convenient model for a hard process, and the substitution is systematically optimistic. This page names the five lies an execution backtest tells and shows, in first-principles terms, which direction each one biases the answer.
The five lies, in one line each:
- The fill illusion - a trade printed at my price, so I filled (wrong: you fill only when the outflow ahead of you passes ).
- The queue blind spot - I assume I am at the front of every queue (wrong: is often most of the level’s volume).
- Look-ahead in replay - I decide the fill using flow that arrives after I would have cancelled.
- The zero-cost instant - I act instantly and at the mid (wrong: latency and spread are real).
- The invisible impact - my order does not move the market (wrong: it does, and it is the cost that grows fastest with size).
The one-sentence essence. “Every execution-backtest bias is an unmodelled fill: the backtest fills more often, earlier, and at better prices than the process allows - and because fills are convex in the P&L, the errors compound.”
2. Mathematical Ground Truth & Derivations
The truth the naive rule replaces. Under price-time (FIFO) priority, your profit from a resting order of size at queue position is a function of the cumulative outflow ahead :
The naive rules are special, biased, cases:
| Backtest rule | Mathematical statement | Direction of bias |
|---|---|---|
| ”any print” | up (fills when too) | |
| “trades only, ignore queue” | up (drops ) | |
| ignore cancels ahead | down (understates ) | |
| look-ahead | instead of | up (uses the future) |
| fill at mid | instead of | up |
Fill probability. For Poisson trade arrivals at rate , the outflow by time is , so an order at the front () is filled by iff at least one trade arrives, and an order at position (in shares) satisfies (with the share-volume rate)
a Poisson upper-tail (equivalently, the waiting time is negative-binomial with mean ).
Slippage. Define slippage per share relative to the arrival (decision) price as
so that a fill at with no impact gives - the adverse post-fill drift that a naive test never charges. Averaged, (a cost).
Look-ahead. A replay that decides the fill at the end of the day, when a live order would have been cancelled at , computes instead of . Since is non-decreasing, the look-ahead probability is the causal one, with equality only when .
3. Computational Implementation - the five lies, quantified
A single simulated level (queue ahead 11,500 shares; my size 800) replayed under five fill rules. Stdlib only.
Read the table as the anatomy of the illusion: the optimistic rule fills every path (); the queue-blind rule also fills every path (my 800 shares are trivially covered by shares of flow); the correct FIFO rule fills only of paths and, when it does, only of the size on average. Feeding that into a simple edge model ($0.02 capture, $0.012 adverse selection per share) turns a naive $16.00 per order into a realistic $1.86 - the edge is overstated by before a single other bias is added.
4. Failure Modes & First-Principles Breakdowns (numbered)
- The fill illusion (optimistic fills). Replacing with makes the backtest fill on paths where you are still behind the queue. Measured: vs . Fix: always express a fill as a condition on relative to and .
- The queue blind spot. Dropping means the backtest cannot see the difference between “at the front” and “10,000 shares deep”; both fill at here. Fix: track per level, per venue, inclusive of the effect of your own repricing.
- Look-ahead in replay. Using end-of-window flow to decide a fill made at the cancel time. Fix: replay must be causal - only events with timestamp decision time may affect the fill.
- The zero-cost instant. Assuming fills at the mid and zero latency deletes the spread () and the pick-off term . Fix: charge half-spread per leg, model latency explicitly (Low-Latency Systems Architecture).
- The invisible impact. Assuming drops , the impact term you caused. Fix: calibrate an impact model (Almgren 2005) and charge it as a function of size and participation.
- Compounding. These biases are not additive noise - they multiply. A fill-rate overstatement of combined with a zero-cost assumption of can turn a flat strategy into a “Sharpe 2” backtest. This is the bridge to Backtesting Hygiene: overfitting and execution bias are two independent inflation engines, and they stack.
5. References
- Hasbrouck, Joel - Empirical Market Microstructure (2007)
- Cont, Rama; Kukanov, Arseniy - “Optimal order placement in limit order markets,” Quantitative Finance 17(4) (2017)
- Gould et al. - “Limit order books,” Quantitative Finance 13(11) (2013)
- López de Prado, Marcos - Advances in Financial Machine Learning (2018)
- Perold, A. F. - “The implementation shortfall” (1988)
6. Connected Graph Bridges
- Back: 01 · From Zero · Index Hub
- Forward: 03 · The Fill Model
- Depth: Queue Position & Fill Probability · Backtesting Hygiene