Backtesting with Bar Replay: test your setup before you risk money

A simple routine for manual backtesting in TradingView: clear rules, a fair sample, the numbers that matter and how to avoid looking ahead.

Part 2 of 2 1 min read Updated

Backtesting shows you how a setup would have performed in the past – before a single real trade. With the Bar Replay function in TradingView you can replay the chart candle by candle and trade it as if it were live.

Write down your rules first

A test is only as good as its rules. Before you start, write down exactly when you enter, where the stop goes, where you take profit and which conditions must be met – for example the direction of the higher timeframe or a specific session.

How to replay the chart

  • Click Replay in the top toolbar of the chart.
  • Choose a starting point in the past – the chart to the right of it is hidden.
  • Move forward bar by bar or let the chart play at your chosen speed.
  • Mark every trade with entry, stop and target the moment your rules trigger.

A fair sample

Aim for at least 50 to 100 trades per setup, spread over different market phases – trends, ranges, quiet and busy weeks. A handful of trades says little; a large sample shows what the setup really does.

The numbers that matter

  • Win rate: the share of winning trades.
  • Average win and average loss, measured in R (multiples of your risk).
  • Expectancy: win rate × average win − loss rate × average loss. Above zero means the setup has an edge.
  • Maximum drawdown: the largest drop from a peak – it tells you which losing streak to expect.

Keep it honest

Decide on every trade only with the candles you can see. Note setups you skipped as well. And test on several markets and timeframes – a setup that works across them is more robust than one that only shines on a single chart.

Free tool Work out your position size Enter your balance, risk and stop – the calculator shows the position size for forex, gold, indices and futures.

Back to all guides

Educational content. It is not investment advice and not a recommendation to buy or sell. Risk disclosure