Backtesting without fooling yourself
How to test a trading idea on historical data honestly: costs, look-ahead and survivorship bias, overfitting, out-of-sample and walk-forward testing, and what crypto data adds. Lesson 5.4 of the BlockWest Market Analysis Course.
Key takeaways
- A backtest applies written rules to past data to estimate how they would have performed.
- Include realistic costs, slippage and, for crypto perps, funding.
- Watch for look-ahead bias, survivorship bias and overfitting; each makes results look better than reality.
- Keep data aside for out-of-sample tests, and prefer walk-forward testing to one big optimization.
BlockWest Market Analysis Course · Module 5: Statistics, system design and testing · Lesson 5.4
What a backtest can and cannot tell you
System testing is a full topic area in the professional curriculum because it is so easy to get wrong. A backtest can show whether rules had an edge historically, how often they won, how deep the drawdowns were and how sensitive they are to settings. It cannot guarantee the future, and a poorly built test can be worse than none because it creates false confidence.
The biases that flatter results
| Problem | What happens | Fix |
|---|---|---|
| Look-ahead bias | The test uses information not yet available, such as today’s close to trade at today’s open | Signal on bar close, execute on the next bar |
| Survivorship bias | Only assets that still exist are tested | Use point-in-time universes including delisted stocks and dead coins |
| Overfitting (curve-fitting) | Settings tuned to past noise | Few parameters, out-of-sample and walk-forward tests |
| Ignored costs | Fees, spreads, slippage and funding left out | Model them conservatively, especially for frequent trading |
| Data errors | Bad prints, missing bars, unadjusted splits | Clean and cross-check data |
A sound testing process
- Hypothesis first: write the rule and why it should work before looking at results.
- Split the data: build on an in-sample period; keep a later out-of-sample period untouched.
- Check robustness: results should hold across nearby settings (a 50-day rule should not collapse at 45 or 55) and across markets.
- Walk forward: optimize on a window, test on the next, roll forward and stitch the unseen results together.
- Paper trade, then trade small: compare live fills with the test before scaling up.
Crypto-specific issues
- Price histories differ by exchange; use a consistent venue or index.
- Many tokens have short histories that cover only one regime.
- Delisted and collapsed tokens must be included to avoid survivorship bias.
- Perpetual futures results must include funding and liquidation rules.
Worked example: an overfit result
Illustrative only. An analyst tests every moving-average pair from 5 to 200 days on one coin from 2020 to 2023 and finds a 17/63 crossover that returned 900%. On 2024 to 2025 data it loses money. Nearby pairs such as 15/60 and 20/65 had made far less even in-sample. The “best” setting was a spike in a noisy landscape, a classic overfit. A plain 50/200 rule with a stable profile in both periods is the more trustworthy choice.
Checklist: backtesting
- Signals on closed bars only.
- Point-in-time universe including failures.
- Conservative costs, slippage and funding.
- Out-of-sample and walk-forward results.
- Stable performance across nearby parameters.
Key terms
- Backtest: simulation of rules on past data
- Overfitting: fitting rules to noise in historical data
- Out-of-sample: data not used to design or tune the system
- Walk-forward: repeated optimize-then-test on rolling windows
Sources and further reading
Education only. Nothing in this course is investment advice or a recommendation to buy or sell any asset. Examples are illustrative.
Frequently asked questions
How much history do I need?
Enough to include different regimes: bull, bear and sideways markets, and at least several dozen trades, ideally hundreds. For crypto that usually means testing through at least one full boom and bust.
Why do backtests look better than live trading?
Because of underestimated costs and slippage, hidden biases such as look-ahead and survivorship, and overfitting to past noise. A rule of thumb is to expect live results to be noticeably worse.
What is walk-forward testing?
Optimizing parameters on one window of data, testing them on the next unseen window, then rolling forward and repeating. It mimics how the system would actually have been used.
This explainer is reviewed and updated as the rules and the market change. Last reviewed December 1, 2026. It is educational content and not financial, legal or tax advice.
Continue the course
Then