FairValueFX

Learning path › Step 8: Practice and tools

Have you found your strategy? — Backtesting

What is backtesting?

Backtesting is the process of testing a trading strategy against historical price data, to see how it would have performed if you had traded it consistently in the past. It is the step that comes before demo trading (see Demo account) — and one many new traders skip completely, often to their own cost.

Where demo trading tests your strategy in real time, going forward (called forward testing), backtesting tests it backwards, on data that has already happened. Both are necessary, but they answer different questions.

Why backtest before going to demo?

Without backtesting you risk spending months demo trading a strategy that never had a real statistical edge to begin with. Backtesting lets you quickly try an idea against hundreds of historical examples — something that would take months or years to experience in real time.

Think of it as the difference between reading the weather for the last 5 years before you plan a trip, versus only being able to see what the weather is right now.

How to backtest a strategy

1. Define the strategy precisely BEFORE you start

Write your rules down: which setup triggers an entry (e.g. FVG + BOS in the direction of the bias), where the stop loss and take profit go, which timeframe, which pairs, which sessions. Without precise, objective rules you can't test consistently — you end up "seeing" setups that fit the outcome you already know happened (see look-ahead bias below).

2. Go back in the history on your platform

  • TradingView: Use the "Bar Replay" feature, which lets you rewind the chart to any point and then play the price history candle by candle, as if it were happening live
  • MT4/MT5: Has a built-in Strategy Tester, mainly relevant if you have an EA (an automated strategy) — see Trading platforms

3. Go candle by candle — without knowing the future

This is the most important (and hardest) part of manual backtesting: you must base your decision only on the information that was available at that moment, not on what you already know happened afterwards. Bar Replay features are designed for exactly this.

4. Log every test trade as a real trade

Use the same principle as in your trading journal — note the setup, entry, stop, target, result and R-multiple for each historical test trade. Without systematic logging, backtesting is just "looking at a chart", not real data.

5. Test on enough examples

As with demo trading (see Demo account), 5-10 examples are not enough to conclude anything at all. Aim for at least 50-100 historical examples of your setup, ideally spread over different market conditions (trending, sideways, high/low volatility).

Common backtesting pitfalls

Pitfall Description
Look-ahead bias Using (consciously or not) information you wouldn't really have had at the time of entry — e.g. "seeing" a perfect setup because you already know price rose afterwards
Overfitting (curve fitting) Adjusting the rules so many times that the strategy fits the historical period you tested perfectly — but loses the ability to work on new, unknown data
Too small a data set Concluding from 10-15 examples, which statistically can be pure chance
Ignoring costs Forgetting spread, commission and possibly slippage when calculating the result — this can make an apparently profitable strategy actually lose money
Only testing in "easy" periods Choosing a historical period with a clear, stable trend and not testing in sideways or chaotic periods where the strategy may fail
Lack of consistency Changing the rules during the test — so you are really testing several different strategies, not ONE

Overfitting — the sneakiest pitfall

Overfitting deserves special attention because it is hard to spot in itself. If you adjust your strategy again and again until it gets a great result on exactly the data set you are testing on, you haven't found a robust strategy — you have found a set of rules that happened to fit the past perfectly.

Signs of overfitting: - Your strategy has very specific, complex rules (e.g. "only if the RSI is exactly between 42 and 47, AND it is Tuesday, AND...") - The result looks "too good to be true" - The strategy performs much worse as soon as you test it on a period you didn't use to develop it (see out-of-sample testing below)

The antidote: Always test your final strategy on data you did not use to develop or adjust it (called out-of-sample testing). For example, develop the rules on 2023 data and then test them "blind" on 2024 data you haven't looked at yet.

Backtesting is not enough on its own

Even a thorough backtest is no guarantee — it tells you whether the strategy historically had an edge, not whether it will necessarily work going forward, and certainly not whether you can execute it with discipline when real money is at stake (see Psychology). That is why the order matters:

  1. Backtest — confirm that the strategy historically had a statistical edge
  2. Demo (forward test) — confirm that you can identify and execute the setup in real time, without knowing the future
  3. Small, real account — confirm that you can follow the strategy when real money (and real emotions) are involved

Don't skip a step, however well a previous step went.

Summary

Backtesting is the fastest and cheapest way to check whether a strategy has a real, statistical edge at all — before you spend months testing it in real time. But it has to be done systematically, honestly (without look-ahead bias), on a large enough data set, and then validated on new, untested data to avoid overfitting. Backtesting doesn't replace demo trading or psychological preparation — it is the first step in a three-step process.


See also: Demo account · Trading journal · Trading platforms