To backtest a trading strategy means to run its rules across historical price and record what would have happened — enough times that the result is a measurement, not an anecdote. The goal is a sample large and honest enough that the numbers reflect the strategy, not luck and not your bias. Five steps get you there.
Step 1 — Write the rules down first
Before you look at a single chart, define the strategy precisely: what triggers an entry, where the stop goes, where the target goes, and what closes the trade early. If the rules live only in your head, you will unconsciously bend them to fit each chart and the backtest becomes worthless. Written rules make every trade repeatable — the whole point of testing properly.
Step 2 — Choose the instrument and timeframe
Test the strategy on the market and timeframe it is actually meant to trade. A scalping rule set belongs on M1–M15; a swing strategy belongs on H4–D1. Load real historical data for that instrument — and if the strategy is meant to be general, plan to repeat the test on a few different markets rather than assuming one result transfers.
Step 3 — Replay the chart and take every trade
Step the chart forward one bar at a time and take every trade your rules allow — including the ugly ones you would rather skip. This is where most backtests go wrong: quietly passing on the setups that "didn't feel right" inflates the win rate and hides the strategy's real behaviour. Bar-by-bar manual backtesting keeps you honest because you can't see the future bars.
Beware curve-fitting and look-ahead bias: if you tweak the rules after seeing the result until the equity curve looks perfect, you have fitted the strategy to the past, not found an edge. Test the rules as written, then change them once and re-test on fresh data — never mid-sample.
Step 4 — Build a large enough sample
A handful of trades proves nothing. Aim for at least 50–100 trades across different conditions — trends, ranges, quiet and volatile periods — so a couple of lucky winners can't carry the result. This is exactly why manual backtesting beats waiting for live trades: you can build a 60-trade sample in an afternoon instead of a year.
Step 5 — Read the metrics together, not win rate alone
Win rate in isolation is the most over-weighted number in trading. Read the full picture:
- Win rate + risk-reward — a 40% win rate at 1:2 is profitable; a 60% win rate at 1:0.5 is not.
- Expectancy — the average dollar (or R) you make per trade; this is the real edge.
- Profit factor — gross profit divided by gross loss; above ~1.3 is a decent start.
- Max drawdown — the deepest the account fell; the pain you have to survive to collect the edge.
A good backtester computes all of these for you and draws the equity curve, so you read the strategy the way a risk desk would rather than tallying a spreadsheet by hand.
Backtest a strategy free, no code
FxBacktest runs the whole process in the browser for free. Pick an instrument and timeframe, replay the chart bar by bar, place buy and sell trades with draggable stop and target, and the lot is auto-sized to a fixed risk percentage. Every trade is logged, and the end-of-session report totals your win rate, expectancy, profit factor, and drawdown automatically — no Pine Script, no download, no card. It works for a discretionary strategy that a code-only tester can't measure.
A worked example: 60 trades on EURUSD H1
Abstract steps are easy to nod along to, so here is the same process with numbers attached. The strategy: buy the pullback to the 20 EMA in an uptrend, stop below the swing low, target twice the stop distance.
- Sample: 60 trades on EURUSD H1, spanning a trending stretch, a choppy range, and one high-volatility news week.
- Result: 24 winners, 36 losers — a 40% win rate, which sounds like failure until you read it beside the risk-reward.
- The maths: at 1:2, the 24 winners return 48R and the 36 losers cost 36R. Net +12R across 60 trades.
- Expectancy: 12R divided by 60 trades = +0.2R per trade. Risking 1% per trade, that is roughly 0.2% of the account earned per trade taken.
- Max drawdown: a run of 7 straight losses mid-sample took the equity curve down 7R. That is the number that decides whether you can actually trade this.
Note what the sample exposes that a 10-trade test would have hidden entirely: the seven-loss streak. A strategy with a positive expectancy you cannot psychologically survive is not a tradable strategy, and only a large enough sample surfaces that.
What a good backtest result actually looks like
There is no single passing grade, but these ranges separate a result worth forward-testing from one worth discarding.
| Metric | Weak | Worth testing further | Strong |
|---|---|---|---|
| Sample size | Under 30 trades | 50-100 trades | 200+ trades |
| Expectancy | Negative or ~0R | +0.1R to +0.3R | Above +0.3R |
| Profit factor | Below 1.0 | 1.3 to 1.6 | Above 1.6 |
| Max drawdown | Deeper than you would sit through | Under 15% of account | Under 10% of account |
| Longest losing streak | Unknown - sample too small | Measured and survivable | Measured and comfortable |
Be suspicious of results that look too good. A profit factor above 3 on a small sample almost always means the rules were bent, the sample was cherry-picked from a single favourable regime, or the strategy was curve-fitted to the data you tested on.
Manual vs automated backtesting a strategy
Both approaches answer the same question, but they suit different rule sets — and picking the wrong one wastes weeks.
- Automated suits fully mechanical rules with no judgement calls. You write the strategy in code, run it across years of history in seconds, and can optimise parameters quickly. The catch: it only tests what you can express in code, and fast optimisation makes curve-fitting almost effortless.
- Manual suits discretionary rules — anything involving structure, context, or "only in this kind of market". You replay the chart bar by bar and cannot see the future, so the test reflects the decisions you would genuinely have made in the moment.
Most retail strategies are partly discretionary even when the trader believes they are mechanical. If you cannot hand your rules to a stranger and have them take the identical trades, the strategy has judgement in it and needs manual testing.
Five mistakes that make a backtest worthless
- Skipping the ugly setups. Passing on trades that "obviously" would have lost is the single most common way traders inflate a win rate without noticing.
- Seeing the future bars. Scrolling a static chart lets your eye register what happened next. Bar-by-bar replay is the only way to remove this.
- Testing one market regime. A trend-following strategy tested only across a clean trend will look extraordinary and then fail the moment the market ranges.
- Ignoring costs. Spread and commission turn many marginal scalping edges negative. A backtest without costs applied measures a strategy you cannot actually trade.
- Re-tuning mid-sample. Adjusting the rules halfway through because the results disappoint means your sample now tests two different strategies, and neither honestly.
Measured: why the years you test decide the answer
The most common way a backtest lies is not a coding error — it is testing a single volatility regime and reading the result as a permanent property of the strategy. Here is the size of that effect, measured on 3,440 EURUSD daily bars:
| Year | EURUSD avg daily range | vs. the 11-year mean | GBPUSD |
|---|---|---|---|
| 2015 | 107 pips | +51% | 107 pips |
| 2016 | 79 pips | +11% | 131 pips |
| 2019 | 47 pips | -34% | 88 pips |
| 2021 | 54 pips | -24% | 79 pips |
| 2022 | 88 pips | +24% | 116 pips |
| 2024 | 53 pips | -25% | 68 pips |
| 2015-2025 mean | 71 pips | — | 95 pips |
EURUSD's average day was 107 pips in 2015 and 47 pips in 2019 — the same instrument, less than half the movement. A breakout strategy tested only on 2015 looks excellent; the identical rules on 2019 barely clear the spread. Neither result is wrong, and neither is the strategy's true expectancy.
Three rules follow directly from this:
- Never test one continuous recent window. Split the sample across a high-volatility year and a low one and compare the two reports separately, not merged.
- Watch the pair, not just the strategy. 2016 was quiet for EURUSD (79 pips) and the loudest year in the decade for GBPUSD (131 pips, the Brexit referendum). Portfolio results hide this; per-instrument results expose it.
- Report the range, not a single number. "Profit factor 1.4" means little. "Profit factor 1.9 in 2015, 1.1 in 2019" is a strategy you can actually plan around.
Regulators make the same point about simulated results in general — see the CFTC rule cited below, which requires hypothetical performance to carry a warning that such programs are "designed with the benefit of hindsight". That is precisely the failure mode a single-regime backtest produces.
Computed 2026-08-27 from the FxBacktest tick-derived OHLC archive: 3,440 EURUSD and 3,438 GBPUSD daily bars, 2015-2025. "Avg daily range" is the mean of each day’s high minus low, in pips.
Backtesting a strategy — FAQ
How many trades do I need to backtest a strategy?
Aim for at least 50 to 100 trades across different market conditions before you trust the numbers. Fewer than that and a couple of lucky winners can make a losing strategy look profitable. The more trades in the sample, the more reliable the win rate and expectancy become.
What metrics matter most when backtesting a trading strategy?
Win rate on its own is misleading. Read it beside risk-reward, expectancy (average profit per trade), profit factor, and maximum drawdown. A strategy with a 40% win rate at 1:2 risk-reward is profitable; a 60% win rate at 1:0.5 is not. Expectancy and drawdown together tell you whether the edge is real and survivable.
Can I backtest a trading strategy for free?
Yes. FxBacktest is a free browser-based backtester: replay historical charts bar by bar, place manual trades with stop and target, and get a full report of win rate, expectancy, and drawdown — no download, no code, and no credit card required.
How long does it take to backtest a trading strategy?
A 50 to 100 trade sample on an hourly chart typically takes two to four hours of focused chart replay. That is dramatically faster than forward testing the same strategy live, which would take months to produce the same number of trades.
How far back should I backtest a strategy?
Far enough to cover several different market conditions rather than a fixed number of years. One to two years of data on an intraday timeframe usually spans trending, ranging, quiet, and volatile periods. Testing only the most recent few months risks measuring a single regime that will not repeat.
What is the difference between manual and automated backtesting?
Automated backtesting runs a strategy written in code across history in seconds, but only works for fully mechanical rules. Manual backtesting means replaying the chart and taking each trade by hand, which is the only honest way to test a discretionary strategy where judgement is part of the entry.
Sources
- 17 CFR § 4.41 — CFTC rule on hypothetical performance — the US regulation governing how simulated results must be presented, and the source of the standard warning that simulated programs are "designed with the benefit of hindsight".
- NFA Compliance Rule 2-29 — communications with the public — the National Futures Association rule on promotional material and hypothetical results.
- BIS Triennial Central Bank Survey — OTC FX turnover, April 2025 — the primary measurement of global FX market size: $9.6 trillion traded per day, up 28% from $7.5 trillion in 2022, with the US dollar on one side of 89.2% of all trades.