# Monte Carlo Simulation Explained; The Ultimate Guide

## What is Monte Carlo Simulation?

A Monte Carlo Simulation is a simulation that applies random changes to historical trades and then calculates a new equity curve. This new equity curve is then used to verify if the trading strategy is robust enough to withstand the random changes.

This technique has been widely used by other professionals in various fields such as physical science, energy, biology, artificial intelligence, project management, transportation, research and development, insurance, environment, oil, and gas among others. It’s widely used in many disciplines because it’s able to give a wide range of possible outcomes and the probability of them occurring in a given model based on different parameters that aid in key decision making. Although the Monte Carlo Simulation gives a probability of outcomes happening and it’s not deterministic, it serves as a good estimation tool that helps decision-makers get a possible approximation of future reality.

In trading, we use Monte Carlo simulations to analyze how our trading strategy would have performed if for example, we had slightly worse entries or exits, or if we missed a few good trades.

## Who invented Monte Carlo Simulation Technique?

The Monte Carlo Simulation technique was first used by Stanislaw Ulam, who was a mathematician working on the Manhattan atom bomb project. After World War II, he was recovering from brain surgery when he decided to keep himself entertained by playing unlimited games of solitaire.  It was at this point where he became curious and he wanted to know whether it’s possible to predict the outcomes of each of the games of solitaire. He wanted to observe their distributions so that he can determine his probability of winning these games. He later shared the idea with John Von Neumann who collaborated with him to invent the Monte Carlo Simulation technique. Monte Carlo Simulation was named after Monte Carlo, which is Monaco’s most renowned town spot for gambling. Just like in gambling which is associated with chances and random outcomes, the Monte Carlo Simulation technique uses the same concept to predict possible outcomes and the probability of them occurring in a given model.

## How Monte Carlo Simulation Works

Monte Carlo Simulation works by taking all the trades you made in the past and applying small random changes to these trades.

Some example of what might be changed:

• The entries and exits
• Commissions/fees

Monte Carlo Simulation uses the probability distributions to describe uncertainty in variables when performing risk analysis in a given situation so as to aid in the right decision making. When probability distributions are used in a given model, the variables used have higher chances of resulting in different probability outcomes and that’s where the Monte Carlo Simulation technique comes in to provide data of possible future outcomes.

There are different types of probability distributions that are used in Monte Carlo Simulation calculations. Some of the common probability distributions are;

### a) Uniform

Here just as the name suggests, all the values have an equal chance of occurring. The user, in this case, will only be interested in determining the minimum and the maximum values. A good example where the uniform probability distribution is used is in the calculation of production costs in companies to predict the future sales revenues of a new product or service.

b) Normal or Bell Curve

Under the normal or “bell curve” probability distribution, the user's aim is to define the mean and standard deviation so as to describe the variation. Under the normal curve, all the values which are in the middle and near the mean have a high probability of occurrence. A normal/bell curve is presented as symmetric and it describes a wide variety of natural occurrences and features. A normal probability distribution can be used to describe numerous variables outcome such as changes in inflation rates as well as energy price levels.

### c) The Lognormal

The Lognormal probability distribution is different from the normal distribution in that the values are positively skewed as opposed to being symmetric. It’s mostly used to analyze values that don’t go below zero digits but they have infinite positive potential. A lognormal probability distribution is used to describe variables such as oil reserves, stock market prices, and real estate property prices

### d) Triangular

In triangular probability distribution, the user's aim is to define the minimum, most likely, and the maximum values. Under this scenario, it’s the values that fall under the most likely category which have the highest potential of occurrence. Different product inventory levels and past sales history per unit of time are some of the variables that can be expressed via a triangular distribution.

### e) PERT

Under PERT, the user's aim is to determine the minimum, most likely, and maximum values which is the same as the triangular probability distribution. However, the two are different in the sense that in PERT distribution, there are more chances of values between the most likely and the extremes are more likely to occur. In triangular distribution, the values on the extremes are not given many considerations. A good example where PERT probability distribution is normally used is in the analysis of task duration in a certain project management model.

### f) Discrete

When using a discrete probability distribution, a user is interested in defining specific outcomes that have the potential of occurring and the possibility of each of them. For instance, a user may want to predict the outcomes of a lawsuit that have different specific possible outcomes such as a 30% chance of positive ruling, a 10% negative ruling, a 15% chance of mistrial, or a 45% chance of settlement.

In order to predict and quantify future risks and possible outcomes in trading, the Monte Carlo Simulation technique samples various variables randomly from the input probability distribution model. Every set of samples taken is known as an Iteration. All the resulting outcomes from this set of sample is carefully recorded and is later compared to other outcomes from repeated simulations (hundreds or thousands) of different iteration. The trader then interprets the data from the Monte Carlo Simulation calculations to understand the risk probability in the trading strategy so as to make an informed decision. Performing Monte Carlo Simulation calculations will not only tell you what could happen in the future but also the probability of it occurring.

## What Are The Advantages Of Monte Carlo Simulation?

### 1. Expected Maximum Drawdown

The first advantage of using Monte Carlo Simulations is that you get a good idea of the maximum drawdown you can expect to encounter. Even if you only experienced a drawdown of let’s say 8% so far, A Monte Carlo simulation could tell you that it's very likely that you might encounter a 20% drawdown somewhere in the future. By knowing this in advance you are mentally prepared for it, which makes it easier to just keep following your trading plan when it happens. You can also try to optimize your trading strategy further to get a lower maximum expected drawdown.

### 2. Know your Risk Of Ruin

The second advantage of a Monte Carlo simulation is that it will tell you your risk of ruin. I’ve talked about the risk of ruin over here. In my opinion, it’s one of the most important trading metrics every trader should know. Although you can use Kaufmanns or Ralph Vince’s formula to calculate the risk of ruin, a Monte Carlo Simulation will give you an even more accurate result since it's based on 100s of simulations and takes into account all kind of small changes which will happen during your trading.

## Disadvantages of Monte Carlo Simulations

Just like any other formula, there are a few downsides of Monte Carlo Simulation analysis when used in trading. One disadvantage is that it requires a trader to have a profitable trading strategy. If a trader keeps on changing their trading strategy, then the historical trade data used will lose their fundamental meaning with time when you continue trading. For you to get a valid Monte Carlo Simulation analysis, you need to have consistent historical results that are backed by a single robust strategy or method for the whole set of trading.

### 2. Big fundamental changes

Monte Carlo Simulation analysis does not incorporate big fundamental changes in the markets. For example, the financial markets might change drastically due to disasters, wars, COVID 19, etc.  When things like this happen and we see huge changes in the market then remember that carrying out a Monte Carlo Simulation analysis based on historical data might not give a valid future result. This is because the market has fundamentally changed over time.

## How to Use Monte Carlo Simulation Analysis in Trading

When Monte Carlo Simulation strategy is used in a trading system, it involves taking random simulated trade series in order to understand whether the trading strategy is good enough and robust to withstand small changes in the market. When you have an idea of what the future trading or market may react, you are able to make an informed decision based on quantified market data.

Monte Carlo Simulation analysis can help you test the robustness of your trading strategy in order to understand a number of key trading performance metrics such as; Risk of Ruin, Annual rate of returns, Drawdown ratios and Maximum and Median drawdowns. When a trader has such important information at their disposal before they start live trading, they will be in a better position to make well-informed decisions when it comes to their trading strategy choice, capital allocation as well as position sizing.

There are a number of methods that are used to perform Monte Carlo simulation analysis in a trading system but they differ in their implementation components. Some of the most commonly used ones are;

### a) Original and Resample Monte Carlo Simulation Analysis Method

This is the most straightforward and widely used Monte Carlo simulation method in trading systems. It involves taking the historical trade results and reorganizing their order. The simulation is done 1000 times to get our “new” 1,000 equity curves which gives us more information regarding the potential risks that we may experience when we decide to trade this particular strategy. When using this simulation method, our fundamental assumption should be that our trade results should always remain the same but they should not appear in the same order like the past ones.

Figure 1: Monte Carlo Simulation- Original/Resample

Once you get the simulation results, you can now use this information to calculate a number of key trading performance metrics such as the maximum or average drawdown of the “new” 1,000 equity curves. In most cases, when you calculate the average drawdown, you will realize that is always higher than the backtest’s drawdown. Rather than relying on the original backtest’s drawdowns, the data gathered from the average drawdown analysis can help you in making the right decision when it comes to trading system allocations and sizing.

### b) The Randomized Monte Carlo Simulation Analysis Method

The randomized Monte Carlo method is mostly used to find out if there are any overfitting in the trading strategy creation process. This method is also known as the bootstrapping method.  It performs a random sampling by re-trading each strategy entry signal from the backtest and replacing it with a random but appropriate exit for every signal. The process is then repeated 1,000 times to give us our “new” 1,000 equity curves for another in-depth performance analysis.

Under the randomized Monte Carlo simulation analysis method, the assumption is that if our trading signal is strong enough, we expect it to generate profits irrespective of the exit (s) chosen. When we use random exits, we expect the returns will not be as smooth as it is the case with the original exits but at least we expect the signal to still have some sort of profits at the end of simulation. If in any case the trading system does not maintain some level of profitability, there is a higher chance that the original entry signal that was used had an overfit to the historical data and you should consider dropping-off the trading strategy before you can even risk your investments.

There are two key trading properties that can be randomized when carrying out a Monte Carlo simulation analysis. The two trading properties are;

1) Change of Trades Order- When changing the trade order, there are two likely possibilities. The first one is where we randomly shuffle the original order of the trades. The other random resampling variation involves more than just shuffling the trades. It goes further and randomly picks the overall number of trades from all the trades available.

The second one is different from the first one in the sense that the list of trades might not necessarily be the same. Therefore, it has the potential of picking one trade multiple times and not picking other trades at all.

2) Skipping some Trades- Under this consideration, we deliberately make some trades to be randomly missed based on a given probability. The test helps a trader get an idea on how the equity curve would appear if some of the trades were randomly skipped. In a real trading scenario, you can miss a trade if there is a system failure or when you stop trading for a while.

You follow the below steps when carrying out a bootstrapping test on your new trading system in order to analyze your new trading strategy performance under different market scenarios.

• Step 1; Start by creating an input set
• Step 2; Backtest your trading system so that you can get the original set of trades
• Step 3; Repeat the process to 1,000 or more times to get a new set of possible trades outcomes
• Step 4; Pick random trades from the original trades so as to generate new random sets of trades.
• Step 5; Perform gain/loss calculations for each of the randomly picked trade using your preferred position sizing
• Step 6; Record the system equity in the distribution
• Step 7; Start post-processing the available data so as to generate the right distribution statistics and charts which indicate potential risks of the new trading strategy.

Here is a data chart sample of randomized Monte Carlo simulation in trading;

Figure 2: Monte Carlo Simulation- Randomized

## Monte Carlo Drawdowns for Ideal Sizing

Apart from helping us quantify the risks that our new trading strategy might experience, the Monte Carlo Simulation exercise can also help us to size our new trading strategy. This is done by carrying out the Monte Carlo Drawdown test that allows us to assign a certain percentage of confidence to what levels of potential risks that we may assume in our new trading strategy.

To carry out Monte Carlo Simulation Drawdown test, you follow the below steps;

• The user starts by specifying their starting capital amount

• The next step is to run the Original or Resample Monte Carlo Simulation

• Create a record for all the 1,000 maximum drawdowns as a percentage of the starting capital

• Plot for another 1,000 maximum percentage drawdowns as a frequency distribution

• On the Y-axis, follow the cumulative distribution line all the way up to the 95% mark

• On the X-axis, find the corresponding X-axis drawdown percentage value which matches the 95% value on the Y-axis.

From this example, we can conclude that 95% of all the Monte Carlo simulations are below 20% drawdown as indicated on the X-axis. Therefore, we are now confident that we only have a 5% chance of experiencing a drawdown which is greater than 20%. As a trader, if for instance, you are not comfortable with these numbers, you can always re-run the test with an increased starting capital and compare the results until you get the most appropriate drawdown amount which gives you the amount of confidence that you are looking for when trading.

The drawdown data allows a trader to have a properly sized trading strategy. When you size properly, you are able to make an informed decision based on the calculated risk, and from the results, you can be able to determine whether to continue with the new trading strategy or turn it off as soon as possible.

## How Many Times Do You Run A Monte Carlo Simulation?

As we have already discussed above, the Monte Carlo simulation analysis helps traders to determine if their trading strategy is good and robust enough to withstand small changes in the market. The question of how many times should you run a Monte Carlo simulation always arises when a retail trader wants to analyze the performance of a new trading strategy. Ideally, the common practice is, you should repeat the simulation procedure multiple times so that you can make an informed decision based on the average results generated. This is in line with the theory of large numbers which requires multiple simulations to be done so as to arrive at the most accurate estimates.

In the context of Monte Carlo simulation analysis in trading, we base accuracy on the confidence levels in a particular trading strategy. If the confidence level is small, the value estimate generated from the trading is more robust. The most common and acceptable simulation confidence levels when testing the robustness of a new trading strategy range from 95% to 99%.

In most cases, a good value estimate in a trading system is generated when multiple Monte Carlo simulations are done in the range of 1,000-500,000 times. However, the time taken to generate all the estimated values depends on the complexity of the simulation algorithm used and simulator software type.

## Uses of Monte Carlo Simulation Analysis

As a retail trader, before you even put any new trading strategy into real practice, you should consider running a Monte Carlo simulation so as to get a rough estimate of the expected drawdown and profits.

Apart from testing the robustness of your new trading strategy, the Monte Carlo simulation analysis also helps in determining the good expectancy levels and the number of simulations required. In most cases, your model should have 95% expectancy levels and you should run a minimum of 100 simulations in order to get more accurate results.

Monte Carlo simulations are used in a new trading strategy model to find out the probability of getting different outcomes in a complex trading process which cannot be easily predicted.

## Conclusion

If you are a retail trader and you have never used automated trading systems before, you should consider investing in algo-trading tools like Monte Carlo simulation analysis so as to better your trading performance and improve results.

## Erwin

I am the owner of EB-Worx. Together with my wife and dog I live in the Netherlands where I love to day trade the ES-mini and develop software which helps me to become a better trader.

#### What is a Trading Journal ? (And why you need one)

Do you want to know what a trading journal is, and why you should use one ? If you are serious about your trading, then you should treat it as a real business. This means you should track all your dat...

#### What Is Expectancy Ratio?

If you are looking to increase the amount of profit you are making from your trades and are failing to understand why you may not be, knowing the expectancy ratio of a trade before you make it can hel...