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.

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. Free for 7 days. 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.

Free 7-day trial · Card required · Cancel anytime · Used by 7,000+ funded traders

Start Free Trial →
BacktestingStrategyRisk