If you are interested by quant finance, you should have heard about **Monte Carlo simulations in trading**. However, the concept is always unclear: do we use Monte Carlo simulations for risk management, to analyze our backtest or to price derivatives? All of that and much more! Indeed, the Monte Carlo simulations are a **statistic method**, so we can adapt it to many situations.

## 1. MONTE CARLO SIMULATIONS IN TRADING: DEFINITION

The Monte Carlo simulation is a statistical tool used to analyze the **behavior of a stochastic event**. A stochastic event is an event that doesn’t have a defined value but many possible values from a known statistical distribution.

It looks like what we described about stock prices, doesn’t it? Indeed, stock prices are stochastic processes which make them perfect for Monte Carlo simulations.

The **goal of the Monte Carlo simulations is to generate several paths that the stochastic process you analyze could take**. At this end, we will obtain hundreds of paths: enough to make statistics on the future values.

**Figure: Monte Carlo simulations output example**

## Join Our Newsletter

Be the first to receive our latest quant trading content (personal notes, discount, new articles).

## 2. MONTE CARLO IN TRADING: RESAMPLING VS GENERATED DATA

Now, let’s focus on the **different methods** to use Monte Carlo simulations in our trading analysis. We have two ways to do it, two ways that we can do at the same time if we want: the **resampling method and the generated data method**.

### RESAMPLING METHOD

The resampling method is relatively easy to understand. At this step, we have already done a backtest using a standard method (or a walk forward optimization to have more data). Then, **we will keep the strategy returns and we will create new paths resampling the data**: changing the order of the returns.

You should ask yourself, “**what can be the advantage of doing that**?” The best thing that we will obtain using this method is a more accurate way to compute the maximum drawdown and in general the risk of your strategy.

Indeed, if we have the following returns [+1%, -1%, +1%, -1%, +1%],** at the end you will have the same return but not the same risk if the order was** [-1%, -1%, +1%, +1%, +1%]. And the fact that you are using fix or dynamic volume will not impact the logic here.

### GENERATED DATA METHOD

On the other side, for the **generated data method**, it will be quite like the robustness testing. Indeed, the goal will be generated data based on the historical distribution using the mean and the standard deviation to obtain different values but **still following the same distribution**.

[math]P_{t+1}=P_t \exp \left(\left(r-\frac{1}{2} \sigma^2\right) \Delta t+\sigma \sqrt{\Delta t} \cdot \epsilon\right) [/math]

Where [math]P_{t+1}[/math] is the price of the stock at time [math]t+1[/math], [math]P_{t}[/math] is the price of the stock at time [math]t[/math], [math]r[/math] is the annual rate of return, [math]\sigma[/math]is the annual volatility of the stock, [math]\Delta t[/math] is the time step between [math] t[/math] and [math]t+1[/math] (expressed in years, so 1 day is [math]1/252[/math]) and [math] \epsilon[/math] is a random variable drawn from a standard normal distribution (with a mean of 0 and a variance of 1), representing the random shock experienced by the stock price.

Once you obtain the distribution, you have several choices, but generally **use the historical path as in the sample** and then simulate **several out of samples using the Monte Carlo simulations** where you will apply the strategy to backtest it.

## 3. MONTE CARLO SIMULATIONS IN TRADING (STEP BY STEP)

The process is quite like the walk forward optimization and the robustness tests, I showed you in the previous articles. The Monte Carlo simulation method is in the robustness tests category too.

### STEP 1: GENERATE SEVERAL PATHS

The first step is to **obtain the several paths** that we will use in our analysis. To do so, we need to choose one method from the previous section.

We can either **resample the returns from a backtesting** on the historical path or we can apply our strategy on several **generated prices**.

### STEP 2: QUANTIFY THE RISK

Once we have our **hundreds of different possible strategy returns**, we need to quantity the risk. Indeed, as explained before, the historical path can just have a lucky randomness that has ordered the returns in the best way possible.

So, our job is not to compute the worst possible cases **on the historical path only** to obtain a reliable measure of it BUT **to quantify it** using the worst cases of hundreds of paths.

You can, of course, create all the risk metrics you want (number of consecutive losing trades, volatility) but as you may understand, I love the drawdown metric. Thanks to the drawdown distribution (one per path), I will compute another metric which **the risk of ruin**. This metric will help us to compute, using a probabilistic way, the odds that you touch the point where you would never be.

For example, you can say that **if your drawdown if higher than 20%**, it means you made too many mistakes and you will take a small break to come back with fresh ideas. It can be interesting, but our goal is still to avoid this situation, so to compute it we just take the number of drawdowns above 20% and we divide it by the number of drawdown: in the example below 0.00%.

**Figure: Maximum Drawdown distribution over hundreds of simulations**

### STEP 3: MAKE PERFORMANCE ESTIMATIONS (only with the generated data method)

It is important to understand that this method is only reliable using generated data. Indeed, as I said before, if you take the same returns, **you will have for sure the same final return but not the same risk**.

The method is simple, the goal is to make a prediction about the returns range after N days. To do so, we will take each day the value associated **with the 5th centile and 95th centile**. And we will use them to obtain an area of possibilities.

**Figure: Returns estimation after N days (with the statistical distribution each day)**

The **goal is to be sure that your strategy matches your goal**. Indeed, if you are targeting 35% return / year, so after 252 days. You just have to apply the Monte Carlo Simulations method and check the range the 252nd days. If the range is between 20% and 50% that’s good. If it is between 10% and 30% you know that it will be difficult to achieve your goal only with this strategy, **you need to integrate it into a trading bot portfolio**.

## ALPHA QUANT PROGRAM

- Create your first trading bots
- REAL-LIFE monthly projects
- 7D/7 Assistance & Support
- 1 Live/month with Lucas
- Access to the private community
- LifeTime access
- 30 days money back guarantee

## 4. THE BENEFITS OF THE MONTE CARLO SIMULATIONS

**risk management and predictions**.

**Easy to use**: instead of the combinatorial purged cross-validation, the Monte Carlo simulation method is quite easy to understand, quick and the results are easily understandable.**Risk metric analysis**: return is what you are looking for and risk is what comes with him. That’s why you always need to optimize your risk-reward ratio. Fortunately, the Monte Carlo simulation allows you to compute these metrics based on the distribution return and not only the historical which is one possible path through an infinity.**Simulated paths**: here, we generate data to create the path which is quite interesting, especially when we combine them with other analyses because it brings more information obtained using a very different process (than only take different samples on the historical data)

## 5. THE MONTE CARLO SIMULATIONS LIMITATIONS IN TRADING

As all the methods, the Monte Carlo simulation method **has limitations** in trading. That’s why you need to combine with others. Let’s give a few limitations:

**Dynamic distribution**: it is good to obtain the mean and the standard deviation to generate data, but market conditions are moving and the price distribution too.**Non-optimal parameters**: as for the robustness testing, we can’t extract a best set of parameters using only the Monte Carlo simulations.

So, the Monte Carlo method in trading is helpful, but you should combine it with other robustness tests to improve the accuracy of your analysis. Moreover, to obtain the best parameters you can use a walk forward optimization.

If you have any question, feel free to ask your question on my public discord forum or directly in private messages on Linkedin.

**👇🏼 Join the newsletter to be informed when the next article of the series will be issued **

## Join Our Newsletter

Be the first to receive our latest quant trading content (personal notes, discount, new articles).

Lucas Inglese

Lucas is a self-taught Quantitative Analyst, holding degrees in Mathematics and Economics from the University of Strasbourg. Embarking on an independent learning journey, he delved deeply into data science and quantitative finance, eventually mastering the disciplines. Lucas has developed numerous bots, sharing his insights and expertise on LinkedIn, where he regularly posts content. His understanding and empathy for beginners in this complex field led him to author several books and create the comprehensive “Alpha Quant Program.” This program offers e-learning videos, monthly projects, and continuous 7-day-a-week support. Through his online courses and publications, Lucas has successfully guided over 67,000 individuals in their pursuit of knowledge in quantitative finance.

## Related Posts

### Trading Backtest Explained – 3 real life exemples

Understand how to implement the different methods to do a backtest is good. But knowing how to use them to

### Robustness testing – Find reliable trading strategies !

Doing a backtest is good. Be able to trust it is better! That’s where the robustness testing takes place. Indeed,

### The Walk Forward Optimization in trading

Backtesting in not a research tool, ok fine! we have understood it! But, if we can’t optimize our parameters using

### The 6 Biggest Portfolio Backtesting Mistakes

If you are backtesting a single trading strategy or you are doing a portfolio backtesting, you need to avoid the

### The Scientific Backtesting Guide

If you are here, you know that backtesting on the historical data is clearly not enough to obtain the reliability

### What is a Backtesting in Trading?

We all have already seen amazing backtesting in trading: 99% are false! This is the first article of a series