How to Backtest a Trading Strategy Properly
Backtest without fooling yourself: clean data, out-of-sample tests, walk-forward, and realistic costs so live results match the backtest.
Key Takeaways
- •Define rules before testing
- •Split in-sample vs out-of-sample; keep a final hold-out
- •Model costs & slippage or results will be fantasy
Clean rules
Specify entry, exit, filters, and sizing in writing—no peeking.
Data quality
Avoid survivorship bias: Include delisted names.
Adjust for dividends & splits.
Use enough history to include multiple regimes.
Validation
In-sample to build →
Out-of-sample to validate →
Walk-forward to mimic live adaptation.
Keep a small final hold-out you never touch.
Costs & slippage
Add commissions, spread/impact assumptions, and limit vs market order logic.
Metrics that matter
Return Metrics
- • CAGR
- • Max Drawdown
- • Sharpe/Sortino
Trade Metrics
- • Win rate
- • Expectancy
- • Profit Factor
- • R-multiples distribution
Pitfalls
- •Overfitting
- •Small sample sizes
- •Re-optimizing until perfect (then failing live)
The proper process
1. Write strategy rules clearly
2. Prepare clean, bias-free data
3. Test on in-sample data
4. Validate on out-of-sample
5. Add realistic costs
6. Final hold-out test
Test Your Strategy
Write your rules on one page, then run a paper-trade month to compare live vs backtest behavior.
Frequently Asked Questions
How long is enough?
Aim for 10+ years if possible for equities.
What is walk-forward?
Re-train on a rolling window, validate on the next segment.