# Bet Smarter With the Monte Carlo Simulation

This article was originally published in Price Action Lab Blog. Remember that the net profit of a strategy is equal to sum of winners minus sum of losers:. In reality, they have probability near 0 but if one does many reshuffles a great number of such sequences will emerge due to the ordering of trades. The final UI number is a measure of the pain that was felt in the strategy over the period because it reflects all of the drawdown experience - not just the maximum drawdown but the frequency, magnitude and duration of drawdowns. By doing so, you can get a range of values that give statistically significant results.

Monte Carlo analysis is a process that allows you to get a more accurate picture of the performance of a trading strategy beyond what a standard backtest report can provide. A backtest report shows the results of a series of trades in a specific order but the problem is that’s just history, you don’t know what’s going to happen going forward.

## Definition

There would be a follow-up article after this which would explain how to perform Monte Carlo Analysis in Amibroker. Monte Carlo simulation is a process which performs repeated execution of pre-defined set of steps by adding randomness to the input parameters at each iteration. In Trading terms, Monte Carlo simulation is performed to forecast the success of a backtested trading system.

Monte Carlo simulation is very popular in the field of statistical and scientific experiments. Consider a scientist who wants to estimate the trajectory of his space shuttle. Since the trajectory is highly dependent on atmospherical condition which is random, he has to perform Monte Carlo simulation in order to arrive at the most probable trajectory.

He will repeatedly simulate the trajectory by adding randomness to the atmospheric parameters after each repetition. You need to follow below steps to perform Monte Carlo analysis for your Trading system. Please note that these steps can be performed manually or by using any Trading platform like Amibroker. Optimize your Trading system rules and backtest it.

Now add randomness to your Trading system inputs and backtest it again. There are multiple ways to do this:. Repeat Step 3 and 4 multiple times and note down the results at the end of every iteration. The second and less obvious assumption comes from the way in which Monte Carlo simulations sample from the return distribution.

These simulations generally sample returns randomly and therefore do not care what the last return is when drawing the next return. This makes the fundamental assumption of a complete lack of serial correlation in your returns. If your returns are serially correlated then Monte Carlo simulations do not make any sense.

This may happen if you use techniques such as pyramiding where a winning or losing position immediately correlates to several other positions since the opening of trades is chained by the training logic and so is their outcome. Most dangerously the risk for such strategies is usually underestimated greatly by the simulations since they lack the additional risk elements that come from an introduced auto-correlation within the return series.

In the case of qq-pat the library samples the daily returns of the trading strategy. If a strategy trades more than once per day then this assumption introduces an assumption about how trades are grouped each day, something that is not realistic for systems with daily trading frequencies higher than one.

Another critical assumption in Monte Carlo simulations is convergence of the tested statistic. When you use a statistic the Monte Carlo simulation assumes that this state is reachable and that it will be reached before useful conclusions can be obtained.

Use a very ill behaved statistic or too little iterations and you will get results that are inaccurate and may lead you to take wrong actions.

Monte Carlo simulation can be used to tackle a range of problems in virtually every field such as finance, engineering, supply chain, and science. When faced with significant uncertainty in the process of making a forecast or estimation, rather than just replacing the uncertain variable with a single average number, the Monte Carlo Simulation might prove to be a better solution. Since business and finance are plagued by random variables, Monte Carlo simulations have a vast array of potential applications in these fields.

Analysts use them to asses the risk that an entity will default and to analyze derivatives such as options. Insurers and oil well drillers also use them. Monte Carlo simulations have countless applications outside of business and finance, such as in meteorology, astronomy and particle physics. The technique was first developed by Stanislaw Ulam, a mathematician who worked on the Manhattan Project.

He became interested in plotting the outcome of each of these games in order to observe their distribution and determine the probability of winning. After he shared his idea with John Von Neumann, the two collaborated to develop the Monte Carlo simulation. One way to employ a Monte Carlo simulation is to model possible movements of asset prices using Excel or a similar program.

By analyzing historical price data, you can determine the drift, standard deviation , variance , and average price movement for a security. These are the building blocks of a Monte Carlo simulation. To project one possible price trajectory, use the historical price data of the asset to generate a series of periodic daily returns using the natural logarithm note that this equation differs from the usual percentage change formula:.

## Monte Carlo simulation in real world

In trading system development, Monte Carlo simulation refers to process of using randomized simulated trade sequences to evaluate statistical properties of a trading system. Monte Carlo Simulation in Trading: Step by Step Tutorial Posted on March 23, by admin Monte Carlo simulation is one of the most important steps in Trading system development and optimization. Monte Carlo analysis is particularly helpful in estimating the maximum peak-to-valley drawdown. To the extent that drawdown is a useful measure of risk, improving the calculation of the drawdown will make it possible to better evaluate a trading system or method.