What is a Monte Carlo simulation?
A Monte Carlo simulation is a way to estimate many possible future outcomes by repeatedly sampling from a set of random inputs. In trading, the idea is to take a strategy’s historical results and ask: If the sequence of wins and losses had played out differently, what might the equity curve have looked like?
Instead of relying on one backtest path, Monte Carlo generates hundreds or thousands of alternate paths. This helps you understand the range of outcomes, not just the single “best” or “average” result.
A simple example: suppose a strategy produced 200 trades with an average profit of 0.4R per trade, where R is the amount risked per trade. A Monte Carlo test can reshuffle those 200 trade returns many times to create different equity curves. Some paths may hit a 20% drawdown quickly; others may grow smoothly. That spread tells you how fragile or robust the strategy may be.
What gets randomized?
There are a few common approaches:
- Trade order randomization: shuffle the sequence of historical trades while keeping each trade’s return unchanged.
- Bootstrapping: sample trades with replacement, so some trades may appear more than once and others not at all.
- Parameter perturbation: vary inputs like stop-loss distance, slippage, or commission to see how sensitive results are.
For many retail strategies, trade-order Monte Carlo is the most intuitive. If your strategy has a positive expectancy, the order of wins and losses still matters a lot for drawdowns and risk of ruin.
Why run one?
A backtest usually shows one exact path through history. But markets do not repeat in the same order. Monte Carlo helps answer questions like:
- How bad could the drawdown get in a less favorable sequence?
- How often might the strategy lose money over the next 50 or 100 trades?
- Is the profit mostly coming from a few outlier trades?
- How sensitive is the strategy to slippage, fees, or slightly worse fills?
This is especially useful for strategies with small sample sizes, high win rates, or large variance between trades. A strategy that looks smooth in one backtest may still have a wide range of realistic outcomes.
The core math idea
At a basic level, Monte Carlo is about repeated sampling from a distribution.
If your trade returns are (r_1, r_2, \dots, r_n), then one simulation path might randomly reorder them into (r_{\pi(1)}, r_{\pi(2)}, \dots, r_{\pi(n)}), where (\pi) is a random permutation.
From each simulated path, you can compute metrics such as:
- Ending equity
- Maximum drawdown
- Profit factor
- Sharpe ratio
- Longest losing streak
- Time to recovery
After 1,000 simulations, you can look at percentiles. For example:
- 5th percentile max drawdown = worst 5% of cases
- 50th percentile ending equity = median case
- 95th percentile ending equity = optimistic case
That percentile view is often more useful than a single backtest number.
A practical example
Imagine a strategy with these trade stats:
- 150 trades
- Win rate: 48%
- Average win: 1.8R
- Average loss: -1.0R
- Expectancy: about 0.34R per trade
On paper, this looks promising. But Monte Carlo may reveal that:
- In 10% of simulations, max drawdown exceeds 18%
- In 5% of simulations, the strategy spends 40+ trades underwater
- A small number of large winners contribute most of the profit
That does not mean the strategy is bad. It means you should size it and expect it with those risks in mind.
Common pitfalls
1) Treating Monte Carlo as a guarantee
Monte Carlo does not predict the future. It estimates a range of plausible outcomes based on the data you already have. If the market regime changes, the actual future can still fall outside the simulated range.
2) Using too little data
If you only have 20 or 30 trades, the simulation can be unstable. The results may be dominated by a few lucky or unlucky trades. More trades generally improve the usefulness of the analysis.
3) Ignoring regime dependence
A strategy that works in trending markets may fail in choppy ones. If you randomize all trades together, you may hide the fact that performance depends on market regime. Segmenting by regime can make the analysis more realistic.
4) Forgetting costs and slippage
A strategy with a tiny edge can disappear after commissions, spread, and slippage. A robust Monte Carlo test should include realistic trading costs.
5) Overfitting to the simulation output
If you keep adjusting the strategy until the Monte Carlo results look perfect, you may just be overfitting another layer of the process.
How traders use the results
The main value is in position sizing and expectation setting. If the 95th percentile drawdown is 22%, you should not size the strategy as if 5% drawdown is the worst case. Likewise, if the worst simulated path still has a positive ending equity, that is more reassuring than a single flashy backtest.
Traders often use Monte Carlo to decide:
- whether a strategy is tradable at all
- how much capital to allocate
- what drawdown is psychologically and financially tolerable
- whether to paper trade before going live
Tools like Algovex can run this kind of analysis after you build a strategy visually and backtest it, which makes it easier to inspect the distribution of outcomes rather than only the headline metrics.
Bottom line
Monte Carlo simulation is a stress test for trading strategies. It helps you understand how much luck, sequencing, and variance matter, and it gives you a more realistic view of risk than a single backtest ever can.
Disclaimer: This content is for educational purposes only and is not financial advice.