FUNDED Trading

Process and Psychology

Backtesting a strategy

How to test a trading rule set against historical data properly, and how to avoid the common statistical traps that make a backtest lie to you.

40 min read

Ask FUNDED AI about this lesson Not started

You have not opened this lesson yet.

What you will be able to do

  • Explain the purpose and limits of backtesting a trading strategy
  • Identify look-ahead bias, survivorship bias and overfitting in a backtest
  • Calculate the sample size needed before trusting backtest results
  • Use the platform's /backtesting tool to test a defined rule set on historical data
  • Interpret a backtest's equity curve and drawdown statistics correctly

01What backtesting is for, and what it is not for

Backtesting is the process of applying a precisely defined set of trading rules to historical market data to see how the strategy would have performed. Its core purpose is to reject bad ideas cheaply, before they cost real money, and to give a rough, honest estimate of a strategy's statistical properties — win rate, average reward-to-risk, drawdown profile — before it is traded live. This is valuable and important, and any strategy that has not been tested in some form before being used with real or funded capital should be treated as an unverified hypothesis, not a plan.

What backtesting cannot do is guarantee future performance, account for your own execution discipline, or fully capture real-world frictions like slippage, variable spread, and the psychological difficulty of holding a losing position. A backtest that shows an 80% win rate will not protect you from the very real difficulty of sitting through the 20% of trades that lose, particularly if several of them cluster together. Backtesting answers the question 'does this rule set have a statistical edge in this historical data', not the question 'will I successfully execute this strategy'.

The most productive mindset for backtesting is scientific: you are trying to disprove your own idea as efficiently as possible, using the most rigorous test you can construct, rather than trying to find a version of the test that makes the idea look good. This distinction — testing to find the truth versus testing to confirm a belief — is what separates useful backtesting from a waste of time.

02Defining rules precisely enough to test

Backtesting requires exactly the same precision discussed in the trading-plan lesson: every entry condition, exit condition, and sizing rule must be specific enough to apply mechanically to a chart without judgement calls. This is often the point where a trader discovers that their 'strategy' was never actually fully defined — clauses like 'if it looks strong' or 'use discretion near support' cannot be backtested at all, because they require a human judgement that a backtest cannot replicate.

The discipline of writing rules precise enough to backtest is valuable even independent of the backtest result, because it forces the same clarity that a good trading plan requires. If you cannot define your strategy precisely enough to test it, you also cannot define it precisely enough to execute consistently under pressure, and this alone is often the single biggest realisation a new trader has when they attempt their first serious backtest.

03The classic traps: look-ahead bias, overfitting, and survivorship bias

Look-ahead bias occurs when a backtest accidentally uses information that would not have been available at the time of the trade — for example, using a daily candle's closing price to decide an entry that would supposedly have happened during that same day, before the close was known. This inflates results artificially and is one of the most common errors in manually constructed backtests, particularly when working from a static chart rather than a bar-by-bar replay.

Overfitting occurs when rules are adjusted repeatedly to maximise performance on a specific historical dataset, adding more and more specific conditions until the strategy performs beautifully on that data but has effectively memorised its noise rather than captured a real, repeatable pattern. A telltale sign of overfitting is a strategy with many highly specific numerical parameters (for example, a moving average of exactly 37 periods combined with an RSI threshold of exactly 61.5) that were tuned to fit one particular data set; such parameters rarely hold up on new, unseen data. The correct discipline is to test on one period of data, fix the rules, and then validate on a separate, later period the rules were never adjusted against — commonly called out-of-sample testing.

Survivorship bias is less relevant to short-term intraday forex or index strategies but matters greatly for anyone backtesting on individual stocks or baskets of instruments over long periods, since a dataset that only includes currently-listed companies silently excludes the companies that failed or were delisted, inflating historical returns. Even in forex, a related issue arises if a strategy is only tested on the small set of pairs that happened to work well over the test period, rather than tested consistently across a pre-decided universe of instruments.

04Sample size and statistical honesty

A backtest with 15 trades tells you almost nothing reliable, no matter how good the results look, because the sample is too small to distinguish a real edge from luck. As a rough guide, most practitioners want at least 100 trades, and ideally several hundred, spanning multiple different market conditions (trending, ranging, high volatility, low volatility) before placing meaningful confidence in the statistics. A strategy that performed brilliantly during a single strong trending month but has never been tested during a ranging period has not really been tested at all.

It is also worth explicitly calculating the strategy's expectancy — the average result per trade, in units of risk, calculated as (win rate × average win) minus (loss rate × average loss). A strategy can have a low win rate and still be strongly profitable if its average win is large relative to its average loss, and conversely a high win rate can still be unprofitable if occasional losses are large relative to typical wins. Looking at win rate alone, without expectancy, is one of the most common misreadings of a backtest.

05Reading the equity curve and drawdown honestly

A backtest's equity curve — the running total of account value over the test period — tells you more than the final return figure alone. A smooth, steadily rising curve suggests a robust edge; a curve with one enormous winning trade responsible for most of the total return is fragile, because removing or missing that single trade (which is entirely plausible in live trading, given slippage or a missed entry) would change the entire performance picture. Always check what the results look like with the single best trade excluded.

Maximum drawdown — the largest peak-to-trough decline in the equity curve — deserves as much attention as total return, because it tells you what psychological and account-survival pressure the strategy would have put you under during its worst historical period. A strategy with an attractive total return but a 35% historical maximum drawdown is not compatible with most funded account rules and would also be extremely difficult to sit through emotionally, even if eventually profitable. The platform's /backtesting tool reports both total return and maximum drawdown together for exactly this reason — never evaluate one without the other.

Worked example

Catching look-ahead bias in a manual backtest

A trader manually reviewing daily charts believes they have found a reliable pattern: 'when the daily candle closes above the 20-day moving average after being below it, price rises over the next five days.'

  1. 1

    Initial test

    Scanning historical daily charts by eye, the trader marks every instance where this appeared to happen and records an apparently strong 68% success rate.

  2. 2

    Problem identified

    On closer inspection, several 'entries' were identified using the same day's closing price as both the entry trigger and the reference point, meaning the trade could not actually have been entered until the following day's open.

  3. 3

    Corrected test

    Re-running the test using /backtesting with entries executed at the next bar's open rather than the signal bar's close removes the look-ahead advantage.

  4. 4

    Result

    The corrected success rate drops to 54%, still potentially useful but a materially different, more honest number.

Outcome: The strategy still has some merit but the originally reported edge was significantly inflated by an unrealistic entry assumption.

Why it matters: Manual chart review is highly prone to look-ahead bias because the reviewer already knows what happened next. A proper backtest tool that enforces bar-by-bar sequencing removes this specific source of error.

Worked example

Detecting overfitting through out-of-sample testing

A trader develops a strategy on two years of EURUSD 15-minute data, tuning a moving-average length and an RSI threshold until the in-sample backtest shows an exceptional 2.8 expectancy.

  1. 1

    In-sample result

    On the original two years of data, the tuned parameters (a 43-period moving average and an RSI threshold of 58) produce excellent results.

  2. 2

    Out-of-sample test

    The exact same rules, unchanged, are applied to the following six months of data that were never used during development.

  3. 3

    Result comparison

    Out-of-sample expectancy drops to 0.3, and the win rate falls from 61% to 44%.

  4. 4

    Diagnosis

    The highly specific parameter values were fitted to noise in the original dataset rather than capturing a real, repeatable pattern.

Outcome: The trader abandons the overfitted version and instead tests simpler, rounder parameter values (a 40-period moving average, no RSI filter) which perform more consistently across both periods, albeit with a lower peak in-sample result.

Why it matters: A strategy that performs dramatically better with very specific, finely tuned parameters than with simple, round ones is a strong warning sign of overfitting. Always validate on data the rules were never adjusted against.

Common mistakes

  • Backtesting rules that are not precisely defined enough to apply mechanically
  • Using closing prices or other information not actually available at the time of the simulated trade (look-ahead bias)
  • Tuning parameters repeatedly on the same dataset until results look excellent (overfitting)
  • Drawing conclusions from fewer than 100 trades or from a single type of market condition
  • Evaluating a strategy on total return alone without checking maximum drawdown
  • Not checking whether results depend heavily on one or two outsized winning trades
  • Never validating on out-of-sample data the rules were not tuned against

Do this before moving on

  • Every rule in the strategy is specific enough to apply without judgement calls
  • Backtest entries respect bar sequencing with no look-ahead information used
  • At least 100 trades tested across multiple market conditions
  • Expectancy calculated, not just win rate
  • Maximum drawdown reviewed alongside total return
  • Results checked with the single best trade excluded
  • Rules validated on a separate out-of-sample period never used for tuning

Key takeaways

  • 01Backtesting exists to reject bad ideas cheaply and estimate statistical properties, not to guarantee future results
  • 02Rules must be precise enough to apply mechanically before they can be honestly backtested
  • 03Look-ahead bias and overfitting are the two most common ways a backtest can mislead you
  • 04Sample size matters — fewer than 100 trades across varied conditions is not a reliable test
  • 05Always evaluate expectancy and maximum drawdown together, not total return in isolation

Assignment

Take one setup from your written trading plan and run it through /backtesting over at least 150 historical instances split into an in-sample development period and a separate out-of-sample validation period. Report expectancy, win rate and maximum drawdown for both periods.

Check your understanding

0/3 answered

1. What does look-ahead bias do to a backtest's results?

2. Why is out-of-sample testing important after tuning strategy parameters?

3. Why should maximum drawdown be reviewed alongside total return?

Glossary

Look-ahead bias
An error where a backtest uses information that would not actually have been available at the simulated time of the trade.
Overfitting
Tuning strategy parameters so closely to one historical dataset that they capture random noise rather than a repeatable pattern.
Out-of-sample testing
Validating a strategy's rules on data that was not used during development or parameter tuning.
Expectancy
The average result per trade in units of risk, combining win rate and average win/loss size into a single figure.
Maximum drawdown
The largest peak-to-trough decline in an equity curve over the tested period.

Trading carries substantial risk of loss. Nothing here guarantees profitability or a funded account.