Lesson 7.5

Backtesting and Forward Testing

Important: every trade in this lesson is a clearly labelled hypothetical scenario created for education. Prices are illustrative, not real-time or historical market data, and no trade was executed live. Nothing here is a signal or recommendation.

Introduction

Before trusting a strategy with real money, you need evidence. Backtesting applies rules to historical data; forward testing applies them in real time on demo or very small live size. Both have limitations. This lesson explains how to run each correctly and interpret the results.

Learning objectives

By the end of this lesson you will be able to:

  • Define precise, testable rules before testing.
  • Run a manual backtest and a Strategy Tester backtest in MT4/MT5.
  • Calculate win rate, expectancy, profit factor and maximum drawdown.
  • Explain overfitting, look-ahead bias and sample-size problems.
  • Design a forward test and compare it with backtest results.

Watch the Full Video Lesson

  1. Forex Backtesting And Strategy Optimisation.mp4
    Sign in free to track watched videos
Step 1: Define rules first

Write every rule before looking at the data: pair, timeframe, entry trigger, stop, target, management, risk per trade, trading hours and news filter. Changing rules during testing invalidates results.

Step 2: Manual backtest

1. Open a chart and scroll back (e.g. one year). 2. Use F12 (MT4) to move forward candle by candle so future prices are hidden. 3. Record every valid setup in a spreadsheet: date, entry, stop, target, result in R. 4. Aim for at least 50–100 trades.

Step 3: Hypothetical backtest results

80 trades: 34 wins averaging +1.9R; 46 losses averaging −1.0R.

  • Win rate = 34 ÷ 80 = 42.5%
  • Gross profit = 34 × 1.9 = 64.6R; gross loss = 46R
  • Net = +18.6R; expectancy = 18.6 ÷ 80 = +0.2325R
  • Profit factor = 64.6 ÷ 46 ≈ 1.40
  • Maximum drawdown (from equity curve): −7R

At 1% risk on a $10,000 account ($100 = 1R): net ≈ +$1,860 before costs; maximum drawdown ≈ $700. GBP £5,000 account at 1% (£50 = 1R): net ≈ +£930; maximum drawdown ≈ £350.

After costs: if each trade costs 0.08R, total = 80 × 0.08 = 6.4R → net +12.2R; expectancy +0.1525R.

Step 4: Biases and limitations
  • Overfitting: tuning rules to fit past data perfectly.
  • Look-ahead bias: using information that would not have been available at the time.
  • Survivorship and selection bias: testing only favourable periods.
  • Small samples: 20 trades can easily mislead.
  • Execution differences: spreads, slippage and fills in real time differ from history.
Step 5: Forward test

Run the unchanged rules on demo for at least 1–3 months or 30–50 trades.

Hypothetical forward test: 40 trades, 16 wins at +1.8R, 24 losses at −1.0R.

  • Win rate 40%; net = 28.8 − 24 = +4.8R; expectancy +0.12R
  • Lower than the backtest (+0.15R after costs) but still positive — a common pattern.

If forward results are much worse than the backtest, investigate: rule ambiguity, execution, changing conditions or overfitting.

Key terminology
  • Backtest / forward test: historical / real-time testing.
  • Profit factor: gross profit ÷ gross loss.
  • Equity curve: cumulative results over time.
  • Out-of-sample data: data not used to develop the rules.
  • Look-ahead bias: accidental use of future information.
MT4/MT5 demonstration

For EAs: View → Strategy Tester (Ctrl+R), choose the EA, symbol, period, modelling quality (Every tick / Every tick based on real ticks in MT5) and spread. Review the Graph and Report tabs for profit factor and drawdown. Use Visual mode to watch trades. For manual testing in MT4, press F12 to step forward one bar.

Common beginner mistakes
  • Testing too few trades.
  • Changing rules after seeing results.
  • Ignoring costs.
  • Going live straight after a good backtest without forward testing.
Risk-management guidance

Only consider live trading after a positive backtest and forward test, with costs included, a drawdown you can tolerate and the smallest practical size. Expect live results to be worse than tests.

Practical student exercise

Manually backtest 50 trades of one strategy, calculate win rate, expectancy, profit factor and max drawdown, then forward test it on demo for 20 trades and compare.

Summary

Backtesting provides a historical estimate; forward testing checks real-time behaviour. Define rules first, include costs, use adequate samples, watch for biases, and treat all test results as evidence — never guarantees.

Your lesson activity

Sign in free to save your learning progress.

Loading quiz…

Related lessons in Module 7