BACKTESTING

How to Backtest a Trading Strategy — Without Lying to Yourself

RB Trading 9 min read

Most traders "backtest" by scrolling through historical charts, mentally noting where they would have entered, and concluding their strategy works. Then they trade live and lose money for six months.

This isn't backtesting. It's hindsight bias dressed up as research. Real backtesting requires structure that prevents you from lying to yourself.

The two backtest modes

There are exactly two valid approaches:

1. Manual bar-by-bar replay

You walk through historical price action one candle at a time, with future candles hidden. At each candle you decide: take a trade or not? If yes, where's the stop, where's the target, what's the size? You record the result. Repeat 100+ times.

This is the only way to backtest discretionary strategies (chart pattern reading, price action, intraday discretion). It cannot be automated because the decisions aren't programmable.

2. Automated backtesting (Pine Script, Expert Advisors, Python)

You write code that defines exact entry/exit rules. The code runs against historical data. You get a result.

This is the only way to backtest mechanical strategies (fixed rule sets, indicator crossovers, algorithmic systems). It's not useful for discretionary trading because most chart patterns can't be coded precisely.

If you're using your eyes to make trades live, you have to use your eyes (with future hidden) to backtest.

The 5 biases that ruin most backtests

1. Look-ahead bias

You "see" the chart and think "yeah I would have taken this at the breakout." But you can see the next 50 candles. Of course you would have taken it. Hide the future or the test is worthless.

2. Survivorship bias

You only count the trades you "would have taken." You skip the ones that look ambiguous in retrospect. Live trading doesn't let you skip ambiguous setups — you have to decide in the moment.

3. Optimisation bias

You tweak the rules ("oh, if I just used a 10-EMA instead of 8, this would have worked") until the backtest looks great on the specific data set you tested. This is curve-fitting. The strategy will fail on new data.

4. Position sizing optimism

You assume perfect fills, no slippage, no commissions. Real markets give you 0.5–2 pip slippage on entries during normal conditions, 5–20 pips on news. Build that into your backtest or your real numbers will be 30% worse.

5. Time-period bias

You backtest 3 months of trending market and conclude your trend strategy works. Then you trade in a range and lose. Backtest across at least 12 months covering bull, bear, and sideways periods.

How to manual-backtest properly (step by step)

Step 1: Pick your dataset

Step 2: Hide the future

Step 3: Apply your rules at each bar

Step 4: Log everything in a journal

Each backtest trade should have:

Step 5: Calculate the real numbers

After 100+ trades:

Step 6: Stress test

If all three are still positive, you have a strategy worth paper-trading. If any of them break, you have a strategy that probably won't survive real markets.

How long does a real backtest take?

Roughly 3–8 hours of focused work to backtest 100 trades manually on a 1H timeframe. Most traders won't spend that. That's why most strategies fail — the work to validate them hasn't been done.

Compare: 3–8 hours of backtesting vs months of losing real money on an unvalidated strategy. The math is obvious.

What separates a good backtest from a great one

Good backtest: you log entries + exits and calculate net P&L.

Great backtest:

This is exactly what a journal lets you do — and the same tags carry over to live trading, so you can compare your backtest performance vs live performance.

When automated backtesting matters

If your strategy is:

Use Pine Script (TradingView) or MQL5 (MetaTrader). Both have decent strategy testers. Both have the same biases — be especially careful of optimisation bias by testing on out-of-sample data.

The funded-trader workflow

The serious workflow before risking a $200 challenge fee:

  1. 6+ hours of manual backtesting of the strategy you'll trade
  2. Minimum 100 trades logged in your journal as backtest entries
  3. Net positive R with stress tests passed (10% lower WR, 20% higher slippage)
  4. 2 weeks of paper-trading with the same setup
  5. Then pay the challenge fee

Most traders skip steps 1–4. That's the 70% fail rate.

Forward testing — the step between backtest and live

A backtest tells you the strategy had edge on historical data. It doesn't tell you whether you can execute it consistently in real time. Forward testing — paper trading the strategy live, with real-time data, without looking at results until after the decision — fills that gap.

Run 30 forward-test trades before any live money or challenge fee:

  1. Paper trade in real time (not replay). The psychological experience of waiting for a setup that never comes, or watching a winning trade while you're in it, is different from replay and can't be replicated. You need the real clock.
  2. Log every forward-test trade the same way as backtest trades. Same setup tags, same emotion tags, same exit notes. The data should be directly comparable.
  3. Compare forward-test results to backtest results. Win rate within 10%? R:R within 15%? You're executing consistently. Significant drop-off? Something about your live execution is breaking the edge — usually early exits or late entries — and you need to find it before risking real capital.

Most traders forward-test for a week, declare it "working," and go live. Thirty trades takes 2–4 weeks for most intraday strategies. That investment is trivial against the cost of a failed $500 prop firm challenge.

How many backtest trades are statistically sufficient?

The honest answer: more than you think, and less than is practical. The statistical thresholds:

For a strategy you intend to pass a prop firm challenge with: 100 trades minimum in backtest, 30 in forward test, before the first real dollar goes in.

Frequently asked questions

Is the MetaTrader strategy tester good enough for backtesting?

For automated strategies (EAs), yes — MT4/MT5's strategy tester is functional, though the data quality can vary by broker. For discretionary strategies, the MT4 tester is useless because it can't replicate a human making contextual decisions. Discretionary strategies require manual bar-by-bar replay in TradingView, or a dedicated replay tool that hides future price data while you step through candles one at a time.

Can I backtest with free historical data?

Yes. TradingView's replay mode gives you access to historical data on most timeframes at no cost on the free tier. For more data depth (5+ years of intraday data), TradingView's paid tiers or dedicated data providers like Dukascopy (free tick data download) are needed. The key: use data from the same instrument and approximate the same spread environment as your live trading — backtesting EUR/USD with a 0.5 pip spread but trading it live at 1.2 pips will produce results that overstate the edge.

Should I just start trading live and learn from real trades instead of backtesting?

For very small amounts of capital (under $200), learning from live trading is defensible — the cost of lessons is low enough to justify the speed of feedback. For any serious capital or a prop firm challenge, backtesting first is not optional. A prop firm challenge costs $150–$500. One hundred hours of backtesting before spending that money is a better use of time than "learning" by failing three challenges at $500 each.

RB Trading Pro Journal includes a full backtest replay engine — load any chart, set a start date, hide the future, click bar-by-bar, log every backtest trade with the same tags as your live trades. 30-day money-back guarantee. The traders who validate their strategy first pass challenges at 3× the rate of those who don't.

RB Trading Pro Journal

Stop guessing. Start tracking.

30-day money-back guarantee · Cancel anytime · Used by 7,000+ funded traders

Get Started →
BacktestingStrategyRisk