Backtesting is testing a trading strategy against historical market data to see how it would have performed in the past. Instead of risking money to find out whether "buy the breakout above resistance" actually works, you apply the rules to old charts and measure the results: win rate, average profit, worst losing streak.
It's the closest thing trading has to a laboratory. No backtest guarantees future results — markets change — but a strategy that never worked historically is almost certainly not going to start working with your money on the line.
The two ways to backtest
1. Manual backtesting (replay)
You step through historical charts candle by candle — with the future hidden — and take your strategy's trades by hand, logging each one. This is how discretionary traders test setups like price action or support and resistance that depend on judgment, not just formulas.
- Best for: setups that need human judgment; building screen time and pattern recognition at the same time
- Tools: a bar replay tool like Replay Trader — free, in the browser
- Speed: 30–50 trades per evening
2. Automated backtesting
You write the rules as code (Python, Pine Script) and a computer tests them across years of data in seconds.
- Best for: purely mechanical rules ("buy when RSI < 30, sell when RSI > 50")
- Tools: TradingView strategies, Python libraries like backtesting.py
- Caveats: easy to overfit; coding skills required; can't test discretionary judgment
Most traders should start manual: it's faster to learn, tests what you'll actually do (you are the execution engine), and trains your eye in the process. Full comparison: manual backtesting guide.
Practice this on real historical charts
Replay real price action candle by candle and test your entries with a paper account. Free, in your browser, no sign-up.
Start replaying charts — freeWhat a backtest tells you
Track at least these numbers over a sample of 30+ trades:
| Metric | What it answers |
|---|---|
| Win rate | How often the strategy is right |
| Average win / average loss (R multiple) | Whether winners pay for losers |
| Expectancy | Average profit per trade — the number that matters |
| Max drawdown / losing streak | Whether you could psychologically survive trading it |
| Trade frequency | Whether it produces enough opportunities to matter |
A 40% win rate is excellent if winners are 3× the losers; a 70% win rate loses money if the occasional loss is huge. Expectancy — (win rate × avg win) − (loss rate × avg loss) — is the single number that decides.
The mistakes that invalidate a backtest
- Hindsight bias — scrolling a chart where you can see the future makes every strategy look brilliant. Use replay with the future hidden.
- Cherry-picking — testing only on charts where you already know the strategy shines. Use random starting points.
- Tiny samples — 5 trades prove nothing; aim for 30–50 minimum.
- Ignoring costs — fees and slippage turn marginal strategies negative, especially for scalping.
- Overfitting — tuning parameters until the past looks perfect usually breaks the future. Prefer simple rules.
FAQ
What does backtesting mean in simple terms?
Trying out a trading strategy on old price charts to see if it would have made money, before risking anything real.
Is backtesting free?
Manual backtesting is: Replay Trader's chart replay is free and unlimited, and works in the browser without an account. Automated backtesting is also free with open-source Python libraries, but requires programming.
How accurate is backtesting?
It accurately tells you how rules performed on past data — nothing more. Treat it as a filter: it can't promise a strategy will work, but it reliably exposes strategies that never worked. Combining a backtest with forward paper trading gives the most realistic picture — see backtesting vs. paper trading.
How many trades do I need in a backtest?
At least 30 for a rough signal, 50–100 for real confidence. On chart replay that's a few evenings of practice.
Put it into practice — risk-free
Reading about trading only gets you so far. Replay real historical charts candle by candle and paper trade your setups — free, in your browser.
Start replaying charts — free