Backtesting · 8 min read

How to Backtest a Trading Strategy (Step-by-Step)

Backtesting means testing a trading strategy against historical price data to estimate how it would have performed before you risk real money. Done honestly, it tells you whether an idea has any edge and what to expect from it. Done carelessly, it produces beautiful equity curves that fall apart live.

Here is a practical, step-by-step process — and the biases you have to actively guard against.

Step 1 — Define the strategy as explicit rules

Write down exactly what triggers an entry, where the stop-loss goes, where you take profit or how you trail, and how big each position is. "Buy when it looks strong" is not testable. "Buy the first pullback to the 20-EMA after a higher high, stop below the pullback low, target 2R" is.

The more discretionary your trading, the more bar-by-bar replay (rather than a fully automated test) is the right tool — it lets you apply judgement while still sampling many trades.

Step 2 — Choose representative data

Test across different market conditions — trending, ranging, and volatile — not just the period that happens to suit your strategy. A trend-following system will look brilliant in 2020 crypto and terrible in a chop. Use enough history to span more than one regime.

Make sure the data resolution matches how you trade: if you trade the 5-minute chart, test on intraday data, not daily candles.

Step 3 — Run the test and record every trade

Sample enough trades to be meaningful — a handful of trades tells you almost nothing. Aim for dozens at minimum, ideally 100+. Record each trade the same way you would in a live journal: entry, exit, size, R-multiple, and whether you followed the rules.

Step 4 — Read the results honestly

Look beyond total profit. The metrics that matter:

  • Win rate — the share of trades that are profitable.
  • Average win vs average loss (the payoff ratio).
  • Profit factor — gross profit divided by gross loss; above 1.0 is profitable.
  • Expectancy — the average amount you expect to make per trade.
  • Maximum drawdown — the worst peak-to-trough drop, which tells you if you could actually sit through it.

Step 5 — Avoid the biases that fool everyone

  • Look-ahead bias: using information that would not have been available at the time (the most common and most fatal error).
  • Overfitting: tuning the rules until they fit past data perfectly — they will not fit the future.
  • Survivorship bias: testing only instruments that still exist or did well.
  • Cherry-picking the date range that flatters the strategy.
  • Ignoring costs: spread, commission and slippage can turn a "profitable" system into a losing one.

Then forward-test before you size up

A backtest is an estimate, not a guarantee. Once a strategy looks promising, forward-test it on new data (replay a period you have not seen, or trade it small live) before trusting it with real size.

Secuora lets you backtest by replaying real historical data bar by bar, then journal and review every trade with built-in win-rate, profit-factor and expectancy stats — on a free plan, no card required.

Frequently asked questions

How many trades do I need to backtest a strategy?

As many as you can — a handful is statistically meaningless. Aim for dozens at minimum and ideally 100+ trades across different market conditions, so the result reflects an edge rather than luck.

What is the most common backtesting mistake?

Look-ahead bias — accidentally using information that would not have been available in real time — followed by overfitting the rules to past data. Both produce great-looking backtests that fail live.

Is backtesting enough before trading live?

No. Treat a backtest as an estimate, then forward-test on data you have not seen (or trade small live) before scaling up. Markets change, and real execution adds costs a backtest may not capture.

Practise this on Secuora

Free trading journal + bar-by-bar replay backtester. Crypto replay is free and there's a live demo with no sign-up.

Keep reading