Skip to main content
Skip to main content
Version: 1.0 (Current)

Monte Carlo Simulation

Introduction

Monte Carlo simulation is a statistical technique that helps assess whether a trading strategy's performance is due to genuine edge or just luck. By randomizing the order of historical trades and running thousands of simulations, we can determine the range of possible outcomes and evaluate strategy robustness.

The Luck vs Skill Problem

The Question: Is my strategy's performance due to skill or just lucky trade sequencing?

Example:

Strategy: 100 trades, 60% win rate, 30% total return

But what if:
- All wins came first, then losses?
- Wins and losses were randomly distributed?
- All losses came first, then wins?

Same trades, different order = different equity curves!

Monte Carlo Answers:

  • What range of outcomes is possible?
  • How likely was my actual result?
  • Is performance robust or lucky?
  • What's the probability of ruin?

How Monte Carlo Works

Basic Process

1. Take Historical Trades:

Trade 1: +₹500
Trade 2: -₹200
Trade 3: +₹800
Trade 4: -₹300
...
Trade 100: +₹600

Original Sequence Return: 30%

2. Randomize Order:

Simulation 1: Trade 45, Trade 12, Trade 88, ...
Simulation 2: Trade 3, Trade 67, Trade 21, ...
Simulation 3: Trade 91, Trade 5, Trade 43, ...
...
Simulation 10,000: Trade 22, Trade 76, Trade 9, ...

3. Calculate Results:

Each simulation produces:
- Total return
- Maximum drawdown
- Sharpe ratio
- Other metrics

4. Analyze Distribution:

10,000 simulations create distribution of outcomes
Compare original result to distribution
Determine if original was lucky or typical

Configuration

{
"monteCarloConfig": {
"enabled": true,
"numSimulations": 10000,
"confidenceLevel": 95,
"ruinThreshold": -50 // -50% drawdown
}
}

Confidence Intervals

Understanding Confidence Intervals

Definition: Range where X% of simulated results fall

95% Confidence Interval:

10,000 simulations
Sort by return
5th percentile: 15% return (lower bound)
95th percentile: 45% return (upper bound)

95% CI: [15%, 45%]

Meaning: 95% of simulations fell between 15-45% return

Interpretation:

Original Result: 30% return
95% CI: [15%, 45%]

30% is within range → Typical result
Not exceptionally lucky or unlucky

Confidence Levels

Common Levels:

90% CI: Middle 90% of results
95% CI: Middle 95% of results (most common)
99% CI: Middle 99% of results

Example:

Total Return:
90% CI: [18%, 42%]
95% CI: [15%, 45%]
99% CI: [10%, 50%]

Wider interval = more certainty but less precision

Multiple Metrics

Typical Analysis:

Total Return:
Original: 30%
95% CI: [15%, 45%]
Median: 28%

Max Drawdown:
Original: 18%
95% CI: [12%, 28%]
Median: 20%

Sharpe Ratio:
Original: 1.5
95% CI: [0.8, 2.2]
Median: 1.4

Profit Factor:
Original: 1.8
95% CI: [1.3, 2.4]
Median: 1.7

Percentile Rank

What It Means

Definition: Where your original result ranks among simulations

Calculation:

10,000 simulations
Original return: 35%
Simulations with return > 35%: 1,500

Percentile = (10,000 - 1,500) / 10,000 = 85th percentile

Interpretation:

85th percentile: Better than 85% of simulations
50th percentile: Median result (typical)
15th percentile: Worse than 85% of simulations

Luck Assessment

Percentile Ranges:

>90th: Very lucky (top 10%)
75-90th: Somewhat lucky
25-75th: Typical (skill-based)
10-25th: Somewhat unlucky
<10th: Very unlucky (bottom 10%)

Examples:

Strategy A:
Original: 40% return
Percentile: 92nd
Assessment: Very lucky! ⚠️

Strategy B:
Original: 28% return
Percentile: 55th
Assessment: Typical, robust ✓

Strategy C:
Original: 15% return
Percentile: 8th
Assessment: Unlucky, but strategy may still be good

Robustness Rating

Rating System

Based on:

  • Percentile rank
  • Confidence interval width
  • Consistency across simulations

Ratings:

High Robustness:

Criteria:
- Percentile: 40-60th (near median)
- Narrow CI (coefficient of variation &lt;30%)
- Positive median return

Example:
Original: 25%
Median: 24%
95% CI: [18%, 30%]
Rating: High ✓

Moderate Robustness:

Criteria:
- Percentile: 25-75th
- Medium CI (CV 30-50%)
- Positive median return

Example:
Original: 30%
Median: 25%
95% CI: [10%, 40%]
Rating: Moderate

Low Robustness:

Criteria:
- Percentile: &lt;25th or >75th
- Wide CI (CV >50%)
- Inconsistent results

Example:
Original: 45%
Median: 22%
95% CI: [5%, 60%]
Rating: Low ⚠️

Probability of Ruin

Definition

Ruin: Drawdown exceeding specified threshold (e.g., -50%)

Calculation:

Ruin Threshold: -50% drawdown
Simulations hitting ruin: 150 out of 10,000

Probability of Ruin = 150 / 10,000 = 1.5%

Interpretation

Risk Levels:

<1%: Very low risk
1-5%: Low risk
5-10%: Moderate risk
10-20%: High risk
>20%: Very high risk

Example Analysis:

Strategy A:
Ruin Threshold: -50%
Probability: 0.5%
Assessment: Very safe ✓

Strategy B:
Ruin Threshold: -50%
Probability: 15%
Assessment: Risky, reduce position sizes ⚠️

Risk Management

If Probability High:

Actions:
1. Reduce position sizes
2. Tighten stop losses
3. Lower risk per trade
4. Increase diversification
5. Consider rejecting strategy

Distribution Analysis

Understanding Distributions

Normal Distribution:

Bell curve shape
Most results near median
Symmetric
Predictable

Good sign: Strategy is consistent

Skewed Distribution:

Asymmetric
Long tail on one side
Many small wins/losses, few large ones

Positive skew: Few large wins (good)
Negative skew: Few large losses (bad)

Bimodal Distribution:

Two peaks
Inconsistent performance
Works in some conditions, fails in others

Warning sign: Strategy not robust

Statistical Measures

Mean:

Average of all simulations
May differ from median if skewed

Median:

Middle value (50th percentile)
Better measure for skewed distributions
Use this for expectations

Standard Deviation:

Measure of spread
Higher = more variable outcomes
Lower = more consistent

Coefficient of Variation:

CV = Standard Deviation / Mean

<30%: Low variability (good)
30-50%: Moderate variability
>50%: High variability (risky)

Practical Example

Strategy Setup

Historical Performance:

100 trades over 2 years
Win Rate: 55%
Total Return: 35%
Max Drawdown: 15%
Sharpe Ratio: 1.6

Monte Carlo Results

Configuration:

Simulations: 10,000
Confidence Level: 95%
Ruin Threshold: -50%

Total Return:

Original: 35%
Median: 28%
Mean: 29%
95% CI: [12%, 46%]
Percentile: 78th

Max Drawdown:

Original: 15%
Median: 20%
Mean: 21%
95% CI: [10%, 35%]
Percentile: 25th (better than median)

Sharpe Ratio:

Original: 1.6
Median: 1.3
Mean: 1.3
95% CI: [0.7, 2.0]
Percentile: 72nd

Probability of Ruin:

Threshold: -50%
Probability: 2.3%
Risk Level: Low

Interpretation

Analysis:

Return Percentile: 78th
- Somewhat lucky, but not extreme
- Original result above median but within CI

Drawdown Percentile: 25th
- Better than typical (lower drawdown)
- Favorable risk profile

Sharpe Percentile: 72nd
- Above average risk-adjusted returns
- Somewhat lucky but reasonable

Ruin Probability: 2.3%
- Low risk of catastrophic loss
- Acceptable risk level

Overall Assessment: Moderate Robustness
- Some luck involved (78th percentile)
- But within reasonable range
- Low ruin probability
- Recommend: Deploy with standard position sizes
- Monitor: Track if live performance matches median (28%)

When to Use Monte Carlo

Ideal Scenarios

1. After Backtesting:

Validate backtest results
Assess luck vs skill
Set realistic expectations

2. Before Live Trading:

Understand range of outcomes
Prepare for drawdowns
Size positions appropriately

3. Strategy Comparison:

Compare robustness of different strategies
Choose most consistent approach
Avoid lucky but fragile strategies

4. Risk Assessment:

Calculate probability of ruin
Determine appropriate risk levels
Set stop-loss rules

When Not to Use

Insufficient Trades:

<30 trades: Not enough data
30-50 trades: Marginal
>50 trades: Good
>100 trades: Ideal

Non-Independent Trades:

If trades are correlated (e.g., pyramiding)
Monte Carlo assumes independence
Results may be misleading

Limitations

What Monte Carlo Cannot Do

1. Predict Future:

Based on historical trades
Future may differ
Market conditions change

2. Account for Regime Changes:

Assumes similar market conditions
Cannot predict black swans
Doesn't model structural changes

3. Fix Bad Strategies:

If strategy has no edge
Monte Carlo will show it
But won't make it profitable

4. Replace Live Testing:

Simulation is not reality
Execution differs
Slippage varies
Psychology matters

Assumptions

Monte Carlo Assumes:

  • Trade independence
  • Stationary market conditions
  • Consistent execution
  • No regime changes
  • Historical patterns continue

Reality:

  • Trades may be correlated
  • Markets evolve
  • Execution varies
  • Regimes shift
  • Past ≠ Future

Best Practices

1. Sufficient Simulations

Minimum:

1,000 simulations: Quick check
5,000 simulations: Standard
10,000 simulations: Recommended
50,000+ simulations: Overkill

2. Appropriate Confidence Level

Standard:

95% confidence level
Balances precision and certainty
Industry standard

3. Realistic Ruin Threshold

Common Thresholds:

Conservative: -30% drawdown
Moderate: -40% drawdown
Aggressive: -50% drawdown

4. Multiple Metrics

Analyze:

  • Total return
  • Maximum drawdown
  • Sharpe ratio
  • Profit factor
  • Win rate stability

5. Compare to Median

Use Median, Not Mean:

Median is more robust to outliers
Better represents typical outcome
Use for expectations

6. Document Results

Record:

  • All confidence intervals
  • Percentile ranks
  • Ruin probability
  • Distribution characteristics
  • Interpretation

Summary

Key Takeaways:

  1. Luck vs Skill: Monte Carlo separates genuine edge from luck
  2. Confidence Intervals: Show range of possible outcomes
  3. Percentile Rank: Indicates if result was typical or lucky
  4. Robustness: Near median (40-60th percentile) is best
  5. Ruin Probability: Assess catastrophic loss risk
  6. Distribution: Understand variability of outcomes
  7. Median Matters: Use median for realistic expectations
  8. Sufficient Data: Need 50+ trades minimum
  9. Not Predictive: Based on past, doesn't guarantee future
  10. Complement Testing: Use with backtesting and walk-forward

Monte Carlo Checklist:

  • Sufficient trades (50+)
  • 5,000+ simulations run
  • 95% confidence intervals calculated
  • Percentile rank determined
  • Robustness rating assigned
  • Ruin probability assessed
  • Distribution analyzed
  • Results documented
  • Realistic expectations set