Advertisement IC Markets

Resampling With Replacement vs Shuffling: Two Monte Carlo Methods Compared

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Post Reply
FXS Prop Desk
Posts: 415
Joined: Wed Oct 07, 2026 9:52 am

Resampling With Replacement vs Shuffling: Two Monte Carlo Methods Compared

Post by FXS Prop Desk »

Monte Carlo tests of trading results usually use one of two methods. They answer slightly different questions.

Shuffling (permutation): reorder the same trades randomly. The final result is always the same; only the path changes. It shows the range of drawdowns possible with exactly these trades.

Resampling with replacement (bootstrap): draw trades randomly, allowing repeats. Final results vary. It estimates the range of outcomes if the future resembles the past distribution.

Python example:

Code: Select all

import numpy as np
r = np.array(trades)
perm_dd = [np.minimum.accumulate(np.cumsum(np.random.permutation(r))).min() for _ in range(10000)]
boot_end = [np.random.choice(r, len(r)).sum() for _ in range(10000)]
Use shuffling for drawdown planning, bootstrap for estimating return uncertainty.

In both cases, the number of trades in the original sample matters. With fewer than about 100 trades, the simulation mostly reflects the randomness of the sample itself, and its results should be treated with caution.

Which method do you use, and what did it show about your strategy?
FXS Official Team | The Idea Lab & Strategy
Recommended broker for automated trading & scalping IC Markets
Fairman
Posts: 3303
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Resampling With Replacement vs Shuffling: Two Monte Carlo Methods Compared

Post by Fairman »

FXS Prop Desk wrote: Use shuffling for drawdown planning, bootstrap for estimating return uncertainty.
Agree with the split, but the shuffle line in the example measures something slightly different from drawdown. Taking the minimum of the cumulative sum gives the lowest point relative to the starting balance, so a path that runs up 20R and then drops 15R shows no drawdown at all. For peak-to-trough you need equity minus its running maximum, something like eq = np.cumsum(np.random.permutation(r)) and then dd = (eq - np.maximum.accumulate(eq)).min(). The original version is still useful for a static max-loss rule measured from the starting balance, but for trailing limits or for how much pain to expect, the peak-to-trough number is the one that matters.
It’s Fairman :geek:
Shadow Trader
Posts: 959
Joined: Wed Sep 09, 2026 5:19 pm

Re: Resampling With Replacement vs Shuffling: Two Monte Carlo Methods Compared

Post by Shadow Trader »

FXS Prop Desk, I use both methods, but I lean on shuffling when sizing a soft stop and on bootstrap when I want a feel for return scatter. Fairman's note on peak to trough is the fix I needed after my first scripts understated pain.

With a path that runs up 12R and then gives back 8R, a start to trough measure barely blinks. Equity minus running max shows the 8R draw that actually hits a trailing floor.

I only trust either test once the sample clears about 120 trades. Below that the paths mostly replay sample noise, and I treat the percentiles as sketches rather than rules.

On my London EURUSD book the shuffle peak to trough 95th percentile sat near 6.5R over a 200 trade window. That is what set the soft stop, not the average equity curve.

I still run bootstrap on final P and L to see how often a quarter lands negative. Which percentile do you size from, and do you refresh the sample every month?
Post Reply