Monte Carlo Backtesting: Risk of Ruin, Losing Streaks and Sequence Risk
Backtest Robustness · BT04
Monte Carlo Backtesting: Risk of Ruin, Losing Streaks and Sequence Risk
Monte Carlo backtesting is not a tool for predicting the future. By reordering or resampling your observed trade results, it draws the distribution of the “other paths that could have happened” for the same underlying edge, so you can read risk of ruin, losing streaks and sequence risk descriptively. This guide walks through the worse-case scenarios a single equity curve cannot show, using illustrative educational data and clearly labelled figures.
- Why one curve hides sequence risk
- Shuffling vs bootstrap vs stress tests
- Reading percentile bands, drawdown and streaks
- Defining ruin, plus assumptions and limits
Key takeaways
- Monte Carlo analysis is not a forecast; it is a descriptive way to view the distribution of outcomes when observed trades are reordered or resampled.
- A single equity curve is just one example of a “lucky ordering.” Change the sequence and maximum drawdown and losing streaks can shift dramatically.
- The main methods are sequence shuffling, bootstrap resampling and stress tests. Interpretation depends on what each one changes.
- “Ruin” is not limited to a zero balance; it is defined by an arbitrary loss threshold, so the threshold must always be stated explicitly.
- Every figure here is illustrative educational data, not a recommendation of any position size or “optimal” value.
Open table of contents
What Monte Carlo backtesting is (the short answer)
Monte Carlo backtesting takes trade results you have already observed (a list of wins and losses) and, by reordering them or repeatedly drawing from the same set, generates a large number of “other paths that the same edge could have produced” and reads their distribution. The goal is not to predict future markets, but to put your single equity curve in context: how lucky or unlucky was its particular ordering? That is the first premise to internalise.
For example, across the same 200 trades, an ordering where losses arrive in a cluster erodes the account deeply along the way, while an ordering where losses are spread out produces a gentler curve. The total profit is identical, yet whether the account can withstand the journey depends on the sequence. Monte Carlo is the tool that visualises this “luck of the ordering” as hundreds to thousands of paths. If you first want the full picture of a trade list exported from the TradingView Strategy Tester or a generic CSV, the complete TradingView backtesting workflow puts this lesson in context.
Monte Carlo analysis is descriptive. It shows variability within the assumptions of reordering and resampling observed data; it does not guarantee or predict future win rate, profit or drawdown. Every number that follows is illustrative educational data and is not a recommendation of any trade, position size or parameter.
Why one equity curve hides sequence risk
When you view a backtest as a single equity curve, your eye is drawn to the upward shape and the final gain. But what actually matters in live operation is “how deeply could it sink along the way?” One curve is merely a single sample among countless orderings that could have occurred. It is not unusual for a single re-draw of the order to multiply the maximum drawdown several times over.
The figure below overlays, for the illustrative educational dataset (Strategy A: 200 trades, 46% win rate, average win +1.9%, average loss −1.3%, all as fictional values relative to equity), the original trade order and three paths where only the order has been shuffled. Although the final equity level (around account index 158) is almost the same, the depth of the troughs along the way is entirely different. Because shuffling the order does not change the total profit, it lets you compare the “luck of the ordering” in isolation.
Whether you can handle this “distribution of trough depths” is the dividing line for robustness testing. For how to read maximum drawdown itself, see the guide to maximum drawdown and recovery, and for core metrics such as profit factor and expectancy, see how to read backtest results.
Three common methods: shuffle, bootstrap and stress
“Monte Carlo” can mean different things depending on what is being changed. Let us distinguish the three families used most often in practice; confusing them leads to misreading the results.
1. Sequence shuffling (reordering)
Reorder the original trades without replacement. The set of trades is unchanged, so total profit is constant and only the sequence changes. What to look at, therefore, is “how far can the maximum drawdown or losing streak along the way worsen depending on the ordering?” The distribution of final equity is narrow, and the drawdown distribution takes centre stage.
2. Bootstrap (resampling with replacement)
Draw randomly from the original trades with replacement to build a new trade sequence. The same win may be selected several times, or a large loss may never be selected, so the composition of trades itself changes and the final profit varies too. This is well suited to examining the uncertainty of a small sample and the degree of reliance on outlier trades.
3. Stress (loads on P&L or costs)
Add spread, commission and slippage-equivalent loads to each trade’s result, or discount the gains slightly, to see how outcomes worsen when cost assumptions tighten. Cost sensitivity is covered in detail in how to model slippage, spread and fees. Combining stress with Monte Carlo lets you examine compound scenarios where “the ordering is bad and costs are heavy” at the same time.
| Method | What changes | Final profit | Main metric | Question it fits |
|---|---|---|---|---|
| Sequence shuffle | Order only | Nearly constant | Max DD, streaks | Was I helped by a lucky ordering? |
| Bootstrap | Trade composition | Varies | Final equity, tails | Is there sample bias or outlier reliance? |
| Stress | P&L / costs | Shifts downward | Expectancy decay | Does it break under heavier costs? |
Draw this distribution from your own CSV
The sequence shuffle and bootstrap covered so far can be run for free simply by importing a CSV or XLSX into the TradingView Backtest & Robustness Lab. Check the percentile bands and drawdown distribution on your own trade data.
Reading the distribution: median, percentiles, max drawdown and streaks
When bootstrap generates thousands of paths, final equity and maximum drawdown become a distribution rather than a single value. Percentiles are what help here. The median (50th percentile) is the “middle path,” while the 5th percentile represents the level “one in twenty counting from the bad side.” Reading not only the upper tail (95th percentile) but treating the lower tail (5th percentile) as the main character is the essence of risk testing.
Summarised as numbers, the table below results. The point is to view the distribution of maximum drawdown and maximum losing streak alongside final equity, not final equity alone. Even with a healthy median, if the P95 maximum drawdown or worst streak is too large for your capital plan, adopting the strategy as-is would be premature.
| Metric | P5 (bad tail) | P25 | Median | P75 | P95 (good tail) |
|---|---|---|---|---|---|
| Final equity (account index) | 118 | 141 | 158 | 176 | 203 |
| Maximum drawdown | −12% | −15% | −18% | −24% | −31% |
| Maximum losing streak | 4 | 5 | 6 | 8 | 11 |
How to read the table: for maximum drawdown and maximum losing streak, P95 is the “bad side” (larger is harsher). For final equity, P5 is the “bad side.” Note that the direction of the tail flips depending on the metric. All figures are illustrative educational data.
Risk of ruin: definition and interpretation
Risk of ruin is “the proportion of paths that touch, at least once, a state where operation can no longer continue.” The most important thing here is the definition of “ruin.” Many people picture a zero balance, but in practice operation stops well before that. So we define “ruin” as an arbitrary loss threshold relative to the starting capital, and count the proportion of paths that touch that threshold. A risk-of-ruin number with no stated threshold is meaningless.
Here we define “ruin” as “a state where account equity touches a specified loss threshold relative to the start, at least once” (for example, a −25% threshold is account index 75, and a −40% threshold is index 60). A zero balance is not the only definition. Risk of ruin is the number of paths that touch this threshold divided by the total number of paths. Change the threshold and the probability changes too.
The ruin threshold and maximum drawdown are similar but not the same. Maximum drawdown is a value measured after the fact, “how deeply did it ultimately sink?”; the ruin threshold is a horizontal line drawn in advance, “if you touch this, operation ends.” The figure below shows this difference. If a path’s maximum drawdown is shallower than the threshold it survives; if it breaks below the threshold it is counted as ruin.
Listing risk of ruin by threshold shows that the deeper the threshold, the lower the probability. In the Strategy A example, a −25% threshold gives about 8%, and a −40% threshold about 1.5% (all illustrative educational data). Whether that number is “acceptable” depends on your capital plan and operating rules; there is no universal pass line. That is exactly why you should avoid firm claims such as “this probability is safe” or “it will always be fine,” and instead read by comparing scenarios across several thresholds.
| Ruin definition (vs start) | Account-index threshold | Share touching the threshold (risk of ruin) |
|---|---|---|
| Stop at −15% | 85 | ≈24% |
| Stop at −25% | 75 | ≈8% |
| Stop at −40% | 60 | ≈1.5% |
Losing streaks and capital allocation
Losing streaks are closely tied to risk of ruin. The maximum streak observed in a single backtest (say, 7 in a row) is just one example among the streaks that could have occurred. Taking the distribution of streak lengths with Monte Carlo, Strategy A extends from a median of 6 in a row to 11 at the 95th percentile and 14 in the worst case (illustrative educational data). In other words, keeping a mental note that “the observed maximum streak could run roughly 1.5 to 2 times larger” makes it easier to size the margin in a capital allocation.
The impact of a losing streak on capital is determined by the risk taken per trade. We do not recommend any particular position size or “optimal” risk fraction here. Purely as a scenario comparison, the table lists how the erosion of equity changes for the same streak when the per-trade risk is varied. To estimate the actual loss amount, the FX & CFD lot size calculator is useful.
| Risk per trade | Approx. erosion at a 6-streak | Approx. erosion at an 11-streak |
|---|---|---|
| 0.5% | ≈ −3% | ≈ −5% |
| 1.0% | ≈ −6% | ≈ −10% |
| 2.0% | ≈ −11% | ≈ −20% |
This table does not show “which risk lets you win”; it is a comparison to see that the same streak produces completely different resilience depending on the risk taken. Read it together with the risk-of-ruin table (Table 3), working backwards from the trough depth you can tolerate to choose a scenario.
Feel the distribution with an educational mini simulator
You can check the distributions above hands-on with a fixed-seed educational simulator. Enter the average win, average loss, win rate, trade count and iteration count, and it generates multiple paths entirely inside your browser, computing the median, the 5th and 95th percentiles, the median maximum drawdown and the risk of ruin (−25% threshold). Your inputs and results are never sent over the network. It is teaching material for building a feel for the distribution, not a recommendation of live values.
Static worked example if JavaScript is disabled: with average win +1.9%, average loss −1.3%, 46% win rate, 200 trades and 2,000 iterations (illustrative educational data), the median final equity is account index 158, the 5th percentile is 118, the 95th percentile is 203, the median maximum drawdown is −18%, and the risk of ruin at the −25% threshold is about 8%. This is the same example as Tables 2 and 3. The interactive tool below starts from this static example and recalculates the distribution as you change the inputs.
Fixed-seed mini Monte Carlo (educational)
Raising the iterations from 100 to 2,000, you will see the median barely move while tail measures such as P5 and risk of ruin gradually stabilise. That is the felt sense of the principle “increase iterations to read the tails.” Note, too, that if you cut the trade count to an extreme, the distribution stays wide no matter how many iterations you run.
Reading it in four steps
Confirm assumptions
Decide source-data quality, cost assumptions and the ruin threshold first. Do not read numbers whose definition is still vague.
Read the centre
Use the median to grasp the “middle path.” This is a reference point that leans neither optimistic nor pessimistic.
Read the bad tail
Use P5, the P95 of max DD, the worst streak and risk of ruin to confirm the trough depth you must endure.
Match to capital
Compare scenarios for whether an allocation could continue through that trough. Not a specific-lot recommendation, but several options.
Assumptions and limits of Monte Carlo
Monte Carlo is powerful but not all-purpose. To avoid misreading it, let us state the assumptions and limits explicitly.
- The IID assumption: simple shuffling and bootstrap assume each trade is independent and drawn from the same distribution. If real trades have trend dependence or clustering, this assumption breaks and the distribution can become optimistic.
- The stationarity assumption: a past P&L distribution does not necessarily continue into the future. If the market regime changes, a distribution built from past data will not carry over as-is. Regime and out-of-sample testing are complemented by walk-forward analysis and out-of-sample testing.
- Small samples: with few original trades the sample itself is biased, and resampling leaves the uncertainty large. Asserting the tails from only a few dozen records is dangerous.
- Relationship to overfitting: feeding results inflated by optimisation straight into Monte Carlo skews the whole distribution toward optimism. For confirming parameter stability, see how to detect overfitting with parameter stability.
A Monte Carlo output is a “mirror of the P&L data and assumptions you fed it.” If the source data is generous, the distribution is generous too. Not over-trusting the method, and reading it as a set with costs, data quality and out-of-sample testing, is the premise for putting sequence-risk testing to practical use.
Practical checklist and the SG Group Lab workflow
Finally, here are the items to check before and after using Monte Carlo, together with the workflow from a CSV in the SG Group Lab.
Checklist before reading
- Is the source-data quality sufficient (trade count, period, gaps, duplicates, presence of outliers)?
- Have cost assumptions such as spread, commission and slippage been applied?
- Did you define the ruin threshold in advance (compare several, such as −15% / −25% / −40%)?
- Did you choose by purpose whether you are viewing sequence risk (shuffle) or sample uncertainty (bootstrap)?
- Are the tail measures (P5, P95 of max DD, worst streak, risk of ruin) stable across the iteration count?
Workflow in the Lab
- Import: load a TradingView Strategy Tester export (CSV/XLSX) or a generic CSV with column mapping.
- Basic analysis: grasp the overall picture with core KPIs and equity / drawdown.
- Monte Carlo: confirm percentile bands and the max-drawdown distribution with sequence shuffle and bootstrap.
- Risk of ruin: set several ruin thresholds and read the risk of ruin and streak distribution for each.
- Stress: add loads to costs and P&L and confirm the worsening under compound scenarios.
Once you reach the stage of wanting to save and compare later, line up strategy versions, or dig deeper into return distributions and drawdown, the Pro features apply; if you want to go as far as walk-forward, parameter stability and multi-strategy portfolios, the Premium features cover that. Starting point: run everything from basic analysis through Monte Carlo, risk of ruin and stress on the free plan first.
Read risk of ruin while varying the threshold
The simulator in this article is for feeling the concept. When you want to check risk of ruin, streak distributions and stress results by threshold on your actual trade CSV, head to the free Analysis Lab. Consider Pro or Premium in steps once saving or strategy comparison becomes necessary.
Frequently asked questions
Is Monte Carlo analysis a forecast?
No, it is not a forecast. It reorders or resamples your observed trade results to show, descriptively, how much outcomes could vary for the same underlying edge. Because there is no guarantee that future markets follow the same distribution as the past, the output is only a distribution within your assumptions; it does not fix the future range of expectancy or drawdown.
Why shuffle the order of trades?
Because the same set of wins and losses can produce very different maximum drawdowns depending on whether losses cluster together or spread out. Shuffling the order keeps the total profit and loss unchanged, but studying the resulting equity paths and drawdown distribution reveals whether a single result was quietly helped by a lucky ordering.
What is the difference between bootstrap resampling and shuffling?
Shuffling reorders the original trades without replacement, so the final profit is constant and only the sequence effect is examined. Bootstrap resampling draws from the original trades with replacement, so the composition of trades changes and the final profit varies too. Use shuffling to study sequence risk, and bootstrap to study sampling variability and the uncertainty of a small sample.
What does “ruin” mean in risk of ruin?
Ruin does not only mean a zero balance. It is common to define ruin as touching any loss threshold that would stop the operation, for example minus 25 percent or minus 40 percent from the starting capital, at any point during the run. Because the probability changes sharply with where the threshold sits, always confirm the definition before reading the number.
How many simulation runs are enough?
Central measures such as the median stabilise within a few hundred iterations, but tail measures such as the 5th percentile or the probability of ruin become more stable as iterations increase. A practical approach is to raise the iteration count in steps until the tail numbers stop moving, while remembering that a small original trade count leaves uncertainty no matter how many iterations you run.
How should I interpret losing streaks?
The maximum losing streak observed in a single backtest is just one example among many streaks that could have occurred. Use Monte Carlo to view the distribution of streak lengths and check how far the 95th percentile and the worst case extend. Use that as material to compare whether a capital allocation could survive such a streak during live operation.
Can Monte Carlo be used with a small trade sample?
It can, but interpretation needs care. With few trades the original sample is easily biased, and resampling leaves the uncertainty large. When the sample is small, treat the distribution width as wide, avoid firm conclusions, and combine it with additional data or out-of-sample testing.
How often can I run Monte Carlo on the free plan?
The SG Group TradingView Backtest & Robustness Lab includes Monte Carlo, risk of ruin and stress tests on the free plan. Usage terms can change, so confirm the current scope on the plan page. Consider Pro or Premium once you need saving, strategy comparison or deeper distribution analysis.
Disclaimer
This article explains, for educational purposes, how to think about descriptive analysis and visualisation of backtest data you have loaded. It is not investment advice, a buy/sell signal, a forecast or a profit guarantee. All figures, diagrams and tables shown are illustrative educational data and do not represent real performance, user numbers or conversion rates. Backtest results do not guarantee future performance, and conclusions change when assumptions, data quality, costs or market conditions change. We do not recommend any specific instrument, position size or parameter. SG Group features, free scope and pricing may change, so check the latest information on the plan page. TradingView names, UI and specifications belong to their respective owners and do not imply any partnership, certification or endorsement.

