Back to Trading Styles & Strategy Development

Trading Styles & Strategy Development · Pro · 4 min

Robustness: walk-forward and Monte Carlo

You can explain how walk-forward analysis and a Monte Carlo reshuffle of trades test a rule set's robustness, and use the results to plan for worse drawdowns.

One story, many versions

A backtest tells one story: these rules, on this data, in this order, produced this result. It is easy to forget how much of that story is accident.

Slightly different data might have led to different settings. The same trades in a different order might have produced a much deeper drawdown. Two robustness tests look at exactly these questions, and they often change how much risk a trader is willing to take.

Optimize, test, roll forward

Walk-forward analysis repeats the out-of-sample test many times:

Steps Walk-forward analysis: optimize the rules on one window of history, test them on the following window, roll both windows forward and repeat, then join all the test windows into one result. 1 Optimize window 1 2 Test window 2 3 Roll forward 4 Join test results
  1. Optimize the rules on a window of history, for example two years.
  2. Test the chosen settings on the following window, for example six months, without changing anything.
  3. Move both windows forward by six months and repeat.
  4. Join all the test windows into one result.

Every test window is unseen data for the optimization before it. The joined result shows how the whole method, including its optimization, performs on new data, period after period. If the joined result is poor while each optimization looked great, the method fits noise. MetaTrader 5's forward option performs a single step of this idea.

Same trades, deeper drawdowns

A Monte Carlo simulation uses random repetition to explore what else could have happened. A simple version reshuffles the order of the backtest trades thousands of times and records the drawdown each time.

Sixty fictional trades, 24 wins of 2R and 36 losses of 1R, at 1% risk per trade:

Value bars The same 60 fictional trades at 1% risk, 24 wins of 2R and 36 losses of 1R: in their backtest order the maximum drawdown is 3.0%. Across 10,000 random reorderings, the median maximum drawdown is 7.8%, the worst 5% start at 11.6% and the single worst ordering reaches 19.1%. MAX DRAWDOWN, SAME 60 TRADES Backtest order 3.0% Median reshuffle 7.8% Worst 5% from 11.6% Worst of 10,000 19.1%

The trades and the expectancy are identical in every case. Only the order changed. A plan built on the 3.0% would be unprepared for a perfectly ordinary bad run.

Common mistakes

The takeaway

Walk-forward analysis re-tests rules on data they never saw, again and again. Monte Carlo reshuffles trades to show how bad the drawdown could get.

Check yourself

Quick quiz

4 questions. Instant feedback, nothing is saved.

  1. 1Tap the drawdown that a typical reordering of the same trades produces.

    Tap the chart.

    Value bars Chart for the question: Tap the drawdown that a typical reordering of the same trades produces. MAX DRAWDOWN, SAME 60 TRADES Backtest order 3.0% Median reshuffle 7.8% Worst 5% from 11.6% Worst of 10,000 19.1%

    Half of all reorderings produced a maximum drawdown above 7.8%, more than twice the backtest's 3.0%.

  2. 2What does walk-forward analysis add to a single backtest?

    Each test window is out of sample for its optimization window. Joined together, they show how the method itself performs.

  3. 3Why can the backtest's drawdown be misleadingly small?

    Here the backtest order had at most three losses in a row. Half of the reshuffles had six or more.

  4. 4How should a Monte Carlo result change your plan?

    If a 12% drawdown is plausible, the plan must survive it, financially and emotionally.

of 4 correct.

Sources

Back to Trading Styles & Strategy Development