Back testing
You would not open a business without checking whether the idea had worked before. A trading strategy is no different.
Authorship
Written by
Forex Market Analyst , an ICT Chartered Graduate with 18 years of live trading experience in forex, gold, and crypto.
Reviewed by
Forex market analyst and educator with a strong focus on technical analysis and trader psychology.
Key Takeaways
-
Back testing applies a strategy's written rules to historical price data to measure how those rules would have performed across a meaningful sample. The output is a set of metrics, not a feeling. Those metrics tell you whether the strategy has a statistical edge before any real money is involved.
-
A back test needs at least 100 trades across at least one to two years of varied market conditions to produce numbers worth trusting. A 20-trade backtest showing a high win rate tells you nothing about edge.
-
A backtest validates the rules. A forward test on a demo account validates the trader. Both steps are required before any real capital is committed.
What is backtesting?
Imagine a trader creates a new strategy. The setup looks perfect. The rules seem logical. The indicators appear to work well. Should the trader immediately use real money? Absolutely not. A trading strategy should be tested before it is trusted. That process is backtesting.
If you have not yet read Risk Management, start there before continuing.
Backtesting is the process of applying a strategy's written rules to historical price data to find out what the results actually are. You scroll through past charts, apply the rules exactly as written, record every trade that meets the criteria, and calculate the results across the full sample. The output is objective: win rate, expectancy, profit factor, maximum drawdown, and maximum consecutive losses. Those five numbers tell you whether the strategy has a statistical edge, whether the drawdowns are survivable, and whether the rules produce consistent results or lucky runs in specific conditions.
What backtesting cannot do is guarantee future performance. Markets change. Backtesting produces a statistically valid baseline, not a promise. Professional traders do not rely on assumptions. They rely on evidence.
How Does It Work?
Step 1: Write the rules before testing
The rules must be specific enough to apply without discretion before any chart is opened. If the entry rule is when it looks like a good pullback, the backtest will reflect whatever looked good in hindsight. Every component from the strategy article must be written down: which pair, which timeframe, the trend filter, the entry trigger, the stop level, the take profit level, and the position size rule.
Step 2: Select historical data
At least one to two years of data is the minimum. The sample should span different market conditions: trending periods, ranging periods, volatile periods, and quiet ones. A strategy tested only in favourable conditions will look better than it performs when the market shifts. Free historical chart data is available through MetaTrader, TradingView, and FX Replay, most of which offer bar replay with future price hidden.
Step 3: Execute bar by bar
Move through the chart one bar at a time. At each bar, apply the written rules. If the conditions are met, log the trade: entry price, stop, target, date. Then advance and manage the trade as it develops. Do not look ahead. Do not skip setups that would have lost. Do not take setups that did not meet the criteria but would have worked. Every trade the rules would have produced must be recorded.
Step 4: Record every trade
Keep a log for every trade: date, pair, timeframe, entry price, stop loss, take profit, position size, result in R (multiples of the initial risk), and notes. Consistent record-keeping is what makes the analysis in Step 5 possible and honest.
Step 5: Calculate the five key metrics
Win rate is how often the strategy closes in profit. It means nothing without the reward to risk ratio.
Expectancy is (win rate multiplied by average win in R) minus (loss rate multiplied by average loss in R). Positive expectancy is the minimum condition for a viable strategy. An expectancy of plus 0.28R means the strategy earns an average of 0.28 times the initial risk per trade across all trades. On 100 trades risking $100 each, that is $2,800 net profit.
Profit factor is total gross profit divided by total gross loss. Above 1.5 is solid. Between 1.3 and 1.5 is marginal. Below 1.0 means the strategy loses money.
Maximum drawdown is the largest peak-to-trough decline in account equity during the backtest. If the maximum drawdown is larger than the trader can tolerate without abandoning the strategy, the strategy is not usable regardless of its expectancy.
Maximum consecutive losses is the longest losing streak in the sample. If the longest historical losing streak was 12, a sequence of 12 losses in live trading should be expected. A trader who did not know this number is likely to abandon the strategy during a normal losing streak.
Manual versus automated backtesting
Manual backtesting involves scrolling through charts bar by bar and recording every trade. It improves chart-reading skills, builds familiarity with how the strategy behaves, and is better suited to strategies with a subjective component such as price action confirmation. It is slower and more susceptible to unconscious bias, but it produces genuine understanding of the strategy rather than just the numbers.
Automated backtesting uses software to apply rules mechanically across thousands of trades in minutes. It produces larger sample sizes and detailed statistics quickly, and is better for purely mechanical strategies where every rule can be coded precisely. It cannot capture strategies that require contextual judgement. Many traders use manual testing first to understand the strategy and then automated testing to validate at scale.
Forward test before going live
A profitable backtest is not a licence to trade live with real money. Take the exact same rules, trade them on a demo account in real-time market conditions for two to four weeks, and measure the same five metrics. Some degradation from backtest to forward test is normal. A 2 to 5 percentage point drop in win rate is within the acceptable range. A 10 to 20% decline in profit factor is expected. A forward test profit factor below 1.0 means the strategy is not viable under live conditions.
Backtesting is about confidence
Backtesting does more than evaluate a strategy. It builds evidence-based confidence. When a strategy has been applied across hundreds of historical trades and the metrics are known, a 7-trade losing streak in live trading is not a crisis. It is a known part of the strategy's behaviour, within the historical range, and not a reason to abandon the rules. Traders who have not backtested have no reference point. Every losing streak feels like the strategy is broken, because they have no data telling them otherwise.
Example
The following metrics represent what a sound backtest result looks like in practice, based on confirmed industry standards from multiple 2026 sources.
|
Metric |
Strong result |
Marginal result |
Stop and redesign |
|
Sample size |
180 trades, 18 months |
60 trades, 6 months |
Under 30 trades |
|
Win rate |
46% |
38% |
Below breakeven for the ratio |
|
Profit factor |
1.58 |
1.18 |
Below 1.0 |
|
Expectancy |
+0.28R per trade |
+0.05R per trade |
Negative |
|
Max drawdown |
11% |
24% |
Above 30% |
|
Max consecutive losses |
7 |
11 |
Unknown (stopped early) |
The strong result column reflects the Tradezella example of an EMA-based strategy across 180 trades. That profile, positive expectancy, profit factor above 1.5, and a maximum drawdown the trader can survive, is the minimum standard before forward testing begins.
A marginal result with plus 0.05R expectancy and a 24% maximum drawdown is technically profitable but sits on a thin edge. One bad month could push it negative. The negative column tells you when to stop and redesign rather than continue wasting time on a strategy with no demonstrable edge.
Why It Matters
Backtesting converts a trading idea into a decision supported by evidence. Without it, every trade is an experiment at the cost of real capital. With a proper backtest, the win rate, expectancy, and drawdown are known. The longest losing streak is known. The strategy has been tested across trending and ranging conditions. That information changes every subsequent decision, from how large to size positions to when to be concerned about live performance.
Backtesting also reveals which market conditions the strategy works in and which it does not. Knowing that the strategy underperforms in ranges allows the trader to reduce activity or stay out during obvious consolidation. That conditional discipline is what separates professional from amateur decision-making. For the risk framework within which any backtested strategy must operate, read Risk Management alongside this topic.
Example
|
Mistake |
Why it matters |
|
|
Mistake 1 |
Adjusting the rules to improve the backtest results |
Changing the moving average length from 50 to 47 because 47 produces a higher win rate in the test is overfitting. The rules are now fitted to the historical data, not derived from a logical strategy principle. Overfitted strategies typically fail in live conditions because they were optimised for the past, not built for the future. |
|
Mistake 2 |
Using too small a sample |
A 20-trade backtest showing a 70% win rate is statistically meaningless. Seven winning trades in a row happens by chance at normal win rates. Statistical confidence in a strategy's edge requires at least 100 trades across at least one to two years of varied market conditions. |
|
Mistake 3 |
Not including trading costs |
Spread, slippage, and swap costs reduce the profit on every trade. A strategy with positive expectancy before costs may have negative expectancy after them. Include a realistic spread cost for the pair being tested and subtract it from every trade result. If the strategy is not profitable after costs, it is not viable. |
Quick Summary
- Backtesting applies written strategy rules to historical price data to measure performance across a meaningful sample. The output is five metrics: win rate, expectancy, profit factor, maximum drawdown, and maximum consecutive losses. Those metrics determine whether the strategy is ready to test further.
- A minimum of 100 trades across one to two years of varied market conditions is required before the results are statistically meaningful. A profitable backtest requires forward testing on a demo account before real capital is involved, with an expected 15 to 20% degradation in key metrics.
- A strategy should earn confidence through evidence, not assumptions. Overfitting, small samples, and ignoring costs are the three errors that make a backtest misleading. Avoiding them produces a result that actually predicts live performance.
Next Steps
You now have the framework for verifying whether a strategy has an edge. The next step is making that strategy consistently executable in real time.
[Trade checklist] - Learn how to build a pre-trade checklist that applies the strategy's written rules at the moment of entry, reducing emotional deviation and keeping the live trading record consistent with the backtest.
[Risk Management] - Revisit the full framework for protecting capital, and see how backtesting results connect to position sizing, drawdown limits, and account-level risk control.
Take Action
Take one strategy from this series, write down the full rules for entry, stop, target, and position size, and apply them to the last 12 months of daily chart data on EUR/USD. For every trade, record the entry price, stop loss, take profit, risk to reward ratio, profit or loss in R, and any notes about the setup. After 50 trades, calculate the five metrics in the table in Section 3 and compare against the reference thresholds. If the metrics are marginal, adjust one rule at a time and retest from the beginning. A strategy should earn your confidence through evidence, not assumptions. Practice your strategy on a demo account after backtesting and before committing real money.