Start free

How to Backtest a Trading Strategy Properly

Backtesting8 min readUpdated

TL;DRA backtest is only as honest as its rules and its sample. Write the rules before you start, replay bar by bar without looking ahead, log every opportunity including the ones you skip, include costs, and collect at least 100 trades before judging. Then test on a period you didn't use to build the strategy, and forward test at small size.
In this article
  1. Why most backtests are too optimistic
  2. Step 1: Write the rules before you open a chart
  3. Step 2: Choose your data and split it
  4. Step 3: Replay without peeking
  5. Step 4: Log every opportunity
  6. Step 5: Include costs
  7. Step 6: Collect enough trades
  8. Step 7: Read the results properly
  9. Step 8: Test out of sample, then forward test
  10. Discretionary strategies: extra care
  11. Keeping backtests in your journal
  12. A realistic schedule
  13. Common backtesting mistakes
  14. Summary

Backtesting is supposed to answer one question: if I had followed these rules in the past, what would have happened? Done well, it gives you the confidence to follow a strategy through a losing streak. Done badly, it gives you false confidence, which is worse than none.

This guide is for traders who backtest manually or semi-manually, with bar replay, especially discretionary strategies like ICT and SMC models that are hard to code.

Why most backtests are too optimistic

Before the steps, the traps. Almost every overly rosy backtest comes from one of these:

  • Look-ahead bias: seeing what happened next before deciding. Scrolling the chart forward "to check" is the classic case.
  • Hindsight in discretionary rules: "a clean sweep" is easy to recognise once you know the trade worked.
  • Cherry-picked periods: testing only the months when your market trended nicely.
  • Overfitting: adding filters until the past looks perfect. As Wikipedia's backtesting entry puts it, it's often possible to find a strategy that would have worked well in the past but won't work in the future.
  • No costs: commissions, spreads and slippage left out.
  • Small samples: 20 good trades treated as proof.

Each step below is designed to remove one of these.

Step 1: Write the rules before you open a chart

If someone else read your rules, would they take the same trades? Aim for that. A useful format is a checklist with clear yes/no checks and deal-breakers:

  1. Time window: 10:00 to 11:00 am New York time. Outside it: no trade.
  2. A sweep of a level marked before the window (prior range high or low). No sweep: no trade.
  3. Displacement leaves a fair value gap on the 1-minute chart.
  4. Entry at the gap's midpoint; stop beyond the sweep; target at the opposite liquidity.
  5. Target at least 2R away. Less: no trade.
  6. Maximum one trade per window.

This example is the ICT Silver Bullet, described fully in our Silver Bullet guide. The more vague words your rules contain ("strong", "clean", "obvious"), the more room hindsight has to help you.

Step 2: Choose your data and split it

  • One market, one timeframe to start. NQ on the 1-minute chart, or XAUUSD on the 5-minute, not both at once.
  • Varied conditions. Include trending months, choppy months and high-volatility periods. If you only test calm markets, you've only learned about calm markets.
  • Split the data. Use one period to learn and adjust the rules (in-sample), and a different period you don't touch until the rules are frozen (out-of-sample). For example, develop on January to June and test on July to December.

Step 3: Replay without peeking

Use a bar replay tool and step forward one bar at a time. TradingView's Bar Replay is a common choice, and its help center explains the setup. Rules for the session:

  • Mark your levels using only the bars visible at that moment.
  • Decide on entry, stop and target before you step to the next bar.
  • If you scroll ahead by accident, skip that day and move on.
  • Replay full sessions, not just the moments you remember as interesting.

Step 4: Log every opportunity

A backtest log should contain every window or session you replayed, not only the trades. For each one, record:

Field Example
Date and window 2026-03-12, NY AM
Outcome type Trade / no setup / no fill
Entry, stop, target, exit 24,075.25 / 24,052.50 / 24,142.00 / 24,142.00
Result in R +2.93R
Grade at entry A (84/100)
MFE / MAE in R +3.1R / −0.4R
Note Sweep of 9:30 low, gap on third candle

Logging "no setup" days matters. A strategy that triggers on 40% of days and makes +0.3R per trade earns about +0.12R per day you sit down, which is a very different picture from +0.3R a day.

Step 5: Include costs

Convert costs into R so they're comparable. Suppose you trade 5 MNQ with 1R = $225, and assume one tick of slippage on entry and one on exit: 2 ticks × $0.50 × 5 contracts = $5, or about 0.02R, plus your broker's commissions. On tight stops, costs grow quickly as a share of R, so a strategy with a 5-point stop is much more cost-sensitive than one with a 25-point stop.

On gold, include the spread, which varies by broker and widens around news and the daily rollover.

Step 6: Collect enough trades

This is where most backtests fall short. Here is how uncertain your results are at different sample sizes, at 95% confidence, assuming a 45% win rate and a standard deviation of 1.5R per trade:

Trades Win rate uncertainty Expectancy uncertainty
30 ±17.8 points ±0.54R
50 ±13.8 points ±0.42R
100 ±9.8 points ±0.29R
300 ±5.6 points ±0.17R

So after 30 trades, a measured 45% win rate could really be anywhere from about 27% to 63%. After 100 trades, an expectancy of +0.25R could still be close to zero. These are standard statistical estimates, not rules, but they show why 100 trades is a minimum and a few hundred is better.

Step 7: Read the results properly

Look beyond the total:

  • Expectancy in R per trade and per day.
  • Maximum drawdown in R: the worst peak-to-trough run.
  • Longest losing streak. Expect it to be longer than you'd guess. At a 45% win rate, the chance of at least one run of six or more consecutive losses somewhere in 100 trades is about 73%; for eight or more, about 31%.
  • Results by session, weekday and grade. If A-grade setups clearly beat B-grade ones over a large sample, your checklist is working.
  • MFE and MAE. If most losers went +1R in your favour first, your management, not your entry, may be the problem.

If you need a refresher on R and expectancy, see R-multiple explained.

Step 8: Test out of sample, then forward test

Freeze the rules. Run the same process on the period you held back. If the out-of-sample expectancy is roughly in line with the in-sample one, that's encouraging. If it collapses, the first result was probably fitted to that period.

Then forward test: trade the strategy live at small size or on a simulator for 20 to 30 trades. Compare the results in R with the backtest. A large gap usually means execution under pressure, which no backtest can measure.

Discretionary strategies: extra care

ICT, SMC and price-action models involve judgment. That doesn't make them untestable; it makes discipline more important.

  • Grade the setup before you see the outcome. Write the score down before stepping forward.
  • Use the same checklist live. If your live checklist differs from your backtest one, you're trading a different strategy.
  • Re-test a random sample. Months later, replay 20 days again without looking at your old log. If you take different trades, your rules need tightening.

Keeping backtests in your journal

Store backtest trades in a separate account, never mixed with live results. Tag them with the same setup and grade fields so you can compare backtest and live performance side by side.

TJ's Backtest tab has chart replay with history back to each market's first day, saved layouts and indicators, and every backtest trade lands in a separate backtest account in your journal, graded with the same Rate It! checklist you use live. You can also import FX Replay-style exports. Open the demo to see how backtest and live results sit side by side.

A realistic schedule

Manual backtesting takes time, so plan it like a project rather than a weekend binge. Fatigue is a bias of its own: the fortieth replayed session of the day gets less care than the first.

A schedule that works for many traders:

  • Week 1: write and freeze the rules. Replay 10 sessions only to check the rules are clear enough to follow. Don't record results yet.
  • Weeks 2 to 4: replay 30 to 40 sessions a week from the in-sample period, in blocks of 45 to 60 minutes. Log every window.
  • Week 5: read the in-sample results. Make at most one or two rule changes, and write down why.
  • Week 6: freeze the rules again and replay the out-of-sample period.
  • Weeks 7 to 10: forward test at small size or in a simulator, with the same checklist.

That's roughly 150 replayed sessions and 20 to 30 live trades in about ten weeks, which is enough to make an informed decision about one setup on one market. Testing a second market or window is a new project, not an add-on.

Common backtesting mistakes

  • Changing the rules halfway through and keeping the earlier trades.
  • Skipping days that "looked messy".
  • Ignoring the windows with no setup.
  • Testing ten variations and keeping the best one without an out-of-sample check.
  • Judging the strategy on dollars from different position sizes.
  • Stopping at 30 trades because the results looked good.

Summary

A good backtest is boring: fixed rules, every session replayed, every opportunity logged, costs included, and a sample large enough to mean something. That's what lets you trust the strategy on the day it loses five in a row.

Not financial advice. Backtested results are hypothetical and don't predict future performance; trading involves risk of loss.

FAQ

How many trades do I need to backtest a strategy?

At least 100, and more if the edge is small. At 30 trades, a 45% win rate is uncertain by about ±18 percentage points at 95% confidence; at 100 trades, about ±10; at 300, about ±6. Expectancy in R needs similar or larger samples.

Is manual backtesting worth it?

Yes, especially for discretionary strategies such as ICT or SMC models that are hard to code. Manual replay also trains your eye. The risk is bias, so write the rules first and never look ahead.

What is look-ahead bias in backtesting?

Using information that wasn't available at the time of the decision, such as seeing the next candles before marking an entry. It makes backtests look better than live trading ever will.

What is out-of-sample testing?

Testing your finished rules on a period of data you didn't use while building or adjusting them. If results hold up there, the strategy is less likely to be overfitted to the first period.

Why are my live results worse than my backtest?

Common reasons are costs and slippage left out of the backtest, look-ahead bias, a sample that was too small, and execution under real pressure. Compare live and backtest results for the same setup in R to find the gap.

Grade your next setup before you click

TJ scores every setup against your own checklist, logs the trade in seconds and keeps your prop-firm limits in view. Free for 3 days, then pick a plan.

Sources