Backtesting Step by Step: How to Validate a Strategy Before Risking Money

Historical candlestick chart with a gold marker line and a stopwatch

Quick answer: a backtest does not predict how much you will make. It answers two questions: does this strategy have positive expectancy? and could I survive its worst streak? A hundred trades reviewed bar by bar in TradingView's Replay mode gives you a reasonable base. Without a forward test on demo afterwards, a backtest only proves you can read the past.

Key takeaways

  • What matters is expectancy and drawdown, not win rate.
  • A backtest with fewer than 50 trades proves nothing.
  • If you tune the strategy until history looks perfect, you have broken it.
  • Every backtest gets validated on demo before real money.

A manual backtest in 7 steps

  1. Write the rules down: entry, stop, target, session, instruments. If they do not fit on half a page, there are too many.
  2. Choose the period: at least three months covering both trend and range, not just the stretch that flatters you.
  3. Open Replay mode in TradingView and rewind to the start of that period.
  4. Step forward bar by bar. When your condition triggers, write down entry, stop and target before seeing what happens.
  5. Record results in R (multiples of risk), never in dollars.
  6. Repeat to 100 trades or until the period is covered.
  7. Calculate the metrics below and decide with data.

The metrics that matter

Metric How to calculate What it tells you
Number of trades Total logged Whether the sample counts (50 minimum)
Win rate Winners ÷ total Little on its own, without average R
Average winner and loser in R Mean of each group Whether you cut winners or let losers run
Expectancy (Win% × avg win) − (Loss% × avg loss) Average result per trade
Maximum drawdown Largest fall from a peak Whether you could sit through it
Losing streak Longest run of losses What risk per trade is sustainable

Example: 100 trades, 42% win rate, average winner 2.1R and loser 1R. Expectancy = (0.42 × 2.1) − (0.58 × 1) = +0.30R per trade. With a worst streak of nine losses, risking more than 1% would be reckless.

The four biases that inflate any backtest

  • Looking ahead. Deciding an entry while seeing candles that had not closed yet. Replay mode exists to prevent this.
  • Overfitting. Tweaking parameters until history shines. Great on the past, poor live.
  • Period cherry-picking. Testing only the stretch where your strategy works.
  • Ignoring costs. Spread, commission, swap and slippage turn many “profitable” systems flat.

From backtest to real money

Phase Length Criterion to advance
Backtest 50–100 trades Positive expectancy including costs
Forward test on demo 4–6 weeks Similar numbers and plan followed > 90%
Live at minimum size 30 trades No behaviour change under pressure
Normal size — Only when all three phases agree

If demo numbers collapse, the strategy is usually not the problem: in the backtest you made decisions with information you would not have had live.

When the signal already carries the rules

Validation is much faster when the strategy is not raw but a system with closed rules. Signals from the Cortex Signal Kit appear on the chart with entry, stop and target, so the backtest becomes a matter of logging what is already defined instead of inventing criteria as you go.

Frequently asked questions

How many trades does a backtest need?

At least 50, ideally 100, spread across different market conditions.

Is TradingView's strategy tester good enough?

It works for coded strategies, provided you check commissions, slippage and whether the code peeks at future data. Manual Replay teaches more.

What is overfitting?

Tuning parameters until the past looks perfect. The warning sign is a strategy with many very specific conditions.

Can I skip the forward test?

You can, but then your first real test is paid for with money. A demo forward test costs weeks, not capital.

How often should I re-run a backtest?

Whenever you change a rule, or when live results diverge sharply for more than 30 trades.

Validate with data, not feelings. The Cortex Signal Kit includes a trading journal and implementation manual, and the free ebook From the First Lot to Consistent Growth covers the risk side.

Disclaimer: educational content. Past results never guarantee future results. Cortex Next is not a financial service and guarantees no results. Trading involves risk of loss.