# Monte Carlo Simulation

> Monte Carlo simulation generates thousands of possible outcomes to show the range of results. Learn trade resampling, drawdown estimates and the limits.

Source: https://learn.tradelabsai.com/research/monte-carlo-simulation/  
Track: Research and Backtesting · Level: Intermediate · Updated: 2026-10-03  
Publisher: TradeLabs AI (https://tradelabsai.com). Education, not financial advice.  
Cite as: TradeLabs Learn, "Monte Carlo Simulation", https://learn.tradelabsai.com/research/monte-carlo-simulation/

A backtest shows one path through history: one particular order of wins and losses. But the future could unfold in countless other ways. Monte Carlo simulation generates thousands of plausible alternative paths by resampling or randomly generating returns, then measures the distribution of outcomes. It answers questions a single backtest cannot: how bad could the drawdown get, how likely is a losing year, what are the odds of ruin? For option pricing applications, see [Monte Carlo Option Pricing](https://learn.tradelabsai.com/options/monte-carlo-option-pricing/).

## Common approaches

| Method | How it works | Captures |
|---|---|---|
| Trade resampling | Shuffle or resample historical trades with replacement | Different orderings of wins and losses |
| Return bootstrapping | Resample daily or monthly returns, often in blocks | Return distribution and some clustering. See [Bootstrap and Permutation Tests](https://learn.tradelabsai.com/math/bootstrap-and-permutation-tests/) |
| Parametric simulation | Generate returns from a fitted distribution (normal, Student t, GARCH) | Assumed distribution and volatility dynamics |
| Parameter perturbation | Randomly vary strategy parameters | Sensitivity to settings. See [Robustness and Stress Testing](https://learn.tradelabsai.com/research/robustness-and-stress-testing/) |
| Synthetic price paths | Simulate prices and re run the strategy | Behaviour on unseen patterns |

## Drawdown analysis

**Example: How deep can drawdowns get?**
A strategy's backtest has 400 trades and a maximum drawdown of 14%. A trader resamples the 400 trades with replacement 10,000 times and records the maximum drawdown of each simulated path. Results:

- Median maximum drawdown: 17%
- 95th percentile: 28%
- 99th percentile: 35%

The backtest's 14% was a relatively lucky ordering. Planning for drawdowns of 25% to 30% is more realistic, which changes position sizing decisions. See [Maximum Drawdown](https://learn.tradelabsai.com/portfolio/maximum-drawdown/) and [Position Sizing](https://learn.tradelabsai.com/risk/position-sizing/).

## Risk of ruin and probability estimates

Monte Carlo makes it easy to estimate:

- **Probability of a losing year** or losing month.
- **Probability of hitting a drawdown limit** such as 20%.
- **Probability of ruin** at different position sizes. See [Risk of Ruin](https://learn.tradelabsai.com/risk/risk-of-ruin/).
- **Range of final account values** after a set number of trades.
- **Time to recover** from drawdowns.

## A simple trade resampling procedure

1. **Collect the list of trade returns** from the backtest (after costs).
2. **Draw a random sample of the same size** with replacement.
3. **Compound them** into an equity curve using your sizing rules.
4. **Record statistics:** final return, maximum drawdown, longest losing streak.
5. **Repeat** 5,000 to 10,000 times.
6. **Analyse the distribution** of each statistic.

```python
import numpy as np
trades = np.array([...])          # trade returns as fractions, e.g. 0.012
rng = np.random.default_rng(0)
dd = []
for _ in range(10_000):
    path = np.cumprod(1 + rng.choice(trades, size=len(trades), replace=True))
    peak = np.maximum.accumulate(path)
    dd.append(((path - peak) / peak).min())
print(np.percentile(dd, [50, 5, 1]))
```

## Limits

| Limitation | Explanation |
|---|---|
| Garbage in, garbage out | If the backtest is overfit or biased, simulations inherit the problem |
| Independence assumption | Simple resampling ignores clustering of losses; block methods help |
| No new regimes | Resampling cannot create market conditions absent from history. See [Structural Breaks and Regime Changes](https://learn.tradelabsai.com/math/regime-changes/) |
| Fat tails | Parametric normal simulations understate extremes. See [Fat Tails](https://learn.tradelabsai.com/math/fat-tails/) |
| False precision | Thousands of simulations can look authoritative while resting on shaky inputs |

## Monte Carlo vs stress testing

Monte Carlo explores the range of outcomes implied by your data or assumptions. Stress testing deliberately imposes extreme scenarios, such as a 2008 style crash or a sudden volatility spike, that may not appear in your sample. Use both. See [Stress Testing and Scenario Analysis](https://learn.tradelabsai.com/portfolio/stress-testing/).

## Using results for sizing

A practical approach is to choose position size so that the 95th percentile simulated drawdown stays within the largest drawdown you could tolerate without abandoning the strategy. If simulations show a 1 in 20 chance of a 30% drawdown and your limit is 20%, cut risk per trade by roughly a third and rerun the simulation. See [Maximum Drawdown](https://learn.tradelabsai.com/portfolio/maximum-drawdown/).

## Frequently asked questions

### What is Monte Carlo simulation in trading?

A method that generates many alternative sequences of returns or trades to estimate the range of possible outcomes, such as drawdowns and final returns.

### How many Monte Carlo runs do I need?

Typically several thousand, such as 5,000 to 10,000, which gives stable estimates of most percentiles.

### Can Monte Carlo prove a strategy will work?

No. It shows the range of outcomes implied by past data and assumptions, but cannot fix biases in the backtest or predict new market regimes.

Next, learn to choose parameters without overfitting in [Parameter Optimization](https://learn.tradelabsai.com/research/parameter-optimization/).

## Continue learning

- Next lesson: [Parameter Optimization](https://learn.tradelabsai.com/research/parameter-optimization/)
- Previous lesson: [P-Hacking and Multiple Testing](https://learn.tradelabsai.com/research/p-hacking-and-multiple-testing/)
- Related: [P-Hacking and Multiple Testing](https://learn.tradelabsai.com/research/p-hacking-and-multiple-testing/): Testing many strategy variations guarantees some look good by chance. Learn how p hacking happens, how to adjust for multiple tests and the deflated Sharpe ratio.
- Related: [Bootstrap and Permutation Tests](https://learn.tradelabsai.com/math/bootstrap-and-permutation-tests/): Bootstrap and permutation tests use resampling to measure uncertainty and test significance without strict assumptions. Learn how they work, examples and pitfalls.
- Related: [Maximum Drawdown](https://learn.tradelabsai.com/portfolio/maximum-drawdown/): Maximum drawdown measures the largest fall from a peak to a trough in an account or strategy. Learn how to calculate it, recovery maths, duration and how to use it.
- Related: [Risk of Ruin](https://learn.tradelabsai.com/risk/risk-of-ruin/): Risk of ruin is the chance that losses drain your account beyond recovery. Learn what drives it, see simulated numbers and how to keep it low.
- Related: [Monte Carlo Option Pricing](https://learn.tradelabsai.com/options/monte-carlo-option-pricing/): Monte Carlo pricing simulates many random price paths and averages the discounted payoffs. Learn the method, a Python sketch, accuracy, variance reduction and uses.
- Related: [Robustness and Stress Testing](https://learn.tradelabsai.com/research/robustness-and-stress-testing/): Robustness tests check whether a strategy survives changes in parameters, markets, costs and conditions. Learn the main tests and how to read the results.
