Monte Carlo Backtest: Test a Trading Strategy's Robustness
Short answer: a Monte Carlo test resamples a backtest's trades, usually 1,000 times, to show how much the result depends on their order. It reveals fragility in the trade sequence. It cannot show that a strategy will work later, and it does not replace a test on a period kept out of the search.
The Problem with a Standard Backtest
You run a backtest. Your strategy shows +25% over one year. Great, right? Not so fast.
A standard backtest gives you one single scenario: the one that actually happened. But the market could have behaved differently. The trades could have occurred in a different order. Is that +25% the result of a solid strategy, or just luck from a favorable trade sequence?
That's exactly what Monte Carlo simulation answers.
What Is a Monte Carlo Simulation?
The concept is simple: instead of testing your strategy once, you test it thousands of times by reshuffling the trade order for each simulation.
The idea comes from Stanislaw Ulam, a Manhattan Project mathematician, who realized that to estimate complex probabilities, you could simply simulate the process many times and observe the distribution of outcomes.
In trading, this translates to:
- Take the actual trades from the backtest (e.g., 50 trades)
- Randomly reshuffle them (bootstrap resampling)
- Replay the strategy with this different order
- Repeat 1,000 times
- Analyze the distribution of results
If your strategy is solid, it should be profitable in most scenarios, not just the one that actually occurred.
The Algorithm Used on Strategy Arena
Our implementation uses bootstrap resampling, a robust statistical method. Here's how it works in detail.
Step 1: Trade Extraction
We extract the dollar PnL of each trade from the original backtest. Not the percentage — the actual dollar amount. This is crucial for strategies like DCA or fractional position sizing that invest variable amounts.
Trade 1: +$150
Trade 2: -$80
Trade 3: +$220
Trade 4: -$30
...
Trade 50: +$95
Step 2: Bootstrap (Sampling with Replacement)
For each simulation, we randomly draw 50 trades from the original 50, with replacement. This means the same trade can be drawn multiple times, and some trades may not be drawn at all.
This is the key to bootstrap: we create thousands of plausible trade sequences from the actual data.
Step 3: Building the Equity Curve
For each trade sequence, we build an equity curve starting from the initial capital ($10,000) and adding each trade's PnL:
Capital = $10,000
Trade 1: +$150 -> Capital = $10,150
Trade 2: +$220 -> Capital = $10,370
Trade 3: -$80 -> Capital = $10,290
...
We use an additive model (adding dollar PnL) rather than multiplicative (multiplying by return). Why? Because the additive model is more realistic for strategies that invest a fixed amount per trade, like DCA which invests the same sum every week.
Step 4: Per-Simulation Metrics
For each of the 1,000 simulations, we calculate:
- The final capital
- The max drawdown (the largest drop from a peak to a trough)
Step 5: Distribution Analysis
We get 1,000 final capitals and 1,000 max drawdowns. We then calculate:
- Probability of profit: % of simulations ending above initial capital
- Probability of ruin: % of simulations losing more than 50% of capital
- Percentiles: P5 (worst 5%), P25, P50 (median), P75, P95 (best 5%)
- Robustness score: a 0-100 score combining probability of profit, consistency, and survival
The Robustness Score
This is the most important metric. It combines three factors:
| Factor | Weight | What it measures |
|---|---|---|
| Probability of profit | 40% | Does the strategy win more often than it loses? |
| Consistency | 30% | Are results clustered or spread out? |
| Survival | 30% | Does the strategy avoid total ruin? |
Interpretation:
- 80-100: Very robust strategy, profitable in nearly all scenarios
- 60-80: Solid strategy with good probability of profit
- 40-60: Average strategy, uncertain results
- 20-40: Fragile strategy, performance depends heavily on luck
- 0-20: Dangerous strategy, high probability of loss
How to Use It on Strategy Arena
- Go to the Backtest page
- Select a strategy and an asset (BTC, ETH, SOL, etc.)
- Run the backtest
- Click Monte Carlo in the results
You'll see:
- A histogram of final capitals (the probability "bell curve")
- Sample equity curves (5 possible trajectories)
- Percentiles (in 95% of cases, you'll end between P5 and P95)
- The overall robustness score
Common Pitfalls
Don't Confuse Monte Carlo with Backtesting
Monte Carlo does not test your strategy on new data. It tests what would happen if the same trades occurred in a different order. It's a robustness test, not a future performance predictor.
The Survivorship Bias
If your strategy has very few trades (fewer than 10), Monte Carlo isn't reliable. You need a sufficient sample for the bootstrap to be representative.
Overfitting Remains Invisible
An over-optimized strategy (one that perfectly fits historical data) can have an excellent Monte Carlo score while performing poorly in live trading. Monte Carlo tests the robustness of the trade sequence, not the validity of the strategy itself.
What Monte Carlo Cannot Replace: a Test on Unseen Data
Monte Carlo reshuffles trades that already happened. If the rule was tuned on that same history, every reshuffled path inherits the tuning. Two checks answer a different question, "does the rule hold on data it has never seen?":
- A sealed period. Cut the history in time order, choose the rule on the first part only, then open the final part once. In Strategy Arena Lab (free, Windows and Linux) the seal is written to disk before any computation, and every variant you tried is counted.
- A count of attempts. Trying 100 variants and keeping the best one inflates its Sharpe ratio. The Lab reports the probability of backtest overfitting (PBO) and a Sharpe ratio deflated by the number of attempts, and runs a Monte Carlo of its own on the result. Its verdict can be "inconclusive".
The same judge is used on the sealed AI trading leaderboard, where AI models built Bitcoin strategies and were scored on a period they could not read. You can also let your own AI drive the Lab through its local MCP server. For a step-by-step method on TradingView strategies, read how to test a Pine strategy out of sample for free.
Conclusion
Monte Carlo simulation is a powerful tool to go beyond a simple backtest. It turns one result ("did my strategy work on this sequence?") into a distribution ("how far does the result move when the trades are resampled?"). It says nothing about trades the strategy has not made yet.
On Strategy Arena, a backtest can be followed by a Monte Carlo analysis.
Source for the method: Efron, B. (1979). "Bootstrap Methods: Another Look at the Jackknife". The Annals of Statistics, 7(1), 1-26. doi.org/10.1214/aos/1176344552
Test Monte Carlo on your favorite strategies: Run a backtest
Test your own Pine strategy on a sealed period: free online judge.
⚠️ Disclaimer — This article is for informational and educational purposes only. It does not constitute investment advice or a buy/sell recommendation. Past performance does not guarantee future results. Strategy Arena is an educational simulator with virtual capital. Always do your own research before making investment decisions.