NewsletterStudioAdvertise
PREMIEUR
Subscribe
PREMIEUR
News
Deals
Funds
Allocators
Learn
Loading
© 2026 Premieur Group Holdings All rights reserved.
AboutSubscribeSupportPrivacyTerms
Learn / Quants and programming / Backtesting without fooling yourself

Backtesting without fooling yourself

Premieur Institute · Read time: 16 minutes

The biases that make backtests look better than live results, from look ahead and survivorship to costs and multiple testing, and the discipline that keeps a simulation honest.

Contents

Look ahead bias and point in time dataSurvivorship biasTransaction costs and slippageOverfitting, multiple testing and the deflated SharpeOut of sample and walk forward testing

A backtest is a simulation: apply a trading rule to historical data and record what it would have earned. It is the cheapest way to test an idea and the easiest way to be misled. Almost every error in a backtest pushes the result in the same direction, upward, because the researcher keeps tweaking until the result looks good and stops there. The live track record that follows is usually worse.

For an allocator, the question is rarely how to run a backtest; it is how to read one in a pitch book. A simulated Sharpe ratio of 2 tells you little until you know whether the data was point in time, whether delisted stocks were included, what trading costs were assumed and how many variants were tried before this one was shown. This topic covers each failure in turn and closes on the practices that make a backtest credible.

Key takeaways

  • Look ahead bias uses information that was not available at the moment of the simulated trade, and even a one day slip can turn a mediocre rule into a spectacular one.
  • Survivorship bias comes from testing only on securities or funds that still exist today, which removes the failures and inflates returns.
  • Trading costs scale with turnover: annual drag is roughly turnover times cost per dollar traded, and a high turnover strategy can lose most of its gross Sharpe to costs.
  • Trying many variants and reporting the best inflates the Sharpe ratio; the deflated Sharpe ratio asks whether the best result beats what the best of that many random strategies would show.
  • Out of sample and walk forward testing, with the out of sample data used only once, is the main defence against overfitting.

Look ahead bias and point in time data

Look ahead bias is using information in a simulated decision that would not have been known at the time. The crude version is a coding error: computing a signal from today's closing price and then earning today's return on it. The subtle versions live in the data. Company fundamentals are a common trap. A quarter ending 31 March is typically reported weeks later, and databases often store the figures against the period end date. A backtest that joins on period end will trade on earnings before they were published.

Restatements make it worse. When a company revises past figures, many databases overwrite the original. A backtest run today then sees the corrected number, which no investor could have traded on at the time. The cure is point in time data: every value stored with the date it became known, and every revision stored as a new row rather than an overwrite. Index membership, credit ratings, analyst estimates and economic data (which is heavily revised) all need the same treatment.

A useful habit is to write every signal as a function of what was known at the decision time and to lag positions explicitly: the signal computed at the close of day t sets the position held from day t plus 1. If a rule's performance collapses when it is lagged one extra day, it was probably depending on information it should not have had, or on execution it could not have achieved.

Where look ahead hides
DataHow it leaksPoint in time fix
PricesSignal and return computed from the same closeShift positions one bar after the signal
FundamentalsJoined on fiscal period end, not filing dateJoin on the date the figure was published
RestatementsRevised figures overwrite originalsKeep every version with its own as of date
Index membershipToday's constituents used for past datesUse historical constituent lists
Macro dataFinal revised GDP or payrolls usedUse the first release (vintage data)

Survivorship bias

Survivorship bias arises when the test universe includes only securities, funds or managers that survived to the present. Companies that went bankrupt, were delisted or were acquired at depressed prices disappear from many free datasets. A stock strategy tested on today's index members is effectively told in advance which companies would not fail. Strategies that buy cheap or distressed stocks are especially flattered, because their failures are exactly the ones that vanish.

Fund databases have the same problem in a different form. Hedge funds and private funds report voluntarily, and funds that do badly tend to stop reporting or close. A peer group average computed only from funds still reporting overstates what an investor in the category actually earned. Backfill bias compounds it: a fund that joins a database often adds its earlier, successful history, while funds whose early history was poor never join.

Worked example

How much survivorship flatters a peer group

  • A hypothetical category of 100 funds over five years.
  • 80 funds survive and average 8.0% a year. 20 funds closed during the period and averaged -5.0% a year while they existed.
  1. 1. Average of survivors only
    as reported by the database
    8.0%
  2. 2. Average including closed funds
    0.80 x 8.0 + 0.20 x (-5.0) = 6.4 - 1.0 = 5.4
    5.4%
  3. 3. Bias
    8.0 - 5.4 = 2.6
    2.6 points a year

The survivor-only average overstates the category by 2.6 percentage points a year. Any manager compared against it looks worse than reality, and any strategy backtested on survivors looks better.

The rule

Ask for the dead

When reviewing a backtest or a peer comparison, ask whether delisted securities and closed funds are included, how delisting returns were treated (a stock that delists for cause often has a large final loss that free data omits), and whether any history was backfilled.

Transaction costs and slippage

Every trade costs something: commissions, half the bid-ask spread, market impact (the price moving against you because you are trading), and for short positions the cost of borrowing stock. Together these are often expressed in basis points per dollar traded. For liquid large cap US stocks traded in moderate size, all-in costs of a few basis points are realistic; for small caps, emerging markets or large orders relative to daily volume, tens of basis points or more.

Slippage is the gap between the price the backtest assumed and the price achievable. Backtests that trade at the same close that generated the signal, or at the day's open after an overnight signal without any impact, assume execution no one gets. Impact grows with order size, roughly with the square root of the order as a fraction of daily volume in most empirical models, so a strategy that works with $10m may not work with $1bn. That is capacity, and it belongs in every serious backtest.

Turnover is what turns small costs into large ones. Annual turnover here means the total dollar value traded in a year divided by capital. A monthly rebalanced factor portfolio might trade 2 to 5 times its capital a year; a daily rebalanced short-term strategy can trade 50 times or more. The annual cost drag is approximately turnover multiplied by cost per dollar traded.

Annual cost drag and net Sharpe
drag = annual turnover x cost per dollar traded; net Sharpe = (gross return - drag) / volatility
annual turnover
Total value traded in a year (buys plus sells) divided by capital
cost per dollar traded
All-in cost per trade: commission, half spread, impact, as a fraction of the amount traded
volatility
Annualised volatility of the strategy, assumed unchanged by costs
Returns here are in excess of the risk-free rate. Costs barely change volatility, so they come almost entirely out of the numerator.
Worked example

How turnover erodes a gross Sharpe of 1.5

  • A hypothetical daily rebalanced equity strategy with a gross Sharpe of 1.5 and annualised volatility of 8%.
  • It trades 25% of capital each day, over 252 trading days. All-in cost is 5 bps (0.05%) per dollar traded.
  1. 1. Gross excess return
    1.5 x 8% = 12.0%
    12.0%
  2. 2. Annual turnover
    0.25 x 252 = 63
    63x capital
  3. 3. Annual cost drag
    63 x 0.05% = 3.15%
    3.15%
  4. 4. Net excess return
    12.0 - 3.15 = 8.85%
    8.85%
  5. 5. Net Sharpe
    8.85 / 8 = 1.106
    1.11
  6. 6. Break-even cost
    12.0% / 63 = 0.190%
    19.0 bps per dollar traded

At 5 bps the strategy keeps a Sharpe of about 1.1. If true costs are nearer 19 bps, for example because the size is larger or the stocks less liquid, every point of gross return goes to the market and the net Sharpe is zero.

A strategy with 8% gross excess return and 10% volatility (gross Sharpe 0.80) at 10 bps per dollar traded
Annual turnoverCost dragNet excess returnNet Sharpe
2x0.20%7.80%0.78
5x0.50%7.50%0.75
10x1.00%7.00%0.70
20x2.00%6.00%0.60
40x4.00%4.00%0.40

Overfitting, multiple testing and the deflated Sharpe

Overfitting is fitting a model to the noise in a sample rather than to a pattern that will persist. Every parameter adds freedom: the lookback window, the threshold, the rebalance day, the universe filter, the stop loss. With enough choices, almost any dataset yields a rule with an impressive historical Sharpe. The rule then fails out of sample because the pattern it found was never there.

Multiple testing is the statistical side of the same problem. If a researcher tests 100 variants of a strategy that has no true edge, some will look good by chance, and reporting the best one is selecting on luck. The estimated Sharpe ratio of a strategy has a standard error of roughly one divided by the square root of the number of years, for Sharpe ratios near zero and normally distributed returns. Over ten years that is about 0.32. The best of many such noisy estimates will be well above zero even when every true Sharpe is zero.

David Bailey and Marcos Lopez de Prado formalised the correction as the deflated Sharpe ratio. The idea: estimate how high the best Sharpe would be among N independent trials with no skill, given the sample length and the shape of returns, and ask whether the observed Sharpe clears that bar with confidence. The full statistic also adjusts for skewness and fat tails. The practical lesson is simpler: a backtest result means little without the number of variants tried to find it, and researchers should record every trial, not just the winners.

Expected best Sharpe among N skill-free trials (approximation)
E[max SR] = SE x [ (1 - g) x Z(1 - 1/N) + g x Z(1 - 1/(N x e)) ], with SE = 1 / sqrt(T)
SE
Standard error of an annualised Sharpe estimate near zero, for T years of data
N
Number of independent strategy variants tried
Z(p)
The inverse of the standard normal cumulative distribution at probability p
g
The Euler-Mascheroni constant, about 0.5772
e
The base of natural logarithms, about 2.718
This is the benchmark used inside the deflated Sharpe ratio. It assumes normal returns and independent trials; correlated variants count as fewer effective trials.
Expected best annualised Sharpe from N strategies with zero true skill, 10 years of data (SE 0.316)
Variants tried (N)Expected best Sharpe
10.00
100.50
500.72
1000.80
1,0001.03
With five years of data (SE 0.447), the best of 100 skill-free variants is expected to show a Sharpe of about 1.13.
Where this goes wrong

The backtest that was the hundredth attempt

A simulated Sharpe of 0.8 over ten years sounds respectable. If it was the best of 100 variants, it is exactly what pure noise would be expected to produce. The pitch book will not say how many variants were tried, so ask.

Warning signs of an overfit backtest: many parameters for a short history, a sharp performance drop when any parameter is moved slightly, results concentrated in a few periods, and a story for the edge that was written after the result.

Out of sample and walk forward testing

The basic defence is to keep data the model never saw. Split the history: develop and tune on the earlier part (in sample), then test once on the later part (out of sample). The rule is once. If the out of sample result disappoints and the researcher goes back to tune again, the out of sample period has become in sample, and its protective value is gone.

Walk forward testing repeats the split through time. Fit the parameters on a training window, trade the next period with those fixed parameters, then roll both windows forward and repeat. Stitching together only the traded periods gives a track record in which every decision was made with data available at the time, which is closer to how a live strategy behaves. It also shows whether the chosen parameters are stable or jump around from window to window, which is itself a warning sign.

The final test is time. A paper trading or small capital live period, with real execution, catches what simulations cannot: data delivered late, orders that do not fill, borrow that is not available. Allocators weigh live track records far above backtests for this reason, and the gap between a manager's backtest and their live returns is one of the most informative numbers in due diligence.

A walk forward schedule with a five year training window and one year test windows
StepTrain onTrade (out of sample)
12010 to 20142015
22011 to 20152016
32012 to 20162017
42013 to 20172018
52014 to 20182019
The reported track record is 2015 to 2019, stitched from the five trade windows. An expanding window (always starting in 2010) is a common alternative.
The rule

A checklist for reading any backtest

Is the data point in time and survivorship free? Are positions lagged after signals? What costs and slippage are assumed, and at what capital? How many variants were tried? Which period was out of sample, and was it used only once? How does the live record compare with the simulation over the same dates?

Templates for this lesson

Included with a Premieur membership.

  • NotebookBacktest notebookA moving average crossover end to end: lagged position, trading costs, Sharpe, maximum drawdown and the look ahead comparison.Download
Go deeper with Membership →