Determinisk
← Notes
Method · Note

5 reasons your P&L doesn't match your backtest

Before blaming the market, check whether the backtest and the live system were really doing the same thing. These five are the most common reasons they were not.

By Ross MallacePublished 19 Oct 20263 min read

When live results drift away from a backtest, the usual explanation is that the market changed. Sometimes it did. Often, though, the backtest and the live system were never doing quite the same thing in the first place. These are the five reasons I see most often.

1. The backtest traded on a price it could not have known. Many backtesting engines let a strategy look at a day’s closing price and then trade at that same close. A real order has to be sent before the close exists, so live trading decides on an earlier price and sometimes reaches a different decision.

2. The history changed underneath it. Data vendors revise past prices, and futures price histories are often recalculated each time one contract expires and the next takes over. Rerun the same backtest on revised history and you can get a different answer.

3. It used a stale copy of the data. Systems that keep a copy of price data to save time can serve yesterday’s prices to today’s calculation. The backtest and the live system then work from different numbers without anyone noticing.

4. The backtest assumed fills that never happened. Many backtests treat a limit order as filled the moment the price touches it. In the market, touching a price does not guarantee a fill, and a daily bar cannot show whether the limit or the stop was reached first. The backtest books trades that live trading never gets.

5. The arithmetic itself was not exact. Computers round most decimal numbers very slightly, so adding the same figures in a different order, or rounding a price to the nearest cent, can produce a slightly different answer. Small differences like these spread through sizing and capital allocation.

None of these is a market effect, and every one of them can be fixed. I cover these and other causes in detail, with the real cases behind each, in Why your backtest and live trading disagree, and why they shouldn’t.

Related

  • Method

    Why I'm publishing these

    What these notes are, who they are for, and what I hope comes back from writing them in public.

    Method · Note · 3 min