# What is Monte Carlo analysis and why you should use it?

Monte Carlo analysis (or simulation) is a technique that can help you estimate the risk and profitability of your trading strategy more realistically.

**Why to use Monte Carlo analysis?**

Historical results of a trading strategy give us some prediction of the future performance. By using Monte Carlo analysis you’ll be able to make this predicion much more accurate.

To put it simply – Monte Carlo results will give you the estimated performance of your system based on statistics.

It can help you decide if your strategy is robust, what profit / drawdown you can expect from your strategy and if you should trade this strategy at all.

## What is Monte Carlo analysis?

The basis of Monte Carlo method is running the same simulation a number of times, each time with small random changes. The higher the number of repetitions, the bigger is the statistical significance of the results.

**An example – changing the order of trades**

Backtest is usually only a simple list of trades. What can be randomized about that?

For example order of trades. The order of trades in the past is relatively random. If your system has profitability 60% then you can expect that it will have 60% profitabe trades and 40% losing trades, but you cannot expect in which order they’ll come.

By simply reshuffling the trades your final profit will stay the same, but your drawdown can change a lot. Instead of drawdown 10% you might end with drawdown 30% just by changing the order of the trades.

So which value should you trust? What should you expect in the future?

The answer lies in statistics, which is the basics of Monte Carlo. You can let a program run this reshuffling a hundred times and you’ll see what is the best, worst and average drawdown achieved during these random runs.

Take the following system:

Below is 100 different equities of the same system. All we did was change the order of trades.

And here are some system performance statistics:

The system that originally had drawdown around 16 % now in worst case has drawdown 26 %, almost a double.

**What do these values mean?**

It is quite simple. The first line is result for original strategy, the rest are confidence levels computed using Monte Carlo analysis. Numbers on the left are confidence levels – they tell us with what confidence (probability) we can expect the resuts to be same or better than in a respective line.

For example, values at 95 % confidence level mean that there is 95% chance that Net Profit, Drawdown, etc. will be same or better than the confidence level values.

In other words, there’s only 5% probability that drawdown will be worse than 23.59 %.

95 % is the usual confidence level to consider. You could realistically expect that your system results will be same or better that values in this confidence level.

## What properties can be tested in the Monte Carlo analysis?

When we work with the backtest results all we have is a list of trades in the history. What can we do with them?

## Changing Trades Order

in the **Exact** variation it only randomly shuffles order of the trades. This doesn’t change the resulting Net Profit, but it is very useful in examining different variations of Drawdown that can be a result of different order of trades.

In more advanced **Resampling** variation of this test the trades are not just shuffled. Instead the program randomly picks total number of trades from the pool of all trades in history. The difference is that in this method the list of trades might not be the same. It can pick one trade multiple times and some other trade might not be picked at all.

This will give yet another view of the system. This method will usually change both Net Profit and Drawdown and it is quite extreme test.

## Skiping Trades

in this test some trades will be randomly missed (with given probability). In real trading you can often miss a trade because of platform or Internet failure, or simply because you paused trading for some time.

This test will give you an idea how the equity curve might look like if some trades are randomly skipped.

**An example 2 – lets randomize the trades and miss 5% of them**

You can see the resuts below. Missing 5% trades will slightly increase our expected drawdown at 95% confidence level and it also reduces the expected profit from $22.000 to $17.000.

**An example 3 – resampling the trades and miss 5% of them**

This is the most extreme test – with trades not only changing order but also resampled and missed 5% trades. The expected drawdown is the same as in previous example, but expected profit at 95% confidence level is decreased to only $8.500.

Note that this is almost the “worst case” scenario, it means that there’s only 5% chance that the profit would be lower than this.

It can also be higher, if you’ll look at the siulations chart you’ll see that the simulations equity results have wider range in this case, the final profit ranges from only $2000 to $50.000.

We can hope for the best but be prepared for the worst.

## Practical use of Monte Carlo analysis

This anaysis should be one of the final steps in strategy development.

Before you start trading any strategy you SHOULD run a Monte Carlo simulation with at least Exact randomization and 5% trades missed to determine more realistic drawdown and profit expectations.

What to look for – from my personal experience:

**Expectancy level and number of simulations** – it is a good rule of thumb to watch 95% expectancy level and run at least 100 simulations. More simulations will give you more statistical significance and 95% level means that there is only 5% chance that results will be worse than simulated.

**Drawdown** – you should watch how much worse is the drawdown at your expectation level compared to the original strategy. If it is less than double it is usually acceptable for me.

If drawdown at 95% level is double or even more than drawdown of original strategy then trading this EA would be dangerous.

It means that it achieved small drawdown in your test mostly by luck and you shouldn’t expect the luck to continue in the future.

**Net Profit and other** – generally, the strategy should fulfill your expectations. You can expect resuts better than 95% level values, but you can never be sure how much better they’ll be.

For example, I wouldn’t trade a strategy that would have none or very small small profit at 95% – it means that there’s something wrong with the strategy.

**Note: Monte Carlo functionality described above is available in the new Quant Analyzer**

You can use it to run Monte Carlo analysis on your MetaTrader4 backtests or account history statements imported to QA.

Hi Marc

Thanks a lot for this explanation. It is very useful to understand how the feature works.

:-D