Backtesting

What Is Backtesting? How Traders Test Strategies Before Risking Money

Quick Answer

Backtesting is applying a trading strategy's exact rules to historical price data to see how it would have performed, before risking real money. It measures win rate, average win and loss, expectancy, drawdown and trade frequency. Backtests can be manual (stepping through charts) or automated (code or strategy testers). They're only useful if the rules are precise and you avoid overfitting, look-ahead bias and ignoring costs.

Every strategy sounds convincing in a video. Backtesting is how you find out whether it actually worked across hundreds of examples, including the ugly ones the video didn't show.

What backtesting tells you

MetricQuestion it answers
Number of tradesIs the sample big enough to mean anything?
Win rateHow often does it win?
Average win / average loss (in R)How big are wins compared with losses?
ExpectancyAverage result per trade, after costs
Max drawdownWorst peak-to-trough decline, which is what you'd have to sit through
Longest losing streakCould you keep following the rules through it?
Profit factorGross profit ÷ gross loss

Expectancy is the headline number: (win rate × average win) − (loss rate × average loss). If it's not positive after costs, the strategy doesn't have an edge in that sample.

Manual vs automated backtesting

ManualAutomated
HowScroll through historical charts (e.g. TradingView Bar Replay) and log each setupCode the rules (Python, Pine Script, NinjaScript) and run them on data
SpeedSlowFast
Best forDiscretionary setups, learning pattern recognitionRule-based systems, large samples
Main riskHindsight bias, skipping bad examplesOverfitting, coding errors

Most discretionary traders start manually. It trains your eye as well as testing the idea. Step-by-step instructions are in how to backtest a trading strategy and backtesting in TradingView for free.

Compare Backtest vs Live, Trade by Trade

Log backtest and live trades side by side in TRADZY and see where the edge holds up.

Log Your Backtest Free →

The biases that make backtests lie

How many trades do you need?

As a rough guide, 100+ trades of the same setup give a much more reliable picture than 20–30. Small samples can make luck look like skill. Test across different market conditions too: trends, ranges, high and low volatility.

From backtest to live

  1. Backtest with exact rules and realistic costs.
  2. Check robustness: does it still work with slightly different parameters, and on data you didn't use to design it?
  3. Forward test on a simulator. See forward testing vs backtesting.
  4. Go live small and compare live results with the backtest.
  5. Keep measuring. Strategies degrade when markets change.

Live results are usually worse than backtests. The gap shows you costs, slippage and execution errors, and tracking that gap is how you improve.

TRADZY lets you log backtest trades separately from live ones and compares their win rate, average R and expectancy side by side.

FAQ

What is backtesting in trading?

Testing a trading strategy on historical data to see how it would have performed, before risking real money.

Is backtesting reliable?

It's useful but imperfect. A backtest with precise rules, realistic costs and a large sample is informative. One built on hindsight or overfitting isn't.

Can I backtest for free?

Yes. TradingView's Bar Replay and strategy tester, spreadsheets, and free Python libraries let you backtest without paying.

What's the difference between backtesting and paper trading?

Backtesting uses historical data. Paper trading tests the strategy in real time with simulated money. Use both.

How long should a backtest be?

Long enough to include at least 100 trades and several different market conditions.

Put This Into Practice

  1. Log backtest trades with the same fields as live ones
  2. Compare win rate, average R and expectancy side by side
  3. Go live only when the numbers hold

Start Free in TRADZY →

Educational content, not financial advice. Trading involves substantial risk of loss.