Complete Guide + Free Simulator

Monte Carlo Simulation for
Algorithmic Trading

A statistical technique that injects randomness into a dataset to create probability distributions for better risk analysis and decision-making.

What is Monte Carlo Simulation?

Monte Carlo Simulation is a statistical technique that injects randomness into a dataset to create probability distributions for better risk analysis and quantitative decision-making.

In trading, Monte Carlo simulation is most commonly used to randomize or resample the order of historical trades to estimate a strategy’s potential drawdowns, streaks, and equity curve variability in alternate “possible histories.”

The most common Monte Carlo Simulation randomizes the order of a data set to demonstrate an alternative path a data set could have experienced — this is particularly useful for algorithmic traders and trading systems to see different outcomes of past trades.

In financial markets, quantitative traders use the most common Monte Carlo Simulation method to reshuffle the order of their historical trades to help them better understand how a trading system could have happened. Algo traders aim to answer the question: if the order of trades was not identical to the backtest’s order, would I still be comfortable trading this strategy?

Monte Carlo Analysis for Probability Distribution

The equity curve — the cumulative profit of trade results — can provide insights into how smooth a trader’s account may grow following a particular algorithmic trading strategy. Monte Carlo provides a method of re-simulating the trading strategy to see how “bumpy” the ride could have been in an alternate reality and even acts as a peek into what the future may hold.

The purpose of Monte Carlo Simulation is to detect lucky backtests and misleading performance metrics before risking real capital.

Why are Monte Carlo Simulations Used?

Monte Carlo Simulations help better simulate the unknown and are typically applied to problems that have uncertainty such as: trading, insurance, options pricing, games of chance, etc. The goal is to gain a better understanding of all the possible outcomes and potential minimum and maximum values.

Mean and Standard Deviation of Drawdown

Why re-simulate an equity curve? Algo traders use Monte Carlo simulations to determine how much luck was involved in a strategy’s backtest and if future performance is likely to look like past performance. If the trading system was overly lucky, then it would be nice to know before risking real capital.

A trader may backtest a trading strategy and notice an acceptable maximum drawdown; however, after running a Monte Carlo test the drawdown may be much less tolerable. This method could save the trader risking capital on a strategy he could not stomach in live trading.

Benefits of Monte Carlo Simulation

Better Understanding of Drawdown

Reshuffling the order of your trades can lead to different profit and loss sequences which can result in a greater drawdown. A trader may believe the backtest’s drawdown is the worst it can get, but Monte Carlo analysis may show a much larger drawdown for most trading systems.

Properly Fund Your Trading Strategy

Noticing a larger maximum drawdown from a Monte Carlo simulation can help a trader better capitalize a trading strategy. This can make a live drawdown more bearable and allow the trader to stick to the original plan. A trader that experiences a live drawdown greater than the backtest’s drawdown may prematurely turn off a winning strategy if not familiar with Monte Carlo simulations.

Understanding Possible Win and Loss Streaks

The backtest may show a maximum of 5 or 6 losing trades in a row but a Monte Carlo test may show that 8 or 9 losing trades in a row is possible. The trader can better prepare for this adverse situation equipped with insights from a Monte Carlo simulation.

Random Outcomes normal distribution

Set Better Expectations with Quantitative Analysis

Many traders view the backtest as a guide for what to expect. However, a Monte Carlo test may show a wide range of possible profit and loss scenarios. This data analysis can help a trader remain calm enough to stick to the strategy when luck becomes favorable or unfavorable.

How to Use Monte Carlo Results

  • Compare the backtest drawdown to the 90th or 95th percentile Monte Carlo Drawdown
  • Size the strategy so you can survive a statistically likely drawdown (not just the backtest’s max drawdown)
  • Use streak distributions (max loss streak) to set expectations and avoid turning a good strategy off at the worst time
  • If Monte Carlo shows extreme sensitivity, revisit constraints (trade frequency, exits, filters) before going live

You can also import your own strategies into Build Alpha to run Monte Carlo Simulations on them!

Monte Carlo Testing for Drawdowns

Beginner traders find a successful backtest and think they have struck gold. However, many beginning traders are misled by overly optimistic backtests. Often the most important performance metrics such as net profit, standard deviation of historical trades, and consecutive winning trades will be inflated. The maximum drawdown from a backtest is often the most misleading metric!

This example strategy below shows a backtest drawdown of $1,663.90.

Build Alpha Drawdown View

However, after running a simple Monte Carlo Simulation on the same trading system we can see the worst resample drawdown from all simulations is $5,195.17 or 3.1 times as large as the backtest’s drawdown!

More Accurate Drawdown Predictions

A trader sized based on the backtest would prematurely cease trading and turn a potential winning strategy off or not have enough capital allocated. A simple Monte Carlo analysis could prevent this.

Monte Carlo Methods: Different Types and Uses

Reshuffle

Reshuffles historical trade order 1,000 times creating 1,000 new equity curves. All curves end at the same total P&L — but the paths change dramatically, revealing alternate drawdown scenarios.

Resample

Randomly selects historical trades with replacement until reaching trade count. The same trade can appear multiple times. Creates broader distribution — curves don’t end at the same spot.

Randomized

Re-trades original entries while randomizing each trade’s exit. If results remain profitable, your entry likely contains true edge. Catches overfit exits — a key lying backtest detector.

Permutation

Reshuffles log inter/intrabar price changes and exponentiates to create synthetic data with same statistical properties but destroyed patterns. Re-trade on 1,000 new price series.

Reshuffle

Reshuffling Monte Carlo Method

This method reshuffles the original trades, so all 1,000 equity curves end at the same total profit and loss amount but with wildly different paths.

Resample

Resample Monte Carlo

Resampling with replacement means not all simulations end at the same amount. This test provides more variation as the worst (or best) trade can be selected multiple times.

Randomized

Randomized Monte Carlo prevents lying backtests

If the Randomized Monte Carlo results remain profitable, then it is likely our entry contains true edge. The above example saved us from a lying backtest.

Read more on robustness testing for algo trading and view a Randomized case study: Free Friday 8 – Randomized Monte Carlo

Permutation

Monte Carlo Permutation Test

The new permutated data contains the statistical properties of the original data but destroyed most of the patterns. Profitable results are a good sign the strategy is robust. Popularized by Timothy Masters in Permutation and Randomization Test for Trading System Development.

Advanced Uses of Monte Carlo for Trading

Monte Carlo Equity Curve Bands

Is my trading strategy broken? Randomly select 100 historical trades and add them to the end of the backtest’s equity curve. Repeat 1,000 times and keep the 5th and 95th percentile equity curves. If future trading falls outside these bands, it’s an early warning sign the strategy is broken.

Monte Carlo Equity Bands

Monte Carlo Drawdown Technique

Answers: “How confident am I in this strategy’s drawdown?” Uses the resample method to create 1,000 new equity curves and 1,000 new drawdown values. The blue cumulative distribution line shows what percentage of drawdowns fall below each value.

Drawdown Confidence Interval

The red X indicates where 95% of all Monte Carlo drawdowns were less than the corresponding value. “We are 95% confident that drawdowns from this system will not exceed 30%.”

Understanding the drawdown probability distributions and sizing with statistical confidence can make drawdowns easier to manage.

Learn more: Complete Algorithmic Trading Guide · Properly Funding a Strategy with Monte Carlo · 3 Uses for Monte Carlo – SeeItMarket

How Many Monte Carlo Simulations are Needed?

The ideal number is 1,000 or more. To truly leverage the law of large numbers and get reliable results, one should strive for 1,000+ simulations; however, results are generally acceptable with 100 or more.

Running a single simulation could create a lucky result. Imagine a Resample test that luckily resamples only winning trades. Is this likely? No. Is this possible? Yes. Should we base trading decisions off of this? Absolutely not.

Lucky single simulationMany simulations needed

There may still be lucky results in 1,000 runs, but we can get a better sense of what is reasonable to expect from a larger probability distribution.

Equity Curve Simulator and Probability Distribution

An equity curve simulator is a tool that accepts winning percentage, average win, and average loss amounts to simulate how an equity curve’s sequence may happen. It is very important to note that a trader can be profitable with a lower winning percentage and larger winning trades or with smaller winning trades and a higher winning percentage.

To learn more about expected value please check out the complete guide to Algorithmic Trading.

Look at this expected value display below to see how winning percentage and average win to loss ratio affect profitability:

Expected Value Chart

All values based on $1 risk. 2.5 Reward indicates a profit of $2.5 and a loss of $1.

I have built a free equity curve simulator where you can input your expected winning percentage, average winning trade and average losing trade to simulate your expected equity curves. Knowing how these values cooperate can help with algorithmic trading strategy design, risk management, avoid a poor strategy, and analyze trading results.

Monte Carlo Simulator

Probabilistic trade outcome modeling across randomized trial sequences

Free Tool






Mean Final P&L
Median Final P&L
Profit Probability
5th Percentile
95th Percentile
Avg Max Drawdown

Equity Curves (sample paths)

Run simulation to view equity curves

Final P&L Distribution

Run simulation to view distribution

For educational purposes only. Monte Carlo simulations assume random trade ordering and normally distributed outcomes. Past performance is not indicative of future results. Risk capital only.

Monte Carlo Simulation in Excel

Microsoft Excel is often good enough for simple quantitative trading endeavors. Simply copy and paste your trades into column A and it will generate your equity curve in column B. Then drag columns D:N down to end at the same row number as total trade count. Press ‘F9’ to simulate a new Monte Carlo test.

Excel Monte Carlo Simulator

Read more about Monte Carlo simulation from Microsoft: Introduction to Monte Carlo simulation in Excel

Build Alpha — The Best Monte Carlo Tool

Build Alpha is powerful automated trading software that enables traders to create hundreds of algorithmic trading strategies with no programming needed. Any strategy created can be put through all the Monte Carlo methods listed in this guide. Simply highlight the desired strategy in the results window, then select Monte Carlo Analysis on the right-hand side.

Build Alpha Monte Carlo Analysis View

Build Alpha also returns statistics on winning and losing streaks from the simulations. You’ll see additional buttons for the advanced methods — Monte Carlo Equity Bands and Drawdowns.

Advanced Testing Options in Build Alpha

What is the Best Monte Carlo Simulation?

There is no best method as each has different intended uses. Reshuffle and resample are primarily for drawdown and risk estimation. Randomized and permutation tests are for strategy robustness and future viability — true stress tests. MC Drawdown creates confidence intervals around expected drawdowns. Equity bands monitor live trading and identify broken strategies.

A professional quant trader should incorporate all into the strategy development process.

Key Takeaways

  1. Monte Carlo simulation is a statistical technique to help uncover luck in backtests
  2. Most popular method is to reshuffle historical trades to view alternative account paths
  3. Can help estimate realistic drawdowns and possible outcomes
  4. Can help size trading strategy properly

Need to Knows

  1. There are many different Monte Carlo methods
  2. Inserting randomness into historical trade results to better estimate uncertainty
  3. Drawdown estimation is the most common use
  4. Large number of simulations needed — 100 minimum, 1,000+ ideal
  5. Can be used to monitor strategy performance and identify broken strategies

Summary

Monte Carlo Simulation works in various ways. The most popular methods help traders identify luck and more appropriate drawdown measures than a simple backtest can provide. Reshuffle and resample help simulate various equity curves with alternative trade sequences. Randomized and Permutation tests aim to test strategy robustness. Equity bands aid in identifying early signs of a broken strategy. MC Drawdown assists traders in finding proper confidence intervals.

Monte Carlo Simulations are arguably the most popular quantitative trading tool to add to your algorithmic trading toolbox.

Questions

Monte Carlo FAQ

Does Monte Carlo prove a strategy will work?

 

No. It helps traders estimate risk ranges and detect fragile, luck-driven backtests.

Reshuffle or resample — which should I use?

 

Reshuffle preserves the exact set of trades but changes order; resample can repeat trades and creates a broader distribution. Many traders review both and take the worst case scenario.

What’s a good number of simulations?

 

1,000 is a good rule of thumb. Fewer can be informative but less stable and potentially misleading.

What if my live equity curve breaks outside the Monte Carlo bands?

 

This can be an early warning sign that conditions changed or assumptions are off. Re-check data, slippage, regime alignment, and whether the strategy’s edge is still present.

David Bergstrom

David Bergstrom

The guy behind Build Alpha. A decade-plus in the professional trading world as a market maker and quantitative strategy developer at a high frequency trading firm with a CME seat, consulting for hedge funds, CTAs, family offices, and RIAs. Self-taught C++, C#, and Python programmer with a statistics background specializing in data science, machine learning, and trading strategy development. Featured on Chat With Traders, Better System Trader, Quantocracy, Benzinga, TradeStation, NinjaTrader, and more.

Community

What Traders Say

Run Monte Carlo on
Real Strategies

Build Alpha includes Reshuffle, Resample, Randomized, Permutation, Equity Bands, and Drawdown analysis. No coding required.