Skip to content

Monte Carlo Simulation

You have run a backtest and the results look promising. But how confident should you be? Would the strategy still work if the trades had come in a different order? What if your parameters were slightly off? Monte Carlo simulation answers these questions by running your strategy through thousands of randomized scenarios.

If backtesting tells you what happened, Monte Carlo tells you what could have happened — and what is likely to happen going forward.

A single backtest gives you one path through history. But that exact sequence of trades will never repeat. In live trading, you might encounter the same trades in a different order, with slightly different fills, or with parameters that are a bit off from your optimized values.

Monte Carlo simulation takes your backtest results and deliberately scrambles them to explore a wide range of possible outcomes. This helps you answer critical questions:

  • How likely am I to experience a severe drawdown? Your backtest might show a 15% max drawdown, but across 1,000 randomized scenarios, 10% of them might hit 30%+.
  • What is the range of realistic outcomes? Instead of one equity curve, you get confidence bands showing the best, worst, and most likely paths.
  • Is my strategy robust or fragile? If small changes to parameters or trade ordering dramatically change the results, the strategy is likely overfit.
  • What is my probability of ruin? Given your position sizing, how likely is it that you would blow up your account?

Stratifyre offers two distinct Monte Carlo approaches, each testing a different aspect of robustness.

This mode takes the actual list of trades from your backtest and randomly reshuffles their order. It then rebuilds the equity curve using the trades in the new randomized sequence.

What it tests: Whether your results depend on the specific order in which trades occurred. A robust strategy should produce acceptable results regardless of trade sequencing.

How it works:

  1. The engine takes all completed trades from your backtest.
  2. It randomly draws trades (with replacement) to create a new sequence of the same length.
  3. It rebuilds the equity curve using the resampled trade sequence.
  4. This process repeats 1,000+ times, generating 1,000+ different equity curves.
  5. Results are aggregated into confidence bands and statistics.

When to use it: This is the more commonly used mode. It is a good general-purpose robustness check.

Parameter Perturbation (Sensitivity Analysis)

Section titled “Parameter Perturbation (Sensitivity Analysis)”

This mode takes your strategy’s parameters (indicator periods, thresholds, stop-loss levels, etc.) and slightly adjusts them in random directions. It then re-runs the full backtest with each perturbed parameter set.

What it tests: Whether your results are stable when parameters change slightly. If shifting your RSI period from 14 to 13 or 15 completely changes the outcome, the strategy is fragile and likely overfit to the specific parameter values.

How it works:

  1. The engine identifies all tunable parameters in your strategy.
  2. For each simulation, it randomly adjusts each parameter by a small percentage (for example, plus or minus 10-20%).
  3. It re-runs the full backtest with the perturbed parameters.
  4. Results are collected across all simulations.
  5. Sensitivity metrics show which parameters have the most impact on performance.

When to use it: After you have optimized your strategy’s parameters and want to verify that the optimal values are not sitting on a fragile peak. Ideally, your strategy should perform well across a neighborhood of parameter values, not just at one precise setting.

  1. Complete a backtest first. Monte Carlo runs on top of existing backtest results.
  2. Open the Monte Carlo panel from the results page by clicking the Monte Carlo button.
  3. Choose your mode: Trade Resampling or Parameter Perturbation.
  4. Set the number of simulations. More simulations give more precise confidence bands. 1,000 is a good default. You can go up to 10,000 for extra precision, though it takes longer.
  5. For Parameter Perturbation, set the perturbation range — how much each parameter can deviate (for example, plus or minus 15%).
  6. Click Run. The engine processes all simulations and presents the results.

The primary visualization is a fan chart showing your equity curve with confidence bands at multiple percentiles:

  • 5th percentile — The “worst realistic case.” 95% of simulations performed better than this line.
  • 25th percentile — A below-average but not terrible outcome.
  • 50th percentile (median) — The middle outcome. Half of simulations did better, half did worse.
  • 75th percentile — An above-average outcome.
  • 95th percentile — The “best realistic case.” Only 5% of simulations beat this line.

What to look for:

  • A wide fan means there is a large range of possible outcomes — more uncertainty.
  • A narrow fan means the strategy performs consistently regardless of trade ordering or parameter tweaks.
  • If the 5th percentile line ends below your starting capital, there is a meaningful probability of losing money even though the median is profitable.

A histogram and statistics showing the distribution of maximum drawdowns across all simulations.

What to look for:

  • The median max drawdown tells you what drawdown to realistically expect.
  • The 95th percentile max drawdown tells you what the worst plausible drawdown looks like.
  • If your backtest showed a 12% max drawdown but 10% of simulations hit 25%+, you should plan for a 25% drawdown — not 12%.

The percentage of simulations where the account equity dropped below a specified ruin threshold (for example, 50% of starting capital).

What to look for:

  • A probability of ruin above 5% is a serious warning sign.
  • Even 1-2% is worth taking seriously — it means in 1 out of 50-100 realistic scenarios, you would lose half your capital.
  • If probability of ruin is zero across 1,000+ simulations, the strategy has strong survival characteristics.

A histogram showing where the account balance ended up across all simulations.

What to look for:

  • The distribution should be right-skewed (more simulations ending with higher balances).
  • Check the left tail — what is the worst-case final equity? Could you accept that outcome?

Sensitivity Report (Parameter Perturbation Only)

Section titled “Sensitivity Report (Parameter Perturbation Only)”

For parameter perturbation mode, an additional report shows which parameters had the most impact on results.

What to look for:

  • Parameters with high sensitivity are the ones where small changes cause large swings in performance. These are your fragile points.
  • Ideally, no single parameter should dominate the results. The strategy should be robust across reasonable parameter ranges.

Curve fitting (also called overfitting) happens when a strategy’s parameters are tuned so precisely to historical data that they capture noise rather than genuine patterns. The strategy looks fantastic in backtesting but fails in live trading.

Monte Carlo simulation helps detect curve fitting in several ways:

  • Parameter perturbation collapses results. If a 10% change to your RSI period turns a profitable strategy into a losing one, the original parameters are almost certainly overfit.
  • Wide confidence bands. If trade resampling shows a huge range between the 5th and 95th percentile, the strategy is fragile.
  • High probability of ruin. An overfit strategy often has hidden ruin scenarios that only appear when you scramble the trade order.
  • Original backtest is near the 95th percentile. If your original backtest result sits at the top of the Monte Carlo distribution rather than near the median, you got lucky with the specific historical sequence. That luck will not repeat.

If Monte Carlo results suggest curve fitting:

  1. Simplify your strategy. Reduce the number of parameters and conditions. Simpler strategies are more robust.
  2. Widen your parameter ranges. Instead of RSI = 14 exactly, verify the strategy works with RSI from 10 to 18.
  3. Test on more data. A strategy that works across 15 years is less likely overfit than one tested on 2 years.
  4. Remove recently added optimizations. The last few tweaks you made are the most likely to be overfitting.
  • Always run Monte Carlo before trusting a backtest. A single backtest without Monte Carlo validation is incomplete.
  • Use both modes. Trade resampling and parameter perturbation test different aspects of robustness. A strategy should pass both.
  • Focus on the 5th percentile, not the median. Plan your risk management for the realistic worst case, not the expected case.
  • Run at least 1,000 simulations. Below this, the confidence bands are not precise enough.
  • Compare the probability of ruin to your actual risk tolerance. If you cannot tolerate a 40% drawdown, make sure the Monte Carlo results show that outcome is extremely rare.