Discussing the article: "MetaTrader 5 Machine Learning Blueprint (Part 24): Sequence Risk"

Check out the new article: MetaTrader 5 Machine Learning Blueprint (Part 24): Sequence Risk.

Realized backtests reflect a single ordering of trades, so their maximum drawdown and prop‑firm breach risk are often understated. We resequence trade returns via a stationary bootstrap with a derived block length to estimate the drawdown distribution and a sequence risk ratio, compute path‑dependent breach probabilities for drawdown and daily‑loss limits, and replace WFE with a paired IS–OOS degradation statistic. The tools are demonstrated on a real EURUSD RSI strategy to guide sizing and risk limits.

Earlier parts of this series, from the nested cross-validation of Part 16 to the feature screen of Part 23, ask whether a component of a trading system carries real information when it is evaluated honestly. This article asks a different question about a system that has already cleared that bar. Suppose the backtest is honest and reports a maximum drawdown of 14.3% on 820 trades. Is 14.3% the number to size an account against?

Not on its own. Maximum drawdown depends on which trades occurred and on the order in which they arrived, and both are one realization among many that the same strategy could have produced. Resample the trades and a different worst case appears, sometimes milder and sometimes much worse. Nothing guarantees that the realized draw is a typical one, and there is a selection reason to suspect a favorable one: backtests that suffered an unlucky path tend to be discarded before anyone sizes an account against them. The strategy below was fixed in advance rather than selected, and its realized drawdown sits above the median of the resampled distribution.

This article implements four tools in afml.backtest_statistics. First, a block bootstrap that resamples trade returns to estimate the drawdown distribution, together with a block permutation that keeps the realized trades and varies only their order, so that sequence risk can be separated from sampling variation. Second, breach_probability, which converts resampled trade paths into the fraction that breach a prop-firm loss limit over a stated horizon, on either a trailing or a static basis. Third, a calendar module that applies the same limits to floating equity on server-time days, which is how prop firms apply them. Fourth, a paired-difference statistic for walk-forward degradation that is reported alongside Pardo's Walk-Forward Efficiency ratio and remains defined when in-sample performance is small or negative.

Author: Patrick Murimi Njoroge