Monte Carlo Simulation In Trading, Investing, and Backtesting Strategies
Monte Carlo simulation in trading and investing is a tool frequently used in blogs and backtests. Can Monte Carlo backtesting be used to measure risk and uncertainty? Yes, it turns out you can use it in the financial markets:
Monte Carlo simulation and backtesting in trading (and investing) is a statistical tool to measure uncertainty and how robust your strategy is for path sequences. The simulations can make a model of the different outcomes of your trades if they had taken a different path or sequence.
By Monte Carlo simulation in trading you get a better understanding of the risk and uncertainty of your trading strategy because Monte Carlo simulation lets you run your backtest thousands of times in different orders.
A backtest is at best a rough approximation of what you might expect in the future. If you do a Monte Carlo simulation you can redraw your equity curve thousands of times (in less than a second) and thus measure how likely you are to replicate your backtest in live trading (given the markets stay the same, which, of course, is highly uncertain because markets are non-stationary).
This article describes what a Monte Carlo simulation is and gives you a practical example from a trading program (Amibroker).
Trading is all about alternative histories
We can’t judge a result solely on the end result. A good decision can produce a terrible result, and a poor decision could lead to great results. A decision has to be evaluated on the alternative or the opportunity cost. Nassim Nicholas Taleb calls this the alternative histories in his thought-provoking book Fooled By Randomness.
Alternative histories are events that could have happened but didn’t, normally due to chance and randomness. How do we know if a result is due to chance, luck, or randomness? These possible but never realized invisible alternative histories that perhaps could have taken place need to be simulated. What if the past had been slightly different? How will this influence our result?
One way to find out is by using Monte Carlo simulation:
What is Monte Carlo simulation in trading and investing?
Monte Carlo simulation is a statistical technique used in trading to model and analyze the behavior of financial instruments, assets, trading strategies, or portfolios by simulating various random market scenarios to better grasp the performance of the asset or strategy.
Monte Carlo simulation and backtesting has, of course, derived its name from the famous city and casino in Monaco. Monte Carlo is famous for its games involving random events: roulette, craps, blackjack, etc. We can argue the latter is mostly a game of skills, but nevertheless exposed to random card dealings.
Nassim Nicholas Taleb is a strong proponent of Monte Carlo simulation. The reason is that the Monte Carlo simulation lets you get a better grasp of how these alternative histories could have played out and led to completely different results. It simply shows how liable to chance and randomness your trading strategy is. What might the future bring when you start trading live?
The trading strategy’s backtest takes the trades as they happened, but what would have happened if the trade order was reshuffled? What if you had 7 consecutive losers instead of 4? Is it possible that an alternative path had twice the drawdown as the backtest?
Monte Carlo simulation examines a set of alternative trading simulations that potentially could have happened if history might have unfolded slightly differently.
For example, let’s say you had a backtest of a trading strategy that returned these trades: +3%, -1%, +7%,-2%, and +2%. The Monte Carlo simulation then uses those trades and for example reshuffles the trade order to -1%, -2 %, +7%, +2%, and +3%. The latter has two losing trades to start with and thus a higher drawdown. Was your original backtest just luck? The point with a simulation is to detect possible outcomes of the original backtest.
When you see how these alternative histories (or paths) play out, you can make better decisions on how liable you are to randomness and adjust size accordingly. Position sizing matters a lot in trading, something we will cover in a later article.
How do you perform a Monte Carlo simulation backtest?
You perform a Monte Carlo simulation backtest by simulating multiple possible paths for the asset price based on the trading rules, and you can better judge the robustness and how to optimize the strategy. The simulation uses random numbers and simulates the strategy hundreds or thousands of times to make different paths. Based on this, you get a lot of statistics.
The main idea behind a Monte Carlo simulation is to use random number
