Systematic Trading Field Guide
10.2 · From backtest to live

Live vs backtest divergence: costs, data, or a dead edge?

~14 min read
Mechanism

Live-minus-backtest divergence has exactly three causes — execution costs you didn't model, data or implementation differences, and genuine alpha decay — and they have different signatures, different fixes, and wildly different detection speeds. The job is attribution before reaction: decompose the gap into those three lines with the reconciliation data you've been collecting, and only ever act on the line you've actually measured.

The idea

Nine months ago you went live. The backtest, over its full history, earned about 8% a year. The live book has annualised 3.2%. Every fibre of you wants to do something — retune the signal, cut the size, kill it, double it. This lesson is about the discipline that comes before any of that: working out where the missing 4.8 points actually went. Because the three possible destinations call for three opposite reactions, and acting on the wrong one is how live trading destroys strategies that were actually fine — and preserves ones that were actually dead.

Start by naming the suspects precisely.

Suspect one: costs. The backtest charged you what you assumed trading costs; the market charged you what it actually costs. Perold's original point about the paper-versus-reality gap (Perold 1988) is that the paper portfolio systematically flatters you — it fills instantly, at the price you observed, in any size, and never moves the market. If your realised cost per trade is 9 basis points where the backtest assumed 4, and you turn the book over thirty times a year, that alone is a point and a half of annual return. Cost divergence has a recognisable signature: it is steady, it scales with turnover, and it shows up trade by trade in the fill diff from lesson 10.1. It is also the most common suspect by far, and the best-documented — Novy-Marx and Velikov (Novy-Marx & Velikov 2016) showed that realistic costs kill or cripple most high-turnover anomalies on paper, before a live order was ever sent; going live merely performs the same subtraction on you personally.

Suspect two: data and implementation. The live system is trading a subtly different strategy from the one you backtested. Different bar boundaries, a dividend adjustment present in one data path and absent in the other, a universe that drifted, an FX conversion at a different timestamp — the whole taxonomy of silent breakage from lesson 10.1. The signature here is lumpiness: implementation gaps are usually zero for stretches and then concentrated in particular days, instruments or regimes (the big-FX-move days, the roll weeks, the month a symbol remapped). If your reconciliation harness is running, this suspect is the easiest to convict or acquit: a clean signal diff over the whole live period is close to an alibi.

Suspect three: the edge itself. The payer stopped paying, or too much capital crowded in, or the rule that generated your counterparty's flow changed (lesson 1.3's kill criterion; lesson 1.11's crowding markers). This is the suspect everyone reaches for first, because it is emotionally tidy — nothing to fix, nobody to blame, the market simply "changed". The statistics say you should reach for it last: alpha decay is the slowest signal to confirm from returns alone, because it is a change in a mean buried in noise. You can verify your implementation in days and measure your costs in weeks, but distinguishing "the edge halved" from "normal variance" takes years of returns (the maths below makes this brutal). So the correct procedure is elimination: measure suspects one and two, subtract them, and only interrogate suspect three about the residual.

There is a fourth pseudo-suspect worth naming so it can be dismissed properly: research drift. Six months of tinkering after deployment can leave the "backtest" you remember different from the backtest you deployed — a changed parameter here, a data revision there. If you cannot re-run the exact deployed configuration, you are comparing live results against a memory. The fix is version-pinning at deployment (lesson 1.10's discipline): the deployed strategy is a tagged commit with a frozen config hash, and "the backtest" forever means that artifact, re-run on data as it stands.

The maths

The decomposition is an accounting identity. Write the annualised live shortfall as

Δ  =  Rbt−Rlive  =  (Clive−Cbt)⏟cost gap  +  (Gbt−Gpaper)⏟implementation gap  +  (Gpaper−Glive)⏟residual\Delta \;=\; R_{\text{bt}} - R_{\text{live}} \;=\; \underbrace{(C_{\text{live}} - C_{\text{bt}})}_{\text{cost gap}} \;+\; \underbrace{(G_{\text{bt}} - G_{\text{paper}})}_{\text{implementation gap}} \;+\; \underbrace{(G_{\text{paper}} - G_{\text{live}})}_{\text{residual}}

where RR denotes net returns, CC realised or modelled annual cost drag, GG gross returns (before costs), GpaperG_{\text{paper}} the gross return of the shadow research run over the live period (same dates, same data, frictionless fills), and GliveG_{\text{live}} the gross return your live book actually achieved. The first term is measured directly from fill diffs (realised cost per trade × turnover, minus what the backtest charged). The second term is what the signal and position diffs from lesson 10.1 quantify — if reconciliation has been clean, it is near zero by construction. The third term is everything left over, and it contains two things mixed together: sampling noise, and any true change in gross alpha.

So the final question is always: is the residual bigger than noise? The residual is a difference of annualised means, and the standard error of an annualised mean return estimated over TT years with strategy volatility σ\sigma is

SE  =  σT\mathrm{SE} \;=\; \frac{\sigma}{\sqrt{T}}

— define the symbols concretely: σ\sigma is annualised volatility (say 12%), TT is years live (say 0.75). Then SE≈12%/0.75≈13.9%\mathrm{SE} \approx 12\% / \sqrt{0.75} \approx 13.9\%. Read that number again: after nine months, the one-sigma uncertainty band on your annualised live gross return is nearly fourteen points wide. A residual gap of two or three points is not evidence of anything; it is well inside the band where healthy strategies live. To resolve a genuine halving of an 8% gross edge — a 4-point shift — at two-sigma you would need T≈(2σ/δ)2=(2×12/4)2=36T \approx (2\sigma/\delta)^2 = (2 \times 12/4)^2 = 36 years of live data. The returns channel is, for practical purposes, deaf to alpha decay on the timescale you need to act. That is not counsel of despair; it is the argument (completed in lesson 10.4) for judging the edge on mechanism evidence — did the payer stop? — rather than on return evidence, and it is the reason the deflated-Sharpe caution of Bailey and López de Prado (Bailey & López de Prado 2014) applies to your live track record just as much as to your backtest: short live histories over-reward luck in both directions.

Note the asymmetry the two formulas create between the suspects. Costs are estimated per trade, and you make hundreds of trades in months — the cost gap resolves quickly and precisely. Implementation is checked per day against an oracle that cancels market noise — it resolves in weeks (lesson 10.1's detection arithmetic). Alpha resolves in decades. Spend your attention in that order.

Worked example

Worked example — decomposing a 4.8-point shortfall

The book from the opening: backtest 8.0% net annualised, live 3.2% over nine months, strategy vol 12%, turnover 30× a year. The quarterly attribution, line by line:

Line 1 — implementation. The signal diff has been zero on all but three days (a vendor restatement, caught and patched in week 7; impact measured at −0.4% over the period, annualised ≈ −0.5%). Position diffs within risk tolerance throughout. Implementation gap: ≈ 0.5 points, one-off, explained, fixed.

Line 2 — costs. The backtest charged 4bp per unit of turnover. The fill diffs say realised cost has averaged 9.2bp — spread widening on the roll days you trade, plus a fill-timing bias your model didn't capture. Gap per year: 30×(9.2−4) bp≈30 \times (9.2 - 4)\,\text{bp} \approx 1.6 points, steady, scaling with turnover, measured to a precision of a fraction of a point.

Line 3 — residual. 4.8−0.5−1.6=2.74.8 - 0.5 - 1.6 = 2.7 points of annualised gross shortfall, against a standard error of 12%/0.75≈13.912\%/\sqrt{0.75} \approx 13.9 points. The residual is a fifth of one sigma. As evidence of decay it is worth nothing.

LinePoints/yrSignature seenVerdict
Implementation0.5Lumpy: three specific daysFixed; monitor
Cost gap1.6Steady, turnover-scaledReal; model was wrong
Residual2.7Within 0.2σ of zeroNo information

Now the part that actually matters — what you do. You re-run the pinned backtest with the measured 9.2bp cost. Result: the strategy's whole-history net return drops from 8.0% to about 6.4%, and its Sharpe from 0.67 to around 0.53. Two conclusions follow. First: there is no evidence the edge died — a Sharpe-0.53 strategy having a 3.2% nine-month stretch is entirely ordinary (lesson 10.4 quantifies exactly how ordinary). Second: the strategy you actually own is the 6.4% one, not the 8% one — it was never the 8% one, the backtest just didn't know your costs yet. Your position sizing, drawdown expectations and kill thresholds (lesson 10.4) all need rebasing to the honest number. The divergence investigation's most common happy ending is exactly this: nothing is broken except the assumptions, and the fix is arithmetic, not surgery.

# quarterly_attribution.py — illustrative
period = live_days(since=go_live)
impl_gap  = (paper_gross(period) - live_gross_cleanroom(period))  # from recon
cost_gap  = (realised_cost_bps - modelled_cost_bps) * turnover
residual  = (bt_net_annualised - live_net_annualised) - impl_gap - cost_gap
se        = strat_vol / (len(period) / 252) ** 0.5
print(f"residual {residual:.1%} vs SE {se:.1%} "
      f"-> {'noise' if abs(residual) < 2 * se else 'investigate mechanism'}")

How you'd use it

Make attribution a scheduled ritual, not a crisis response:

  1. Quarterly, run the decomposition — implementation gap from the reconciliation archive, cost gap from the fill diffs, residual against its standard error. Write the three numbers in a divergence ledger. Doing it on a calendar, in calm quarters as well as bad ones, is what gives you a baseline and keeps the exercise honest (a ledger with only crisis entries is a record of your moods).
  2. Feed measured costs back into the pinned backtest after every quarter, and rebase expectations — return, Sharpe, drawdown quantiles, kill thresholds — to the re-costed run. This single feedback loop is worth more than any signal research you could do with the same hours.
  3. Pre-commit the escalation rule. Something like: a residual beyond two standard errors, or a mechanism event (the payer's rule changed — lesson 1.3's kill criterion), escalates to the lesson-10.4 protocol. Anything less is noted in the ledger and left alone. Deciding the threshold now, in writing, is what stops nine bad months from being retrofitted into a reason.
  4. When the cost gap is the story — usually — treat it as a sizing problem first. Re-cost the backtest, and ask whether the strategy still clears your hurdle at realised costs. If it doesn't, the honest conclusion is that it never did; killing it is not a loss, it's a correction (and cheaper turnover variants — wider bands per lesson 4.7 — are the constructive salvage path).

What goes wrong

Reaching for the flattering suspect. "The edge decayed" flatters your implementation; "it's just costs" flatters your alpha. Both let you skip the measurement. The failure is symmetric and the cure is the same: no verdict without the decomposition. If you notice yourself confident about the cause before line 3 of the ledger exists, that confidence is mood, not inference.

Re-optimising on the live period. After a divergence scare, the temptation is to retune parameters until the backtest matches the live stretch. You have now fit the strategy to nine months of noise — the exact overfitting sin of lesson 2.5, with the added irony that you conditioned on the one sample you most need to keep out-of-sample. Changes to a live strategy should come from the pre-registered research process (lesson 1.10), never from a divergence investigation. The investigation's outputs are measurements — costs, gaps — not parameters.

Comparing against a moving backtest. Without the version pin, every data revision and every parameter tweak quietly rewrites the benchmark, and the divergence ledger measures the distance between reality and an ever-improving fiction. Symptom: the backtest always looks a bit better than live, forever, by a slowly growing margin. If you see a shortfall that grows smoothly with time, suspect the benchmark before the market.

Forgetting the regime term. The backtest's 8% is a full-history average; your nine live months are one draw from one regime (lesson 2.7). If trend strategies broadly had a flat nine months, your flat nine months carry no strategy-specific information at all. Cheap fix: run the attribution's residual not against zero but against a peer proxy — the published performance of a comparable public index or fund style over the same window — before treating it as yours.

Statistical theatre in the other direction. The same arithmetic that says nine bad months prove nothing also says nine good months prove nothing. A live book beating its backtest is enjoying luck plus, occasionally, an unmodelled tailwind you should also attribute (a cost model too pessimistic, a data difference in your favour). Decompose the happy surprises too, or the first regime turn will hand back returns you had mentally banked as skill.

Further reading