The Complete Guide to Backtesting Trading Strategies (With Real Data From 64 Tests)

How to Backtest a Trading Strategy Complete Guide

This how to backtest a trading strategy guide is built on real backtest data. Disclaimer: The information on quant-signals.com is for educational purposes only. It does not constitute financial advice. Backtest results are hypothetical and based on historical data. They do not account for slippage, commissions, spreads, or execution delays. Past performance does not guarantee future results. Trading involves significant risk of loss. Please read our full Disclaimer.

Learning how to backtest a trading strategy is the difference between guessing and knowing. Most backtesting guides tell you what backtesting is. This one shows you what real backtests actually look like.

In the context of how to backtest a trading strategy, we ran 64 backtests across 7 strategies, 6 assets, and 2 timeframes using nearly 100,000 candles of historical data. Only 48% produced positive expectancy. The rest lost money.

In the context of how to backtest a trading strategy, that single statistic should change how you think about trading strategies forever. Half of all reasonable strategy-asset-timeframe combinations we tested — using well-known, widely taught strategies — failed to produce a positive edge.

In the context of how to backtest a trading strategy, our most reliable positive result: the EMA Crossover (9/21) on BTCUSD D1, with 88 trades, a profit factor of 1.59, and a Sharpe ratio of 3.49. Our most spectacular failure: the London Breakout on GBPUSD, with a 133% maximum drawdown that would have destroyed any account.

In the context of how to backtest a trading strategy, in this guide, you’ll learn the complete backtesting process step by step, illustrated with real data from our tests. No theory. No hypotheticals. Just numbers.


What Is Backtesting and Why Does It Matter?

Backtesting is the process of testing a trading strategy against historical market data to evaluate how it would have performed. You define your entry rules, exit rules, and risk parameters, then simulate those rules across past price data to measure the results.

In the context of how to backtest a trading strategy, why does it matter? Because without backtesting, you’re guessing.

Using the how to backtest a trading strategy approach, take the RSI Mean Reversion strategy — one of the most commonly taught approaches in forex trading. Buy when RSI drops below 30, sell when it rises above 70. Sounds logical. Every trading website recommends it.

Using the how to backtest a trading strategy approach, we tested it across 6 assets on both H1 and D1 timeframes. The result? Negative expectancy on every single combination. All 12 of them. The RSI Mean Reversion without filters showed no demonstrated edge in any market we tested — a universally negative result across 2,397 total trades.

Using the how to backtest a trading strategy approach, a trader following this strategy without backtesting would slowly bleed their account dry.

Using the how to backtest a trading strategy approach, but here’s where it gets interesting: when we added two simple filters (a trend filter and a volatility regime filter), the same RSI logic went from negative expectancy to a profit factor of 3.00 on Gold — though with a small sample of only 10 trades that needs further validation.

Using the how to backtest a trading strategy approach, that transformation is only possible through systematic backtesting. Let’s walk through exactly how to do it.


How to Backtest a Trading Strategy: Our Methodology

Before we dive into the process, here’s what we used for our 64 backtests so you can understand the scope and limitations:

Data:

  • 99,028 candles from 6 assets: EURUSD, GBPUSD, XAUUSD (Gold), NAS100 (Nasdaq), BTCUSD (Bitcoin), ETHUSD (Ethereum)
  • Timeframes: H1 (1-hour) and D1 (Daily)
  • Period: 2020–2025
  • Source: Historical OHLCV data from established market data providers

Indicators pre-calculated:

  • RSI (14), ATR (14), EMA (9, 21, 50, 200), Bollinger Bands (20, 2), ADX (14)

Metrics tracked:

  • Win Rate, Profit Factor, Sharpe Ratio, Maximum Drawdown, Expectancy, Average Win, Average Loss

Strategies tested (7 total):

  1. RSI Mean Reversion (classic)
  2. RSI Mean Reversion + EMA200/ADX Filters
  3. EMA Crossover (9/21)
  4. EMA Swing (21/50) with trend filter
  5. London Breakout (classic)
  6. London Breakout v2 (refined)
  7. Bollinger Band Squeeze Breakout

Important limitations: These are hypothetical backtests. They do not account for slippage, commissions, spreads, or execution delays. Real-world trading results may differ materially. Results with fewer than 20 trades should be considered suggestive rather than statistically significant. The strategies presented are for educational purposes — not trading recommendations.


Step 1: Define Clear Entry and Exit Rules

The first rule of backtesting: if you can’t write your strategy rules on a napkin, they’re not clear enough.

Every backtest requires unambiguous rules for:

  • Entry signal: What exact condition triggers a trade?
  • Direction: Long, short, or both?
  • Stop loss: Where do you exit if the trade goes wrong?
  • Take profit: Where do you exit if the trade goes right?
  • Position sizing: How much do you risk per trade?

Here’s an example from our EMA Crossover strategy — the most reliable performer in our dataset:

  • Entry (Long): EMA(9) crosses above EMA(21)
  • Entry (Short): EMA(9) crosses below EMA(21)
  • Stop Loss: 1.5 × ATR(14) from entry price
  • Take Profit: 2.0 × stop loss distance (1:2 risk-reward)
  • Risk per trade: 1% of account

Notice the specificity. There’s no room for interpretation. This is what makes a backtest reproducible — and what separates quantitative analysis from wishful thinking.


Step 2: Choose Your Data and Timeframe

Your choice of timeframe dramatically changes backtest results. This isn’t a minor detail — it’s one of the most important decisions you’ll make.

Here’s what our data shows across all 64 backtests:

H1 (1-Hour) vs D1 (Daily) — Aggregate Performance:

Metric H1 D1
Average Expectancy -0.013R +0.099R
Positive expectancy rate 16 of 36 (44%) 15 of 28 (54%)

This finding is robust — it held across almost every strategy we tested. The daily timeframe outperformed the hourly timeframe consistently.

Why? H1 data contains more noise — random price fluctuations that generate false signals. D1 candles smooth out that noise and capture more meaningful price movements. When a moving average crossover happens on a daily chart, it typically represents a genuine shift in market direction. On an hourly chart, it might just be an intraday fluctuation.

Key takeaway: If you’re backtesting a trend-following strategy, start with daily data. If you get positive results there, then test on lower timeframes. Don’t do it the other way around. This is a critical insight for anyone learning how to backtest a trading strategy: always test on multiple timeframes.


Step 3: Run the Backtest and Measure Performance

Once you have clear rules and clean data, you run the simulation and measure the results. Here are the six metrics that matter most, explained with real examples from our 64 backtests.

Win Rate

Win rate tells you what percentage of trades were profitable. It’s the most intuitive metric — and the most misleading.

Our EMA Crossover on BTCUSD D1 had a 44.3% win rate and was one of our best performers (expectancy: +0.330R per trade). Meanwhile, the EMA Swing on EURUSD H1 had only a 30.4% win rate — but still produced positive expectancy (+0.216R) because its winners were much larger than its losers (3:1 reward ratio).

Lesson: Win rate alone tells you nothing about profitability. A strategy that wins 30% of the time can be highly profitable if the average win is 3× the average loss.

Profit Factor

Profit Factor = Gross Profit ÷ Gross Loss. Anything above 1.0 means the strategy made money over the tested period.

Our most reliable strong profit factor was the EMA Crossover on BTCUSD D1: PF of 1.59 across 88 trades. This means for every $1 lost, the strategy made $1.59. Across 88 trades, this is statistically meaningful.

The EMA Swing strategy showed even higher PFs on daily timeframes (up to 2.14 on BTCUSD D1), but with smaller sample sizes of 17–24 trades — suggestive of an edge but requiring further validation.

Our worst performer, London Breakout v1 on GBPUSD, had a PF of 0.25 — meaning for every $1 lost, it only recovered $0.25.

Sharpe Ratio

The Sharpe Ratio measures risk-adjusted return. Higher is better. A Sharpe above 1.0 is considered good, above 2.0 is very good.

Our highest reliable Sharpe was 3.49 — the EMA Crossover on BTCUSD D1 with 88 trades. The EMA Swing strategies showed even higher Sharpe ratios on D1, but again with smaller sample sizes that warrant caution.

The London Breakout v1 on GBPUSD had a Sharpe of -11.47. Negative Sharpe means you’re losing money with high volatility — the worst possible combination.

Maximum Drawdown

Maximum drawdown is the largest peak-to-trough decline in your equity curve. It answers the question: “What’s the worst pain I would have experienced?”

Among our reliable results, the EMA Crossover on BTCUSD D1 had a manageable drawdown of 4.6%. The EMA Swing strategies on D1 showed drawdowns between 2.8% and 5.8% — all within reasonable limits.

The London Breakout v1 on GBPUSD had a 133.5% drawdown — meaning the strategy would have lost more than the entire starting account. This is a catastrophic result that should never be traded. We include it as cautionary data to demonstrate why backtesting matters.

Expectancy

Expectancy is the average profit or loss per trade, measured in R (risk units). It’s the single most important metric because it tells you directly whether a strategy makes money over time.

Expectancy = (Win Rate × Average Win) – (Loss Rate × Average Loss)

Our most reliable positive expectancy was the EMA Crossover on BTCUSD D1 at +0.330R per trade — meaning on average, each trade returned 0.33× the amount risked. Over 88 trades, that compounds into significant returns.

The EMA Swing strategies showed higher per-trade expectancy on D1 (up to 0.667R on BTCUSD), but with fewer trades (17–24). These results are promising and directionally consistent, but should be validated with more data before being treated as definitive.


Step 4: Compare Across Assets and Conditions

One of the biggest mistakes in backtesting is testing on a single asset and assuming the results are universal. Our data shows how dramatically results can change across assets.

Here’s the EMA Crossover (9/21) — our most extensively tested strategy — on all 6 assets:

Asset Timeframe Trades Win Rate PF Sharpe Expectancy
BTCUSD D1 88 44.3% 1.59 3.49 +0.330R
EURUSD D1 59 42.4% 1.47 2.88 +0.271R
XAUUSD H1 296 37.2% 1.18 1.26 +0.115R
ETHUSD D1 70 37.1% 1.18 1.24 +0.114R
BTCUSD H1 491 35.6% 1.11 0.76 +0.069R
NAS100 H1 320 34.4% 1.05 0.35 +0.031R
GBPUSD D1 67 34.3% 1.05 0.33 +0.030R
NAS100 D1 62 33.9% 1.02 0.18 +0.016R
XAUUSD D1 74 32.4% 0.96 -0.30 -0.027R
ETHUSD H1 488 32.4% 0.96 -0.32 -0.029R
EURUSD H1 336 32.1% 0.95 -0.40 -0.036R
GBPUSD H1 365 31.0% 0.90 -0.81 -0.071R

Same strategy, same rules, same parameters — yet BTCUSD D1 returned +0.330R per trade while GBPUSD H1 returned -0.071R. The pattern is clear: this trend-following strategy works best on assets that trend strongly (Bitcoin on daily) and worst on choppy intraday conditions (GBPUSD hourly).

Key takeaway: Always test your strategy on multiple assets. If it only works on one pair during one specific period, it’s probably curve-fitted — not genuinely profitable. Knowing how to backtest a trading strategy across multiple assets is what separates robust systems from curve-fitted ones.


Step 5: Add Filters and Optimize

Raw strategies rarely work. The magic is in the filters.

Our most dramatic example is the RSI Mean Reversion strategy. The unfiltered version — buying when RSI < 30, selling when RSI > 70 — produced negative expectancy across all 12 tested combinations. It’s a universally failing strategy without context.

We then added two filters:

Filter 1: EMA(200) Trend Filter — Only buy when price is above EMA(200) (uptrend), only sell when below (downtrend). This ensures you’re trading with the trend.

Filter 2: ADX(14) < 25 — Only trade when ADX indicates a ranging market. Mean reversion works in ranges, not trends.

RSI on EURUSD H1 — Before vs After:

Version Trades Win Rate PF Expectancy
Without filters 268 33.2% 0.99 -0.004R
With filters 10 50.0% 2.00 +0.500R

RSI on XAUUSD (Gold) H1 — Before vs After:

Version Trades Win Rate PF Expectancy
Without filters 261 33.0% 0.98 -0.012R
With filters 10 60.0% 3.00 +0.800R

The improvement is dramatic — but an important caveat: the filtered version produced only 10 trades on each asset. This is a promising signal, not a statistically proven edge. The direction is consistent (improvement on every asset where enough signals occurred), but more data is needed to confirm reliability.

The strategy-asset fit analysis also makes logical sense: Gold (XAUUSD) is known for strong mean-reverting behavior within trends due to its safe-haven dynamics. RSI pullback entries on Gold, filtered to only ranging conditions within an established trend, align with how this asset actually behaves.

A critical warning about optimization: It’s easy to over-optimize. If you keep adding filters until a strategy looks perfect on historical data, you’ve likely created something that only works on that specific dataset. This is called curve-fitting. Our approach was intentionally simple: only two well-established filters with clear logical justification. We did not optimize parameters to maximize results.


Which Strategy Type Wins?

We tested three categories of strategies. Here’s how they compared in aggregate:

Strategy Type Avg Expectancy Strategies with Edge Win Rate
Trend Following (EMA variants) +0.198R 18 of 24 (75%) Highest
Mean Reversion (RSI variants) -0.023R 6 of 22 (27%) Lowest
Breakout (London + Bollinger) -0.107R 7 of 18 (39%) Middle

Trend following dominated. 75% of all trend-following backtests produced positive expectancy. The EMA variants — both the faster 9/21 crossover and the slower 21/50 swing version — consistently found edges, especially on D1 timeframes.

Mean reversion was the most inconsistent. Without filters, RSI-based strategies showed no edge in any market. With filters, the results improved dramatically on select assets (particularly Gold), but sample sizes remain small.

Breakout strategies had the worst aggregate performance. The London Breakout — despite being one of the most popular retail trading strategies — produced negative expectancy in every single test, across both the original and refined versions. This is one of the strongest findings in our dataset: a widely-taught strategy with zero demonstrated edge across 695 total trades.


Common Backtesting Mistakes

Learning how to backtest a trading strategy also means learning what NOT to do. Here are the pitfalls to avoid:

1. Testing on one asset only. Our data shows the same strategy can be profitable on BTCUSD and unprofitable on GBPUSD. Single-asset tests prove nothing.

2. Ignoring the timeframe effect. D1 outperformed H1 across almost every strategy. If you only test on H1, you might discard a strategy that works brilliantly on D1.

3. Not tracking the right metrics. Win rate is seductive but misleading. Focus on expectancy and profit factor instead.

4. Over-optimizing on historical data. If your strategy has 15 parameters fine-tuned to historical data, it won’t survive real markets. Simpler strategies with 2-3 parameters are more robust.

5. Ignoring sample size. A strategy that shows 100% win rate over 2 trades tells you nothing. We found 4 backtests in our dataset with fewer than 5 trades — all of which produced eye-catching but statistically meaningless results. Aim for 50+ trades minimum for any conclusion you want to rely on.

6. Ignoring drawdown. A strategy with 80% annual returns and 60% drawdown will likely cause you to quit before the returns materialize. Our London Breakout showed drawdowns exceeding 100% — a theoretical wipeout.

7. Assuming past results predict future results. Our backtests cover 2020-2025 — a period that included a pandemic recovery, a crypto bubble and crash, aggressive rate hikes, and geopolitical instability. Future market conditions may be entirely different.

Understanding how to backtest a trading strategy means knowing not just the process, but also what can go wrong. These mistakes are the most common reasons backtests fail to translate into real trading results.


FAQ

How many trades do I need for a reliable backtest? At minimum, 30 trades for any directional conclusion. We consider 50+ trades as the threshold for statistical reliability. In our dataset, we explicitly flagged 4 backtests with fewer than 5 trades as unreliable, and 17 backtests with 5–49 trades as requiring caveats. The most trustworthy results came from combinations with 50+ trades — 43 of our 64 backtests met this threshold.

What is a good profit factor? Above 1.0 means profitable. Above 1.3 suggests a viable edge. Above 1.5 is strong. Our most reliable PF was 1.59 (EMA Crossover on BTCUSD D1 with 88 trades).

Does backtesting really work? Backtesting tells you whether a strategy had an edge in the past. It doesn’t guarantee future results. But a strategy that has never worked historically has almost zero chance of working going forward. Our London Breakout data — negative across all 695 trades — is a clear example of a strategy that should be avoided regardless of how many trading blogs recommend it.

What timeframe is best for backtesting? Our data strongly favors D1 (daily) for most strategies, especially trend following. The average expectancy on D1 was +0.099R (positive) versus -0.013R on H1 (negative). This held across strategy types. Start with daily data.

Is backtesting on TradingView accurate? TradingView’s Strategy Tester is a good starting point for basic backtests. For more sophisticated analysis — multiple assets, custom metrics, filter combinations — programmatic backtesting (Python, for example) offers more flexibility and control. Our 64 backtests were run programmatically to ensure consistency across all combinations.


What’s Next?

Now you know how to backtest a trading strategy from start to finish — with real data showing what works and what doesn’t. Dive into the specific strategies below.


All data on this page is based on hypothetical backtests conducted on EURUSD, GBPUSD, XAUUSD, NAS100, BTCUSD, and ETHUSD using H1 and D1 data from 2020-2025 (99,028 candles total). Results do not account for slippage, commissions, or execution delays. Results with fewer than 20 trades should be considered suggestive rather than statistically significant. Past performance does not guarantee future results. This content is for educational purposes only and does not constitute financial advice. See our full Disclaimer for details.

📊 Quant Signals Weekly

Free weekly digest: backtested strategies, new data, and actionable trading insights. No fluff, just numbers.


Subscribe Free →

Join 0+ traders. Unsubscribe anytime.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top