Basic Prerequisites: Market Microstructure & Order Types.
1. Intuition & Practical Objective
This page builds the why of execution backtesting with no prior knowledge needed. The objective is one idea: a trade price and a fill are not the same thing. A signal backtest treats the price series as something you can transact at on demand. An execution backtest cannot - because the price series is the output of a matching process, and whether you get to participate in that process is a separate, harder question.
Start with the dumbest question: why can’t I just test my execution algorithm by backtesting on prices? Because “buy 10,000 shares at 10:00” is not an instruction a price series can honour. To turn it into a fact you must answer three things the price series never asked:
- Did I fill at all? A market order fills (minus size you walk through), but a limit order only fills if the queue ahead of you is consumed. Book that as a coin that may come up “no.”
- At what price relative to the decision price? You buy at the ask, not the mid - you pay the half-spread on entering and again on exiting.
- Did the market move because of me, or against me? Your own order has impact, and your passive fills are adversely selected.
Three “aha”s:
- The mid is a theory; the trade is a price. The Roll model (Hasbrouck Ch 3) writes the trade price as : the efficient price plus a bounce at half the spread. A backtest that fills at has silently deleted per share on every trade.
- A fill is a queue event, not a price event. “The market printed at my price” “I filled.” You fill when the cumulative outflow ahead of you passes your position: . Ignoring is the single largest source of fake edge.
- Execution cost is a separate return stream. Perold’s implementation shortfall decomposes realised vs paper P&L into an execution cost (how badly you paid) and an opportunity cost (what you failed to execute). A signal backtest sets the first to zero and the second to zero by assumption.
The one-sentence essence. “A signal backtest tells you whether the idea was right; an execution backtest tells you whether the idea survives contact with the order book - and these two answers can have opposite signs for the same alpha.”
2. Mathematical Ground Truth & Derivations
The two experiments, side by side. Suppose a signal earns an expected favourable move over a holding horizon of ticks, and the mid moves of noise. Then
- Signal backtest P&L per trade (fill at mid, both legs, full size):
- Execution backtest P&L per trade (you cross the spread in and out, and pay impact per leg): where is the quoted spread and the per-leg temporary impact.
The Sharpe ratios are the same denominator ; the cost terms subtract expected value only. So
and the whole game is the sign and size of relative to .
Perold’s implementation shortfall (Hasbrouck Ch 14, eq 14.1) is the accounting identity that makes the omission precise. With =initial position, =desired position, =final position, decision/arrival price , terminal price :
A signal backtest that assumes you always trade the full size at forces both terms to zero. An execution backtest must simulate (the realised fill price, from the book) and (the realised filled quantity, from the queue).
Effective vs realized cost (Hasbrouck Ch 14, eq 14.2) splits what you paid into spread and impact:
A backtest that records only still misses the impact term - the part of the move that is yours.
3. Computational Implementation - the same alpha, two verdicts
One alpha, evaluated two ways. The signal backtest fills at the mid; the execution backtest pays the spread on both legs plus impact. Stdlib only.
The signal backtest is identical in all three rows (): it never sees cost. The execution backtest takes the same alpha to in a tight market, to (a loser) in a wide market, and back to where costs are tiny. The alpha did not change; the verdict did. This is why “backtested Sharpe” is meaningless without the fill and cost model underneath it.
4. Failure Modes & First-Principles Breakdowns
- Filling at the mid (deleting the spread). The Roll model says the trade price is . A mid-fill backtest earns a half-spread it can never collect; on a strategy that trades often, this is a pure fiction with an unbounded cumulative cost.
- Assuming full size fills. A signal backtest assumes in Perold’s identity. Real limit orders are censored: only a minority of submitted limit orders ever execute (Hasbrouck Ch 15 reports roughly in the Hasbrouck–Saar data). Unfilled size is the opportunity cost term, invisible to the naive test.
- Ignoring your own impact. Treating drops the term; for any size beyond a rounding lot the omitted cost is linear in the metaorder and can exceed the alpha entirely.
- Benchmark confusion. VWAP, arrival price, and close are different benchmarks; a strategy can look great vs VWAP and terrible vs arrival (Hasbrouck Ch 14). The “execution backtest” number is only as good as the benchmark it is measured against.
- One-way thinking. Costs are subtracted on both legs and on every reprice. A backtest that charges entry only, or only charges when the trade is a taker, will systematically flatter the strategy.
5. References
- Perold, André F. - “The implementation shortfall: paper vs. reality,” Journal of Portfolio Management 14(3), 4–9 (1988). The origin of every execution benchmark; the execution/opportunity-cost decomposition.
- Hasbrouck, Joel - Empirical Market Microstructure (2007)
- Almgren, Robert; Chriss, Neil - “Optimal execution of portfolio transactions,” Journal of Risk 3(2) (2000)
- Harris, Larry - Trading and Exchanges (2003)
6. Connected Graph Bridges
- Base: Market Microstructure & Order Types · Backtesting Hygiene (the signal-backtest half)
- Continue: 02 · Why Execution Backtests Lie · Index Hub
- Cost model to calibrate: Optimal Execution & Almgren–Chriss · Market Impact & Depth