RobustnessIntroductory12 min read

Monte Carlo Trading: How to Stress-Test a Forex System

Learn how Monte Carlo simulation works on a trading system: shuffling trades, reading drawdown ranges, forex pitfalls, and a worked example with real arithmetic.

Analyst examining simulated forex equity paths

Monte Carlo trading means taking the trades your system produced and replaying them thousands of times in different random orders or samples, so you see the range of equity curves the same edge could have produced instead of the single curve your backtest happened to draw. It estimates the range of drawdowns and outcome variability under the chosen simulation assumptions; it cannot measure how much of a historical result was luck. It doesn’t tell you whether the edge is real. That part still depends on clean rules, honest costs and out-of-sample testing.

Readable rules and source code help you understand and export trades, but reliable simulation also requires representative data, realistic costs and appropriate assumptions.

TL;DR

  • Monte Carlo reshuffles or resamples your system’s own trades thousands of times to show a distribution of drawdowns and, when resampling with replacement, final results.
  • Consider the 95th or 99th percentile of simulated maximum drawdown alongside historical drawdown, stress scenarios and risk limits.
  • Small or unrepresentative samples can make estimated ranges unreliable, even when simulated bands look narrow.
  • Simulation can’t fix look-ahead bias, ignored spreads or overfitted parameters. Fix those first, then simulate.
  • A normal-distribution model can understate downside tail risk, so test with your real trade results and add stress scenarios.

What a backtest hides and Monte Carlo shows

A backtest gives you one path. Suppose your system made 200 trades over six years and the worst peak-to-trough fall was 14%. That 14% depended on the order the wins and losses arrived in. If the five biggest losers had landed in a row instead of being spread across three years, the same system with the same trades could show a larger drawdown. Nothing about the edge changed. Only the sequence did.

Monte Carlo makes that visible. You take the list of trade results, draw them in random order (or draw with replacement, which is called bootstrapping), compute the equity curve, and repeat a few thousand times. Each run is an alternative path conditional on the assumptions and observed data. Stack them and you get a fan of curves, plus a distribution for the things you care about: final profit (when the sample changes), maximum drawdown, longest losing streak, and the chance of hitting a loss limit.

The method is old. It was developed at Los Alamos in the 1940s, where von Neumann proposed a method based on Ulam’s idea in 1947 and it was named after the casino. Traders borrowed it because markets, like games of chance, produce outcomes you can only describe as ranges.

A worked example with real arithmetic

Consider a hypothetical system with independent trades, a constant 45% win probability, fixed monetary risk R and outcomes assumed net of costs. A winner makes 1.5R and a loser costs 1R, where R is the amount you risk per trade. Expectancy per trade is 0.45 × 1.5 − 0.55 × 1 = 0.125R. Over 100 trades you’d expect about +12.5R.

One trade’s standard deviation is 2.5 × √(0.45 × 0.55) R, approximately 1.244R; over 100 independent trades it is approximately 12.44R. Let X be the number of wins, so X follows a binomial distribution with 100 trials and probability 0.45. Total profit is (2.5X − 100)R. A strictly negative result requires at most 39 wins; 40 wins break even. The exact binomial probability P(X ≤ 39) is 13.43%. Simulating independent outcomes under these same assumptions would approximate this probability; simply shuffling a fixed set of 100 trades would not.

Two lessons come out of that. First, a profitable system can lose over a hundred trades, so a short live period tells you very little. Second, under these assumptions, the horizon matters: at 400 independent trades expected profit is +50R, standard deviation is approximately 24.87R, and the exact probability of a loss (at most 159 wins) is 1.94%. These figures are conditional on the assumed edge, not forecasts or confidence bounds for a real strategy. A backtest of only 40 trades may estimate the underlying distribution poorly. Our piece on win rate and trading expectancy after costs walks through why the expectancy input has to be net of spread and commission before any of this means anything.

A worked example with real arithmetic

Two ways to run it

Resampling or shuffling the trades

This is the version most traders mean. Export the trade list from your backtest, with each trade’s result in R or in account percent. Then either shuffle the order (each trade used once, so the sum of fixed monetary or fixed-R results stays identical and only the path changes, provided there are no path-dependent constraints) or bootstrap with replacement (some trades appear twice, some not at all, so total profit varies too).

Shuffling answers one question: how bad could the drawdown have been with these exact trades? Bootstrapping answers a broader one: how much did the result depend on the specific trades that happened to occur? Run both. If the 95th percentile of shuffled drawdown is twice the backtest drawdown, the historical order had a smaller drawdown than many simulated paths; reassess sizing against your risk limits rather than treating this alone as proof of excessive size.

One caution: interpreting an unrestricted shuffle as representative of future paths requires an exchangeability assumption; independent, identically distributed trades are one sufficient case. Many forex systems cluster, for example a trend follower that loses repeatedly in ranging months. If losses come in regimes, a plain shuffle breaks that clustering and can understate streaks. Block bootstrapping, which resamples chunks of consecutive trades, keeps some of the structure.

Perturbing the data or the trades

The second family changes the inputs instead of the order. You skip a random 10% of trades (missed fills, a platform outage), add random slippage to each entry, jitter the spread, or nudge the price series slightly and rerun the whole strategy. These runs test whether the system survives conditions a bit worse than the backtest assumed.

The diagnostic is simple. If your original backtest sits at the extreme top of the distribution and most perturbed runs do much worse, the result may be sensitive to those perturbations. That is a warning, not proof of overfitting. Assess the severity and realism of each scenario and compare independent validation results. For the related question of how sensitive the rules are to their own settings, see parameter robustness and sensitivity.

How to read the output

You’ll get a chart of many equity curves and a table of percentiles. Ignore the chart’s prettiest line and read the table.

Maximum drawdown is the number that matters most. The median tells you the typical worst fall. The 95th percentile is a threshold at or below which approximately 95% of simulated maximum drawdowns fall, subject to ties and estimation error. The 99th percentile explores a more extreme tail but is not a worst-case bound. A common working rule is to size the system so the 95th percentile drawdown is something you’d actually sit through without switching it off. If your backtest drawdown was 14% and the 95th percentile is 27%, ask whether you’d survive 27% emotionally and financially. If not, cut size until you would.

Losing streak length is the second figure. A system with a 45% win rate will, over a few hundred trades, produce streaks of eight or nine losers in some runs. Knowing that in advance is the difference between following the rules during the streak and tearing the system up in the middle of it.

Probability of ruin or of hitting a stop-out level (say, a 20% equity loss) is the third. Count the share of runs that touch the line. A breach probability is conditional on the simulation model; acceptable limits depend on the mandate and consequences of a breach.

The final-equity distribution is useful for estimating terminal loss and return uncertainty over a defined horizon. A negative 5th percentile indicates downside risk in the model; it does not by itself establish whether an edge is real or economically sufficient.

Monte Carlo on forex systems

Forex adds wrinkles that stock-oriented simulators gloss over.

Costs are the first. Spreads widen at rollover and around news, and overnight financing may be a charge or credit. Omitting material execution costs generally overstates performance; the effect depends on the actual charges and credits. Build the list from net results, or add a cost-perturbation run where spread is randomly widened.

Position sizing is the second. If you risk a fixed percent of current equity, losses shrink as the account falls and gains compound, and the distribution gets skewed in ways a fixed-lot simulation won’t show. Simulate the sizing you actually trade.

System type is the third. Some mean-reversion strategies have frequent small wins and occasional large losses; check whether this pattern is present in your own trade distribution; the assumptions behind that are covered in mean reversion, price, spread and market assumptions. Some trend-following systems have frequent losses and fewer large wins; examine both losing streaks and individual tail losses.

Regime change is the fourth, and it’s the one simulation can’t do for you. Reshuffling trades from 2019 to 2024 can’t create the conditions of a different decade. The CFA Institute’s backtesting and simulation reading notes that financial data often face structural breaks and recommends scenario analysis across different regimes. In practice that means adding stress runs by hand: what if volatility halves, what if spreads triple, what if the pair stops trending for a year.

What Monte Carlo can’t do

It can’t detect look-ahead bias. If your robot accidentally peeks at the bar’s close before deciding to enter, every trade in the list is contaminated, and a thousand reshuffles of contaminated trades give you a very confident wrong answer.

It can’t correct for how many versions you tried. If you tested 300 parameter combinations and kept the best, the survivor’s trade list looks great and the simulation will agree. The selection already happened upstream.

It can’t make a small sample large. Resampling 30 trades 10,000 times gives you 10,000 variations of the same 30 data points, not new information.

And it inherits the distribution you give it. When a model draws returns from a normal distribution, which is common because it’s simple, it can’t account for the negative skewness and fat tails seen in real asset returns, according to the CFA Institute’s 2026 reading on backtesting and simulation. It recommends sensitivity analysis, rerunning with different inputs to see how much the answer moves. Resampling your own actual trades avoids the normality assumption, which is one reason it’s the better default for a trader than a simulator that asks only for win rate and reward-to-risk and then draws from a formula.

That last point is worth acting on. Many free calculators take three inputs, win rate, average win and average loss, and generate synthetic trades. They’re fine for a quick feel of variance, like the arithmetic above. For a decision about capital, use the real trade list.

Where it fits in the testing sequence

Monte Carlo is one layer. A sensible order looks like this: write the rules down completely, backtest on clean data with realistic costs, check how the results move when parameters change, validate out of sample, then simulate the trade list to size risk. Our article on walk-forward validation and retraining covers the out-of-sample step, and the guide to forex trading systems, rules, testing and adapting places all of these in one workflow.

Five stages of forex system testing

Run the simulation again after you change anything material: new pair, new stop logic, new position sizing. And run it again on live or forward-test trades once you have a meaningful number. If comparable live results repeatedly fall in the lower tail of the simulated range, investigate model assumptions, market regimes, data and execution. Random variation and dependence between evaluation windows remain possible explanations. The piece on market drift versus data feed failure helps separate those.

Can ChatGPT run a Monte Carlo simulation?

A chat assistant can write the script for you, usually a short Python routine that reads your trade list, shuffles or bootstraps it a few thousand times and prints percentile drawdowns. It’s good at that, and good at explaining the output in plain words. What it shouldn’t do is generate the numbers itself without running code, because a language model describing a simulation isn’t the same as executing one.

So treat the code as untrusted until you’ve checked it. Feed in a tiny trade list where you know the answer by hand (five trades, total profit known), confirm the total matches, confirm shuffling doesn’t change the sum, and confirm drawdown is measured peak to trough on the cumulative curve and not trade by trade. Our guide on verifying AI-generated trading code shows how to build that kind of check.

Doing this with robots you can read

Monte Carlo is only as good as the trade list and your understanding of what produced it. With a robot whose trading rules are written out and whose source code is in your hands, you know what each trade means, how costs enter, and which assumptions you can change before you resimulate.

TradeAndRoll sells collections of Forex robots, each provided with its trading rules, source code and AI prompt ideas, so you can examine how a strategy is built and adapt it. The free demo gives you sample materials, including market data in CSV files, to inspect before you decide on anything. The 30 additional Forex robots collection is €270 plus applicable taxes one-off, and the plan with 20 additional robots each month is €99 per month plus applicable taxes.

Tradeandroll

Trading leveraged forex carries a risk of loss, and simulation results are estimates, not promises; the risk disclosure sets out the details.

FAQ

What is the Monte Carlo strategy in trading?

It isn’t a strategy that generates entries and exits. It’s a way of testing one. You take a system’s trade results, rerun them in many random orders or samples, and read the spread of drawdowns and outcomes. Some people also use the phrase for betting systems, but for system testing it means this resampling.

How many simulations and how many trades do I need?

A few thousand runs can provide an initial estimate, but check convergence across seeds and increase the run count for extreme percentiles. The required trade sample depends on dependence, distribution, regime coverage and the precision needed; there is no universal minimum.

Does a good Monte Carlo result mean my forex system works?

No. It shows how much your backtest depended on the order of trades. It won’t catch look-ahead bias, ignored spreads or parameters fitted to history. Pair it with out-of-sample testing and sensitivity checks.

Which drawdown number should I use for risk sizing?

Use a high percentile, such as the 95th, from the simulated maximum drawdown distribution alongside the historical figure and additional stress scenarios. Then choose a position size at which that drawdown is one you could live with and still follow your rules.

Sources

Back to the Blog