How to backtest a trading strategy without fooling yourself
A practical backtesting process: define rules, gather a sample, measure expectancy and drawdown, and avoid the curve-fitting traps that make bad strategies look great.
Backtesting means applying your trading rules to historical data to estimate whether they have an edge. Done properly it saves you months and a lot of money. Done carelessly it manufactures false confidence, which is more expensive than no confidence at all.
Step 1 — Write rules a stranger could follow
If your rules contain the words 'strong', 'clean', or 'obvious', they are not rules. Every condition must be checkable without judgement. A usable specification covers:
- Market and timeframe — one instrument, one timeframe, for the first pass.
- Entry trigger — the exact condition and the exact bar on which you act.
- Stop placement — a mechanical rule such as 'below the prior swing low' or '1.5× ATR(14)'.
- Exit — a target rule, a trailing rule, or a time-based exit.
- Filters — session hours, minimum volatility, news blackout windows.
- Sizing — fixed fractional risk, typically 1%.
Step 2 — Choose a sample you did not cherry-pick
You need enough trades for the result to be meaningful — 100 is a reasonable floor, 200 is better — and the sample must cover different regimes. A trend-following strategy tested only on 2020-2021 crypto looks like genius. Include a trending period, a ranging period, and at least one high-volatility shock.
Reserve a block of data you do not look at. Develop on the first 70%, then test once on the remaining 30%. That out-of-sample test is the only honest read you will get.
Step 3 — Run the test bar by bar
Manual backtesting with bar replay is slower than a script and far more instructive, because you experience the ambiguity in real time. Automated backtests silently assume you would have taken every signal calmly; replay shows you that you would not.
The rule that makes replay honest: never scroll forward before deciding. The moment you see the next candle, the test is contaminated.
Step 4 — Measure the right things
| Metric | What it tells you | Rough benchmark |
|---|---|---|
| Expectancy (R) | Average profit per trade in risk units | > +0.15R after costs |
| Win rate | Only meaningful alongside average R | Context-dependent |
| Profit factor | Gross wins ÷ gross losses | > 1.3 over 100+ trades |
| Max drawdown | Worst peak-to-trough decline | Under what you can emotionally tolerate |
| Longest losing streak | How bad a normal bad run feels | Expect roughly double what you assume |
Maximum drawdown and longest losing streak matter more than total return. A strategy returning 60% a year with a 45% drawdown will be abandoned by almost everyone at the bottom of that drawdown — which converts a winning system into a realised loss.
Step 5 — Subtract real costs
Apply spread, commission, slippage, and swap to every trade before you judge anything. Short-term strategies are hit hardest: a 1.5-pip cost on a 10-pip average win removes 15% of gross profit. Many strategies that look good gross are negative net, and this is where you find out.
The three ways backtests lie
- 1Curve fitting. You tune parameters until the equity curve looks beautiful on the sample you tuned it on. A robust strategy performs acceptably across a range of parameter values; if it only works at exactly 14 and collapses at 13 or 15, you fitted noise.
- 2Look-ahead bias. Using information not available at decision time — an indicator that repaints, or a daily high you would not have known intrabar.
- 3Survivorship and selection bias. Testing only the pairs or periods you already know trended well.
A backtest tells you whether the rules had an edge. Forward testing tells you whether you can follow them. You need both, in that order.
Step 6 — Forward test before you fund
Take the validated rules into a live-feed paper account for 20 to 40 trades. You are no longer testing the strategy — you are testing yourself against it. Track rule adherence explicitly. A strategy with a 0.3R backtested expectancy and a 60% adherence rate is, in practice, a losing strategy.
Backtest with bar replay, forward test on live prices, and review expectancy — all inside fradeX. Create a free account.
Frequently asked questions
- How many trades does a backtest need?
- At least 100, and ideally 200 or more spanning trending, ranging, and high-volatility conditions. Smaller samples cannot separate edge from luck.
- What is curve fitting in backtesting?
- Tuning parameters until they fit historical noise. The tell is fragility: performance collapses when you nudge a parameter slightly or test a different period.
- Is manual backtesting better than automated?
- They answer different questions. Automated testing covers large samples quickly; manual bar replay trains judgement and exposes decisions you would actually hesitate on.