Advanced15 min read

Monte Carlo Simulation for Trading

Quantify your true risk. Calculate probability of ruin, understand worst-case scenarios, and trade with confidence knowing the full range of possible outcomes.

Key Takeaways

  • • Monte Carlo reveals path risk: randomizing trade order uncovers hidden losing streaks.
  • • Target probability of ruin <1-2% and max drawdown percentiles that fit your risk budget.
  • • Run 5K-10K iterations for smoother tails; export trades to avoid platform limits.
  • • Use outputs to size down, add circuit breakers, or reject fragile strategies.

What is Monte Carlo Simulation?

Monte Carlo simulation is a statistical method that reveals the true risk profile of your trading strategy by showing you thousands of possible outcomes instead of just one.

Here's the problem: When you backtest a strategy, you see one specific sequence of trades that happened to occur in historical data. But what if those trades had happened in a different order? What if your first 20 trades had all been losers instead of winners? Your account might have been wiped out before you could profit.

Monte Carlo simulation solves this by randomly shuffling your historical trades thousands of times, creating thousands of alternative "what if" scenarios. Each simulation shows a different possible equity curve - some better, some worse than your backtest.

The result? You get a probability distribution that shows your best case, worst case, and most likely outcomes. You can calculate critical risk metrics like probability of ruin (chance your account hits zero), value at risk (maximum expected loss), and confidence intervals (range where your returns will likely fall).

Why Use Monte Carlo Simulation?

Reveals Hidden Risk

See the probability of catastrophic losing streaks that didn't happen in your backtest but could occur in live trading. Understand worst-case scenarios.

Probability of Ruin

Calculate the exact probability your account will hit zero. Professional traders use this to ensure less than 1-5% ruin probability.

Distribution Understanding

See the full range of possible returns, not just one outcome. Understand median vs mean returns and tail risk.

Confidence Intervals

Know with 95% confidence that your returns will fall within a specific range. Set realistic expectations and avoid nasty surprises.

How Monte Carlo Simulation Works

The Monte Carlo process transforms your single backtest into thousands of possible scenarios:

Step 1: Collect Historical Trades

Run a backtest and gather all your trades (win/loss, return %, duration). You need at least 30-50 trades for meaningful Monte Carlo analysis, preferably 100+.

Step 2: Randomize Trade Sequence

Randomly shuffle the order of trades. If your backtest had 100 trades, create a new random sequence of those same 100 trades. Each shuffle represents an alternative "universe" where the same trades happened but in a different order.

Step 3: Calculate Equity Curve

Apply the randomized trades to your starting capital to generate an equity curve. Track the account balance after each trade, including any drawdowns that might trigger ruin.

Step 4: Repeat Thousands of Times

Run steps 2-3 for 1,000-10,000 iterations. Each iteration produces one possible outcome. Aggregate all outcomes to create a probability distribution.

Step 5: Calculate Risk Metrics

Analyze the distribution to calculate: probability of ruin (% hitting zero), value at risk (5th percentile loss), confidence intervals (range where 95% of outcomes fall), median return, maximum drawdown distribution.

Monte Carlo vs Traditional Backtest

AspectTraditional BacktestMonte Carlo Simulation
Outcomes ShownOne result (what happened)Thousands of results (what could happen)
Risk VisibilityHidden (lucky/unlucky sequences)Revealed (all possible sequences)
Probability of RuinUnknownCalculated precisely
Confidence IntervalsNot available95%, 99% ranges shown
Worst CaseOne possible worst drawdownTrue worst-case distribution
Trade SequenceHistorical order onlyAll possible orders tested
Best ForStrategy validationRisk quantification

Configuration Guide

Number of Iterations

  • 1,000 iterations: Quick analysis, rough estimates. Good for initial exploration.
  • 5,000 iterations: Recommended for most trading decisions. Provides reliable statistics and smooth distributions.
  • 10,000+ iterations: Professional-grade analysis. Use for critical decisions or calculating extreme tail risks.

Starting Capital

Use your actual intended trading capital. Monte Carlo results are capital-dependent. A strategy with 5% ruin risk at $10,000 capital might have 25% ruin risk at $5,000 capital.

Tip: Run multiple simulations with different capital amounts to find the minimum safe capital for your strategy.

Ruin Threshold

  • Account zero (0%): Conservative. Calculates probability of complete wipeout.
  • 50% drawdown: Realistic. Many traders quit or get margin called before hitting zero.
  • 25-30% drawdown: Aggressive. Professional threshold for risk management intervention.

Confidence Levels

Common confidence intervals to calculate:

  • 95% confidence interval: Standard for most trading decisions. You can be 95% confident your returns will fall within this range.
  • 99% confidence interval: Conservative. Accounts for extreme scenarios. Wider range but more certainty.
  • 5th percentile (Value at Risk): Shows the loss that occurs in the worst 5% of simulations. Critical for risk management.

Understanding Results

Key Metrics to Track

MetricGoodRed Flag
Iterations5K-10K runs<1K (noisy tails)
Probability of ruin<1-2%>5%
Max DD (95th pct)Within risk budget (e.g., <25%)Exceeds risk budget or >35%
Return distributionMedian close to backtest; tails understoodHuge gap between median and best/worst with no plan
Streak riskWorst losing streak manageable with sizing rulesStreak wipes >30% before circuit breaker

Probability of Ruin: <1%

Excellent risk profile. Less than 1 in 100 chance of hitting your ruin threshold. Professional-grade safety. Strategy is suitable for live trading with proper risk management.

Example: Out of 10,000 simulations, fewer than 100 resulted in account ruin.

Probability of Ruin: 1-5%

Acceptable risk for experienced traders. Some risk exists but manageable with proper position sizing and discipline. Monitor drawdowns carefully.

Example: Out of 10,000 simulations, 100-500 resulted in ruin. Consider reducing position size by 30-50%.

Probability of Ruin: >5%

High risk. Not recommended for live trading. More than 1 in 20 chance of significant losses. Reduce position size dramatically, increase capital, or improve strategy before trading.

Example: Out of 10,000 simulations, more than 500 resulted in ruin. Red flag for strategy viability.

Other Key Metrics

  • Value at Risk (VaR) 95%: Maximum loss expected in the worst 5% of simulations. Example: VaR 95% = -$3,200 means 95% of the time you won't lose more than $3,200.
  • Confidence Interval: Range where your final returns will likely fall. Example: 95% CI = [+$2,000 to +$15,000] means you're 95% confident your profit will be between $2K-$15K.
  • Median Return: The middle outcome (50th percentile). Often more realistic than mean return, which can be skewed by outliers.
  • Maximum Drawdown Distribution: Shows the range of possible drawdowns. Example: 95% of simulations had drawdowns between 15-42%, with median at 28%.

Real-World Example

Strategy: Mean Reversion on SPY

Backtest Results (One Outcome)

  • • Starting capital: $10,000
  • • Trades: 87
  • • Win rate: 58%
  • • Final balance: $18,500 (+85%)
  • • Max drawdown: -22%
  • • Sharpe ratio: 1.8

Monte Carlo Results (10,000 Simulations)

  • Probability of ruin: 12%
  • • Median return: +52%
  • • 95% confidence interval: [-5% to +145%]
  • • VaR 95%: -$1,800 (-18%)
  • • Max drawdown range: 12% to 58%
  • • Best case: +$24,000 (+240%)
  • • Worst case: -$10,000 (-100%)

Critical Insight Revealed

The backtest looked great (+85% return, 1.8 Sharpe), but Monte Carlo revealed a 12% probability of ruin - unacceptably high for live trading. In 1,200 out of 10,000 simulations, the account was wiped out despite using the exact same trades.

The problem: The backtest got "lucky" with trade sequence. Wins came early, providing cushion for later losses. In 12% of random sequences, losses clustered early, causing ruin before the winning trades could occur.

Solution Applied

Reduced position size from 10% per trade to 4% per trade and increased starting capital to $15,000. Ran Monte Carlo again:

  • Probability of ruin: 0.8% (12% → 0.8%)
  • • Median return: +38% (less than before but acceptable)
  • • VaR 95%: -$1,200 (risk reduced)
  • • Max drawdown: 18% (manageable)

Strategy now has professional-grade risk profile suitable for live trading.

Best Practices

Run Sufficient Iterations

Use at least 5,000 iterations for reliable statistics. Don't make trading decisions based on 100 or 500 simulations - the distribution won't be smooth enough and tail risks will be underestimated.

Use Realistic Starting Capital

Simulate with the exact capital you'll trade with. Risk metrics are capital-dependent. A strategy safe at $20K might be dangerous at $10K. Test multiple capital levels to find your minimum safe amount.

Target <5% Probability of Ruin

Professional traders keep ruin probability below 1-5%. If your simulation shows >5%, reduce position size by 30-50% and re-run. Don't trade strategies with double-digit ruin probabilities.

Combine with Walk-Forward Analysis

Run Monte Carlo on your walk-forward test results for ultimate validation. This shows risk assuming the strategy maintains its edge on unseen data. Most robust validation possible.

Focus on Median, Not Mean

The median (50th percentile) return is more realistic than the mean, which can be inflated by rare outlier wins. Plan your trading around median outcomes, not best-case scenarios.

Understand the Tails

Pay attention to the 5th and 95th percentiles. The worst 5% of outcomes show your tail risk. Ask: "Can I survive these worst-case scenarios?" If not, adjust position sizing.

Common Pitfalls to Avoid

Too Few Iterations

Running only 100-500 simulations produces jagged distributions and underestimates tail risks. You might miss rare but catastrophic scenarios. Always use 5,000+ iterations for trading decisions. Computing is cheap; blown accounts are expensive.

Insufficient Trade History

Monte Carlo needs at least 30-50 trades to be meaningful. With only 10-15 trades, the randomization doesn't have enough data points to create diverse scenarios. Either extend your backtest period or acknowledge limited statistical confidence.

Ignoring Probability of Ruin

Traders focus on median returns and ignore ruin probability. A strategy with +80% median return but 15% ruin probability is a ticking time bomb. Your first live trading attempt might hit that 15% scenario. Always prioritize survivability over returns.

Misunderstanding Confidence Intervals

95% confidence interval of [+10% to +90%] doesn't mean you'll definitely profit. It means there's still 5% chance of outcomes outside this range - including complete losses. The confidence interval shows where most outcomes fall, not guaranteed results.

Using Wrong Capital Amount

Testing with $100K when you'll trade with $10K gives false confidence. Risk metrics scale with capital. A strategy with 2% ruin risk at $100K might have 30% ruin risk at $10K. Always simulate with your actual trading capital.

Frequently Asked Questions

What is Monte Carlo simulation in trading?

Monte Carlo simulation is a statistical technique that randomly reorders your historical trades thousands of times to show the range of possible outcomes. Instead of seeing one backtest result, you see hundreds or thousands of "what if" scenarios, revealing the true risk and probability distribution of your strategy. It answers: "What if my winning trades had come later instead of earlier?"

How many iterations should I run?

Run at least 1,000 iterations for basic analysis, 5,000 for reliable statistics, and 10,000+ for critical trading decisions. More iterations provide smoother probability distributions and more accurate tail risk estimates, especially for calculating probability of ruin and extreme drawdowns. Think of it like polling: 100 people gives rough ideas, 1,000 gives solid data, 10,000 gives precision.

What is probability of ruin?

Probability of ruin is the likelihood your account will hit zero (or a specified threshold) over your trading period. For example, a 5% probability of ruin means in 5 out of 100 possible trade sequences, your account would be wiped out. Professional traders typically target less than 1-5% probability of ruin. It's the single most important risk metric.

What is Value at Risk (VaR)?

Value at Risk (VaR) tells you the maximum loss you can expect at a given confidence level. For example, 95% VaR of -$5,000 means there's only a 5% chance you'll lose more than $5,000. It's a key metric for understanding tail risk and worst-case scenarios. Banks and hedge funds use VaR extensively for risk management.

Is Monte Carlo simulation better than backtesting?

Monte Carlo simulation complements backtesting rather than replacing it. Backtesting shows what happened with your strategy in historical data. Monte Carlo shows what could happen by randomizing trade sequences, revealing hidden risks like the possibility of catastrophic losing streaks that might not have occurred in your backtest. Use both together for complete validation.

Can Monte Carlo simulation prevent losses?

Monte Carlo simulation doesn't prevent losses, but it reveals risks before they occur. By understanding probability of ruin, maximum drawdowns, and confidence intervals, you can adjust position sizing, set realistic expectations, and avoid strategies with unacceptable risk profiles before risking real capital. It's like crash-testing your strategy in thousands of simulations before going live.

Glossary Quick Links

Related Guides

Ready to Quantify Your Risk?

Run Monte Carlo simulation on your strategies with BacktestMe. Calculate probability of ruin, value at risk, and confidence intervals in seconds. Trade with confidence knowing your true risk profile.