How Monte Carlo Simulation Works
Trade reshuffling explained -- how Simula randomizes trade order to generate thousands of equity paths, what it preserves, what it randomizes, and what questions it answers.
How Monte Carlo Simulation Works
A backtest tells you what happened with a specific sequence of trades. Monte Carlo simulation asks a different question: what could have happened? By reshuffling the same trades into many random orders, it shows you the range of equity paths your strategy might have produced -- revealing how much of your result was skill and how much was the luck of trade sequence.
A Brief History
The Monte Carlo method was developed during the Manhattan Project in the 1940s by Stanislaw Ulam and John von Neumann. Working on nuclear physics problems that were too complex for analytical solutions, they realized they could estimate outcomes by running thousands of random simulations and observing the distribution of results. The name comes from the Monte Carlo Casino in Monaco -- a nod to the role of randomness.
The technique spread to finance in the 1960s and 1970s, where it was used to price options, model portfolio risk, and stress-test trading strategies. Today, Monte Carlo simulation is standard practice in quantitative finance, risk management, and strategy development.
Trade Reshuffling
There are several variants of Monte Carlo simulation used in trading. Some randomize daily returns. Others generate synthetic price paths from statistical models. Simula uses trade reshuffling (also called trade resampling), which is the most common approach for evaluating completed backtests.
The idea is simple: your backtest produced a set of trades, each with a specific profit or loss. Those trades happened in a particular order -- the order dictated by when the market triggered your entry and exit conditions. But that order was just one of many possible sequences. What if the winning trades had come first? What if the losses had clustered together?
Trade reshuffling takes your actual trade results, randomizes their order, and rebuilds the equity curve for each new sequence. Repeat this hundreds or thousands of times, and you get a distribution of possible equity paths -- all using your real trade results, just in different orders.
What It Preserves
Every simulation uses the exact same set of trades your backtest produced. The number of trades, the individual profit and loss of each trade, the win rate, and the average gain and loss are all identical across every simulation. The only thing that changes is the sequence.
What It Randomizes
The order of trades. This changes the shape of the equity curve, the timing and depth of drawdowns, and the path taken to the final result. Two sequences with the same trades can produce very different experiences -- one might hit a deep drawdown early and recover, while another might climb steadily before a late collapse.
What It Answers
Monte Carlo simulation answers several questions that a single backtest cannot:
How bad could the drawdowns get? Your backtest showed one specific drawdown path. Monte Carlo shows you the distribution of possible drawdowns -- including worse ones that could happen with the same trades in a less favorable order.
What is the probability of ruin? If your strategy's trades arrived in a different order, would you have blown up? The probability of ruin tells you what percentage of simulated paths fell below a threshold you define (typically a 50% loss of capital).
How much of the result was path-dependent? If the confidence bands are narrow -- meaning most shuffled sequences produce similar equity paths -- the strategy's result is robust to trade ordering. If the bands are wide, the outcome was heavily influenced by the specific sequence, and the same strategy could produce very different experiences in the future.
The Simulation Process
When you enable Monte Carlo and run a backtest, the following happens after the main backtest completes:
1. Extract trades. The completed trades from your backtest are collected, each represented by its percentage profit or loss.
2. Shuffle and replay. For each simulation, the trades are randomly reshuffled and the equity curve is rebuilt from scratch, starting at 1.0 (your initial capital). With leverage, the trade returns are multiplied by the leverage factor (capped so no single trade can lose more than 100%).
3. Collect statistics. For each simulation, the engine records the final equity, the maximum drawdown, time spent underwater, and whether equity ever fell below the ruin threshold. After all simulations complete, these individual results are aggregated into distributions and percentile bands.
4. Build confidence bands. At each trade position across all simulations, the engine computes the 5th, 25th, 50th, 75th, and 95th percentile equity values. These form the confidence bands displayed on the chart.
Configuration
Every Monte Carlo run in Simula generates 1,000 simulated sequences. The more sequences a simulation draws, the smoother and more stable its percentile bands; at 1,000, the summary statistics move only slightly from one run to the next (see below). Two settings are yours to choose:
Ruin threshold defines what percentage loss counts as "ruin." The default is 50% -- meaning a simulation counts as ruined if equity ever drops to half the starting capital. You can adjust this to be more conservative (e.g., 30%) or more lenient (e.g., 70%) depending on your risk tolerance.
Resampling method chooses how the trades are drawn for each simulation. Reshuffle (the default) permutes your existing trades into a new order and replays them -- it holds the exact set of trades fixed and only changes their sequence, so it tests sequencing risk ("was my result just a lucky order?"). Resample draws each simulation's trades at random with replacement, so some trades repeat and others are left out -- it varies the composition of trades, testing how sensitive your result is to the particular set of trades you happened to get.
Why Results Differ Between Runs
Monte Carlo results can vary slightly between runs because the simulation uses random shuffling. Each time you run the simulation, the engine generates a new set of random permutations of your trade sequence. Since the random seed changes between runs, the specific set of shuffled sequences will be different each time.
With 1,000 simulations, the summary statistics (Probability of Ruin, average max drawdown, wipeout rate) are generally stable and should be very close between runs -- typically within 1-2 percentage points. The confidence bands on the equity curve chart may also shift slightly, but the overall shape and spread should look similar.
When variation is larger: strategies with fewer trades produce more variation, because each individual shuffle has a larger impact on the outcome. Strategies near a tipping point (e.g., borderline wipeout risk) can also show more noticeable swings in metrics like wipeout rate between runs.
When variation is smaller: strategies with many trades (hundreds or more) produce very stable results, because with enough trades, each random shuffle averages out to a similar result. The median equity curve (p50) is particularly stable.
What It Does Not Tell You
Monte Carlo simulation tests whether your result is robust to trade ordering. It does not test whether your strategy will produce the same trades in the future. If the strategy is overfit to historical data, Monte Carlo will faithfully reshuffle those overfit trades -- the simulation will look fine, but the strategy will still fail on new data.
For testing whether a strategy generalizes to unseen data, use out-of-sample testing or walk-forward analysis. Monte Carlo and walk-forward answer different questions and complement each other -- Monte Carlo tests path robustness, walk-forward tests temporal robustness.
Where to Go Next
Interpreting Results -- how to read confidence bands, probability of ruin, drawdown distributions, and every other metric on the Monte Carlo tab.
Max Drawdown -- the single-backtest drawdown metric that Monte Carlo expands into a distribution.
Walk-Forward Analysis -- the complementary validation method that tests temporal robustness instead of path robustness.
Overfitting & Curve Fitting -- the problem Monte Carlo cannot detect.