What is it, how it works and when to use it – technical analysis and trading system

In the world of systematic trading there is often talk of optimizations, backtest and robustness. But there is a tool that generates conflicting opinions: Monte Carlo simulation.There are those who consider it an indispensable passage …

What is it, how it works and when to use it - technical analysis and trading system

In the world of systematic trading there is often talk of optimizations, backtest and robustness. But there is a tool that generates conflicting opinions: Monte Carlo simulation.
There are those who consider it an indispensable passage to test the solidity of a strategy, and those who see it as an exercise in itself, a redundant analysis that adds little to the classic backtest.

In this article we will try to clarify: we will deepen what Monte Carlo simulation is, how it works, and above all if it is a useful, or even necessary tool, for those who develop trading strategies.

To do this, we will not limit ourselves to theory, but we will analyze a trading strategy on the future gold, evaluating its performance, consistency with the market below and the impact of Monte Carlo on the perception of risk.

Do you want help to improve your trading approach? Click here >>>

What is Monte Carlo simulation and why it is used in trading

It is important to clarify it right away: the Monte Carlo simulation does not aim to predict the future. Instead, it is a tool that allows you to analyze uncertainty, generating multiple alternative scenarios starting from a series of observed data.

In the context of systematic trading, the most common procedure consists in taking the results of a strategy already tested and remitting the order of the trade, keeping their characteristics unaltered. This process is repeated hundreds or thousands of times, with the aim of obtaining a wider range of possible equity line.

The following analysis allows you to estimate:

  • how much the performance awaited over time can vary.
  • What could be the maximum drawdown in unfavorable condition.
  • What could be the minimum drawdown in favorable conditions.

In other words, Monte Carlo helps to evaluate the statistical robustness of a strategy, going beyond the single historical sequence on which it has been tested.

The name “Monte Carlo” dates back to the 1940s, when the Stanislaw Ulam physicist, engaged in the Manhattan project, sensed that an approach based on the case could simplify the resolution of complex problems. Together with John von Neumann, he developed a method that simulated probabilistic scenarios. The reference to the famous casino di Monte Carlo, a symbol of gambling and randomness, was chosen precisely to underline the link with the uncertainty and the random dynamics.

Study case: Trend Following Strategy on gold (Gold Futures)

To test the Monte Carlo analysis, we will use as an example a trend following strategy applied to the future on gold from 2010 to today.

By trend followed we mean an approach that tries to take advantage of the management of the market, entering position when the price shows signs of strength (for long) or weakness (for short), with the aim of following the trend until its exhaustion.

Figure 1 shows the equity line of the strategy: a decidedly growing and regular curve. However, the most interesting aspect emerges when we compare it with the graph of the underlying, namely the performance of the Buy and Hold of the gold, shown in figure 2.

Figure 1

Figure 2

There is an evident consistency between the two curves:

  • In the central part of the graph, between 2018 and 2020, the strategy crosses a long side phase. Period in which, not surprisingly, the price of gold showed more low and disordered movements, as visible in figure 2.
  • On the contrary, in recent years, starting from mid -2022, the strategy records a strong acceleration upwards. Also in this case, the behavior is consistent with the trend of the Gold, which in the same period marked a series of explosive movements and new maximums.

Certainly, so that a strategy can express its potential, the market must present the suitable conditions.

In the specific case, a trend following system needs volatility, that is, markets that move decisively, in one sense or another. When the market is firm or irregular, the strategy tends to remain bogged down, producing modest or even negative results.

The question, therefore, arises spontaneously: how would the strategy behaved in different conditions?

And this is where the Monte Carlo simulation can offer us an extra perspective, helping us to explore these alternative scenarios.

What reveals the Monte Carlo simulation on the analyzed strategy

To evaluate the robustness of the trend following strategy presented previously, we made a Monte Carlo simulation on 10,000 different scenarios. In each simulation, the Order of the Trade has been randomly refurbished, keeping all the other parameters unchanged (profit/loss, duration, etc.). The goal is to observe how equity line could evolve in the presence of different operational sequences, although starting from the same historical results.

Figure 3 shows the result of these simulations:

  • The bundle of gray lines represents the 10,000 equity line randomly generated.
  • In blue, equity is highlighted with the most contained drawdown, equal to $ 14,680.
  • In red we find the equity with the worst drawdown, which has reached $ 65,120.
  • The real equity of the strategy is traced in green, with a historic member of $ 25,890.

These three values ​​allow you to quickly frame the level of potential risk of the strategy.

Figure 3. Monte Carlo simulation results: 10,000 hypothetical scenarios to estimate the real risk of the strategy.

An interesting fact is that the real equity is much closer to the best case possible than at the worst. This could indicate that the strategy has benefited from a sequence of relatively favorable trade from the point of view of the containment of the drawdown.

Another interesting aspect concerns the comparison between the royal curve (blue) and the beam of simulations (gray).
We note that in the first part the strategy produced results higher than the average of the simulations, while in an intermediate phase it has undergone a prolonged side period, during which many of the simulated curves continued to grow more regularly.

In other words, the strategy has crossed a less favorable period than the average of the 10,000 scenarios analyzed.

Conclusions: pros and cons of the use of the Monte Carlo simulation

The Monte Carlo simulation confirms itself as a useful and interesting tool, above all to evaluate how the maximum drawdown could have varying in the event that the trade had presented themselves in a different sequence. This type of analysis can be very effective, precisely because the drawdown is one of the most relevant elements for those who make systematic trading.

However, it is important to recognize the main limit: it is still an analysis conducted on past data. In order to use it as a compass for the future, we should assume that the performance of the strategy remain unchanged over time, a prerequisite that, unfortunately, rarely finds confirmation in the real markets.

Do you want help to improve your trading approach? Click here >>>

Until next time,

Andrea Unger