Monte Carlo Testing: Measuring the Luck Range of Drawdown
Contents
- Bottom line: a backtest's maximum DD is just one outcome
- How it works: shuffling leaves total profit unchanged and changes only the DD
- What changes when you shuffle
- The lower the win rate, the wider the spread tends to be
- Steps: how to do it yourself
- What each method tells you
- Limits and cautions: Monte Carlo is not a cure-all
- The assumption that trades are independent
- It only sees closed-trade P&L
- You can't see beyond the original data
- Summary
Bottom line: a backtest's maximum DD is just one outcome
The maximum drawdown (DD) in a backtest report is the value you get when past price moves happened to line up in that particular order. Even with identical wins and losses, a different order can make the DD shallower or deeper.
Monte Carlo testing reshuffles the order of trades many times and looks at how widely the DD scatters. When choosing an EA, we recommend not treating the backtest's maximum DD as a single point, but asking where it sits within the distribution. That said, this method leaves many things unanswered, and we cover its limits later in the article.
📧 Free 8-email course + subscriber-only pack of 13 MT5 indicators
Right after you sign up, you get a download link for a subscriber-only pack of our 13 MT5 indicators: compiled files (.ex5), source code and a setup guide. Then 8 emails on algo-trading essentials, reading backtests correctly and choosing a broker (one a day for the first 5 days, then 7, 14 and 30 days after signing up). You also get notified before each price rise of the versions sold on the MQL5 Market (launch pricing that steps up as copies sell). Our EAs are free on this site with a live account at a partner broker.
* Privacy strictly protected. You can unsubscribe at any time.
How it works: shuffling leaves total profit unchanged and changes only the DD
What changes when you shuffle
With a fixed lot size, reordering trades leaves total profit the same. PF and win rate don't change either. Even with compounding, where lot size is set as a fixed percentage of equity, profits and losses are chained by multiplication, so the final balance comes out the same.
What changes is the path in between. If losses happen to cluster, the DD gets deeper; if wins and losses alternate, it stays shallower. The length of losing streaks also changes with the order.
The lower the win rate, the wider the spread tends to be
Take ATLAS as an example: in its backtest it had a win rate of 33.2% and a maximum losing streak of 13. Trend-following EAs with low win rates are prone to orderings where losses run together. After reshuffling, some combinations will naturally produce a losing streak longer than the 13 recorded in the backtest. You can't say "the backtest's worst streak was 13, so it won't get worse than that."
Steps: how to do it yourself
The MT5 tester has no built-in function for shuffling trade order. In practice, you export the trade list from the report and process it in a spreadsheet or a script.
- Export the list of profits and losses for closed trades from the MT5 backtest report
- Randomly reorder the sequence of profits and losses
- Rebuild the balance curve in the shuffled order and record the maximum DD and maximum losing streak
- Repeat steps 2–3 about 1,000 times
- Sort the recorded DDs from smallest to largest and look at the median and the value around the top 5%
- Check where the backtest's maximum DD falls within the distribution
If the backtest's maximum DD sits on the shallow side of the distribution, the historical data may have been a "lucky ordering." In that case, it is safer to size your trading capital assuming the deep side of the distribution.
What each method tells you
| Method | What you do | What it tells you | What it doesn't tell you |
|---|---|---|---|
| Order shuffle | Rearrange the same trades | Spread of DD and losing streaks | Effects of the trades themselves changing |
| Resampling (with replacement) | Redraw trades, allowing duplicates | Spread of total profit itself | Effects of market conditions changing |
| Random skip | Remove some trades | Resilience to missed fills or downtime | Cases where downtime clusters in losing periods |
| Cost add-on | Subtract an adverse amount from each trade | Resilience to wider spreads | How real costs actually shift |
Shuffling alone produces only one final profit figure. If you also want to see the spread on the profit side, combine it with resampling.
Limits and cautions: Monte Carlo is not a cure-all
The assumption that trades are independent
Shuffling treats each trade as unrelated to the others. In real markets, high-volatility periods and trendless periods come in clusters. Losses often concentrate not by chance but because of the market phase. Random ordering dilutes this "clustering of losses," which means it may underestimate the DD relative to reality.
It only sees closed-trade P&L
A balance curve built from a trade list does not include floating losses on open positions. For example, GOLD KING v6 had a balance DD of 7.45% in its backtest, while its effective DD including floating losses was 91.3%. Shuffling only closed-trade P&L for an EA like this badly misjudges the risk. Be especially careful with averaging-down (martingale-style) EAs, grid EAs, and EAs with long holding times.
You can't see beyond the original data
Shuffling is merely a rearrangement of trades that already happened. Losses from market conditions that never occurred during the test period (a sudden regulatory change, a liquidity drought) will never show up in the distribution, no matter how many runs you do. For EAs with few trades, the original sample is small, so the distribution itself is less reliable.
There is no guarantee that "sizing capital to survive the top-5% DD will keep you safe." All it tells you is "the range of luck within rearrangements of past trades."
Summary
- A single backtest's maximum DD is just one sample from one ordering
- Shuffling trade order leaves total profit, PF, and win rate unchanged; only the DD and losing-streak length change
- Repeat about 1,000 times to build a DD distribution, then see where the backtest value falls
- The lower an EA's win rate, the more likely orderings with longer losing streaks than the backtest become
- Losses clustered by market phase, floating losses, and market conditions outside the test period cannot be captured by shuffling
- Set capital and lot size with a margin, assuming the deep side of the distribution
Each EA's maximum losing streak, balance DD, and effective DD are listed in the measured ranking of all EAs. The trade list of DONCHIAN ENGINE, a trend-following EA with a 34.5% win rate, makes a handy practice subject for shuffle testing. Other articles on testing methods are collected in EA & MT5 Know-How.
Related
📧 Free 8-email course + subscriber-only pack of 13 MT5 indicators
Right after you sign up, you get a download link for a subscriber-only pack of our 13 MT5 indicators: compiled files (.ex5), source code and a setup guide. Then 8 emails on algo-trading essentials, reading backtests correctly and choosing a broker (one a day for the first 5 days, then 7, 14 and 30 days after signing up). You also get notified before each price rise of the versions sold on the MQL5 Market (launch pricing that steps up as copies sell). Our EAs are free on this site with a live account at a partner broker.
* Privacy strictly protected. You can unsubscribe at any time.
Have a question about EAs or FX?
You can post it on the Nattzy trading forum (free sign-up). Questions beyond this article are welcome too — EA settings, choosing a broker and more.
Ask on Nattzy ↗