Skip to content

Backtesting

Monte Carlo Simulation in Trading: Shuffles and Drawdowns

A Monte Carlo simulation in trading repeatedly draws hypothetical trade sequences or market paths from a specified model. Trade-order shuffling and bootstrap resampling can show how drawdowns and losing streaks vary under that model. The results depend on the input sample, sizing rules and dependence assumptions. They do not establish the probability of future trading outcomes without those assumptions holding.

Illustrative cover for Monte Carlo trading simulation showing two different orderings of the same positive and negative trade symbols.
Reordering a fixed sample changes the path; resampling can also change its composition.

Monte Carlo trading simulation at a glance

Scroll horizontally to read every column.

Method or output Meaning
Trade-order shuffle Reorder the same trades without replacement; each appears once.
Trade bootstrap Draw trades with replacement; a trade may appear repeatedly or be omitted.
Drawdown distribution The largest peak-to-trough decline measured separately for each hypothetical path.
Streak distribution The longest run of consecutive losses measured separately for each path.
Conditional result An answer about the chosen simulation model, not an unconditional market forecast.

The bootstrap resampling framework originates with Bradley Efron's Bootstrap Methods: Another Look at the Jackknife.[1] In the backtesting process, these simulations examine variation in a supplied sample. They do not replace tests of whether the strategy generalises.

What is the difference between shuffling and resampling?

Shuffling changes order. A shuffled path contains every original trade exactly once. If the inputs are fixed cash outcomes, with no size changes or additional path-dependent costs, their sum stays constant. The final balance stays constant too, although the sequence of peaks and troughs can change.

Bootstrap resampling changes composition as well as order. Sampling with replacement means the same historical observation can be drawn more than once. Other observations may not appear at all. With a fixed number of draws, both the final total and the route to it can vary.[1]

A bootstrap path containing a repeated trade is a statistical sample, not a claim that the same market event could literally occur twice. An empirical bootstrap also draws only values present in its input sample. It cannot invent an individual loss more severe than those supplied unless another modelling step allows one.

How are simulated drawdown and streaks calculated?

For the worked example, the account is flat after every trade and outcomes are fixed cash amounts. Let E0 be starting equity and xi the net cash change from trade i. At each trade-close checkpoint:

Et = E0 + sum of xi through trade t

Maximum drawdown % = max over time of (running peak equity − equity) ÷ running peak equity × 100

Include starting equity in the running peak. The formula follows the peak-to-trough convention used for relative drawdown in MT5's report.[3] Maximum currency drawdown instead takes the largest running-peak-minus-current-equity amount, without dividing by the peak.

At these flat checkpoints, equity equals balance. The example therefore measures trade-close drawdown only. Floating losses within a trade are absent. MT5 reports balance and equity drawdown separately; the drawdown guide explains why the sampling basis matters.[3]

For a losing streak, count consecutive negative outcomes and save the longest run in each path. State how zero-result trades are treated; here a non-negative outcome ends a losing run. The example contains no zero outcomes.

Worked example: the same four trades in six orders

Illustrative numbers, not a recommendation or a strategy result. Start with 1,000 currency units and four invented net cash changes: +100, +100, −100 and −100. Treat size and costs as unchanged when reordering. Every trade closes before the next one opens.

There are 4! ÷ (2! × 2!) = six distinct orderings of these values. Because the example is so small, enumerate all six instead of drawing a random subset. This gives an exact benchmark for the shuffle model; Monte Carlo shuffling would approximate its frequencies with repeated random draws.

Measure Alternating losses and gains Losses grouped first
Trade order −100, +100, −100, +100 −100, −100, +100, +100
Checkpoints, including start 1,000; 900; 1,000; 900; 1,000 1,000; 900; 800; 900; 1,000
Maximum currency drawdown 100 200
Maximum percentage drawdown 100 ÷ 1,000 × 100 = 10% 200 ÷ 1,000 × 100 = 20%
Longest losing streak One trade Two trades
Final balance 1,000 1,000

Across all six distinct orderings, three have a maximum currency drawdown of 100 units and three have 200 units. Three have a longest losing streak of one trade; three have a longest streak of two. All finish at 1,000 because the four cash changes sum to zero.

Under uniform random shuffling, 3 ÷ 6 = 50% of the possible orderings have a 200-unit maximum drawdown. The denominator is these six toy orderings. The percentage is not the probability that an actual trading account will experience that drawdown.

Illustrative comparison of two orders of the same four toy trades: alternating losses have a 100-unit drawdown, grouped losses have 200, and both end at 1,000.
Invented fixed cash changes. The two examples share a final total but differ in trade-close drawdown and losing streak. No intratrade path is modelled.

A bootstrap draw can instead be −100, −100, −100, +100, because replacement permits repeated losses. Its final balance is 1,000 − 300 + 100 = 800. A shuffle of the original four trades cannot contain three losses; it has only two to reorder.

How should you read a Monte Carlo backtest report?

A reproducible report identifies the source sample, path length, sampling method, starting capital, sizing rule, cost treatment, number of simulated paths and random seed. It also states whether it measures trade-close balance or continuously marked equity.

Read each distribution as an answer to its own question:

  • Final balance: varies under bootstrap sampling, but not under the fixed-cash shuffle described above.
  • Maximum drawdown: records the largest decline within each path, rather than the decline at one selected checkpoint.
  • Longest losing streak: records one maximum per path, not the probability of losses starting at one particular trade.
  • Boundary crossings: count paths that reach a defined limit at any point during a specified horizon.

Simulated boundary-crossing frequency = paths that cross the defined boundary ÷ total simulated paths

Define whether touching the boundary counts, and whether a path stops there or continues. Those choices change the question. A risk-of-ruin calculation also needs an explicit ruin definition, horizon and sizing model; it is not automatically supplied by a drawdown percentile.

An upper percentile describes the ordered outputs of the chosen model. It is not an upper bound on live losses. More simulated paths reduce random sampling variation in that model's estimated distribution; they do not create more independent historical evidence.

Which assumptions can make the simulation misleading?

Dependence between trades matters. Unrestricted shuffling treats orders as exchangeable, meaning rearrangements are treated as equally admissible. The simple trade bootstrap draws independently from one empirical distribution. Both discard meaningful serial structure if the original outcomes contain it.

Losses may cluster during particular conditions, and overlapping positions can share the same market move. Resampling single trades independently can remove those relationships. Time-series block resampling keeps adjacent observations together and can preserve some local dependence; fixed and randomly sized blocks are documented resampling methods.[2] Block length remains an assumption.

The future must be meaningfully represented by the sample. A simulation drawn from a limited history cannot show a market shock absent from that history. A separate scenario model can introduce different losses or costs, but its outputs then depend on those added assumptions.

Size and execution may depend on the path. Equity-based sizing, margin constraints, overlapping positions or rules that pause after losses require recalculating the process. Reusing old cash outcomes without those mechanisms models a different system. Keep the units explicit if the source data uses returns or R-multiples instead of cash.

The supplied trades may already be selected. Resampling trades from an overfit strategy preserves the development sample's bias. Use out-of-sample testing and a declared walk-forward process to address selection and chronological transfer separately.

Where do TradingView, MT5 and PineConnector enter the process?

As of 25 September 2026, TradingView documents a CSV download from the strategy report's Trades tab. Its default range retains detailed information for the latest 9,000 trades; Deep Backtesting retains all trades in its selected range.[4] Confirm the exported coverage before treating a file as the complete sample.

When constructing a sample from MT5 records, define a completed trade consistently. An order can produce multiple deals, and several deals can affect one position.[5] Treating partial fills or partial closes as independent strategy trades can change both the sample size and streak calculation.

A shuffled trade file says nothing about whether a TradingView alert reached MT5. PineConnector's setup test distinguishes the Alerts log, Bridge processing and broker verification.[6]

The execution sequence has separate evidence: condition true, alert triggered, webhook delivered, PineConnector signal processed, EA request sent, broker request accepted, deal executed and position established or changed. A simulation of closed outcomes does not test those stages, nor whether an exit existed at the broker or only in strategy logic.

Frequently asked questions

What does a Monte Carlo simulation tell you about a trading strategy?

A Monte Carlo simulation shows how selected outcomes vary across hypothetical paths generated by a stated model. Trade-based versions commonly examine drawdown, losing streaks and boundary crossings. Their interpretation depends on the source sample, dependence assumptions, sizing and costs. The outputs do not establish future market probabilities independently of those assumptions.

What is the difference between trade shuffling and bootstrapping?

Trade shuffling reorders the original trades without replacement, so each appears once. Bootstrapping samples with replacement, so a trade may repeat or disappear from a particular path. With fixed cash outcomes and unchanged costs, shuffling preserves the final total. Bootstrapping can change the total as well as drawdowns and streaks.

Can a trade shuffle change the final balance?

A shuffle of fixed cash outcomes cannot change their sum, so the final balance is unchanged when size and costs remain fixed. It can change intermediate balances and drawdown. If sizing, margin constraints or other rules depend on the evolving path, those mechanisms must be recalculated rather than simply reordering old cash results.

Is Monte Carlo drawdown the worst loss that can happen?

A Monte Carlo drawdown statistic describes losses within paths allowed by the selected model. An upper percentile or the largest simulated drawdown is not a bound on live losses. Unobserved shocks, changing costs, dependence between trades and execution differences can produce outcomes the model did not represent.

How many Monte Carlo simulations are enough?

No universal simulation count is sufficient for every statistic. The required count depends on the precision needed and how rare the measured event is under the model. Check numerical stability and report the path count and random seed. More simulated paths refine the model's output; they do not enlarge the underlying historical sample.

Reviewed 25 September 2026. Facts were checked against the linked sources on that date. Nothing in this article was tested on a trading account and no code was compiled.

Related reading

Sources

  1. Wikipedia – Bootstrapping (statistics): history, citing Bradley Efron (1979), Bootstrap Methods: Another Look at the Jackknife, The Annals of Statistics 7(1), doi:10.1214/aos/1176344552, accessed 25 September 2026.
  2. R boot package documentation – Bootstrapping of Time Series, accessed 25 September 2026.
  3. MetaQuotes – Testing Report: balance and equity drawdown, accessed 25 September 2026.
  4. TradingView – Strategies: trade exports and trade limit, accessed 25 September 2026.
  5. MetaQuotes – Basic Principles: orders, deals and positions, accessed 25 September 2026.
  6. PineConnector – Test your setup, accessed 25 September 2026.

PineConnector executes the instructions you send it. It does not select trades, manage money, or hold funds. Trading carries risk, and past performance of any strategy does not indicate future results.


Leave a comment

Back To PiCo Blog

Ready when your strategy is

You bring the strategy.We bring the infrastructure.

Connect TradingView to MetaTrader, choose where MT5 runs and put the full PineConnector workflow through its paces from your first month.

Strategy and trading decisions remain yours. The MT5 environment can be ours.

PineConnector Edge

Run the full PineConnector workflow.

$59/mo at launch

Core plan · 1 connection · 1 hosted MT5 environment

Try Core for $7

7 days of Core for $7, then $59/month at the launch price unless you cancel.