Skip to content
Zerotoinvest
DEEN

Backtesting

Backtesting applies rules to past data. The test is only as good as the care taken to rule out the usual sources of error.

Learning objective: After this lesson, you can check a backtest result for typical sources of error instead of accepting it at face value.

1 min read Last checked: 2026-09-09

The idea sounds compelling: take your rules, run them over the last ten years, and see what would have come out. In practice, almost every backtest is too optimistic.

The common mistakes are always the same. You use data that didn't exist yet at the decision point. You test only with companies that still exist today, missing the ones that went bankrupt. You forget fees, spread, and taxes.

The subtlest mistake is your own head. You know the past. If your first test looks bad and you tweak the parameters until it looks good, you haven't tested anything, you've fitted it.

In practice: define the rules completely before you look at the data. Test on one period, and verify on a different one you haven't touched before. And estimate costs generously, not tightly.

Summary

  • Almost every backtest is too optimistic.
  • Fix the rules completely before looking at the data.
  • A test period loses its independence once you reuse it multiple times.

Did you get it?

What is survivorship bias in a backtest?

The dataset only contains stocks that still exist today; the failed ones are missing.

Why are fundamental data problematic?

Because they get corrected after the fact, so today's datasets don't match what was known at the time.

Why isn't a once-separated test period enough?

Because it loses its independence once reused repeatedly.

What others often ask about this

Why does my strategy work in the backtest but not live?

Usually it's fitted too closely to the old data. Add costs, spread and slippage that are missing from the test, and sometimes a mistake where the test uses information that wasn't available at the time.

How do I test more honestly?

Test on data you didn't look at while developing, include realistic costs and be suspicious of very smooth results.

Check your understanding

Sources and further reading

  • The widely cited paper on the probability of backtest overfitting, showing why standard statistical safeguards against overfitting are unreliable for trading strategies. View source ↗

Related

Where to go from here

Next lessonOverfitting