Blog Item

Risk Simulation and The Monte Carlo Method - Forex Article

Monte CarloThere do not seem to have been any new EAs released recently of sufficient interest to capture my attention, so I thought I'd write an article about how to use either backtest or forward test results to gain further information about how good or bad a trading system actually is.

I guess this article could be viewed as a follow up to my previous article asking "Why do all Expert Advisors Fail?". In that article I suggested that some or many EAs didn't actually fail at all, but instead were discarded or written off by their users because those users had a completely different level of expectation to what the system would be likely to deliver in reality.

Let's face it, wouldn't it be fantastic if you were to buy an Expert Advisor, deposit $10k into an account, and the EA never had a losing trade? Inside of a year, your account balance might be up to $20k, or $100k or even more.

Sadly though, life just isn't like that, and stories like that very rarely actually happen in reality.

Readers with a keen eye might like to note that in my last paragraph I wrote "very rarely". The implication here is that there are instances where this does actually happen. The point I'm trying to make here is that it would be good to know at the very outset what the probability is of that scenario actually happening. Or, turning that scenario on its head, what are the chances of your $10k deposit being eroded to zero within that first year?

Believe it or not, there's a wealth of information such as this which can be obtained very quickly from some basic backtest results by using something called a Risk Simulator.

For instance, it's a straightforward task to find out how much minimum account deposit is needed to run a system safely with zero risk of ruin. It's also possible to find out how many trades a system will probably need to make (or how many days it will need to run) before the profit which is returned exceeds the drawdown that has occurred in the meantime.

It's also very easy to carry out something called a Monte Carlo simulation. Despite having a name which might conjure up images of gambling and casinos, the Monte Carlo Method is simply a method of using computational algorithms to generate models with uncertain inputs. There's more about Monte Carlo on Wikipedia for anybody who's interested, but I'll leave it that a Monte Carlo simulation is used to advise such things as likely returns, the risk of ruin and the probability that the account balance will at some stage drop lower than the initial deposit.

These are things which are impossible to ascertain from a conventional MetaTrader statement, but which are actually more important to know than anything else that the statement might say.

So how does Risk Simulation work?

When you look at any account statement and see that the win rate is 70% this means that, in a sample sequence of 10 trades, there will on average be 7 winning trades and 3 losing trades. The actual trade sequence might be W-W-W-W-W-W-W-L-L-L or it may be L-L-L-W-W-W-W-W-W-W or, more likely, it will be something totally random along the lines of W-L-W-L-W-W-W-L-W-W. The end result will nearly always be the same, but the journey along the way will differ according the exact sequence of those winning and losing trades.

Risk Simulation involves replaying different random win/loss sequences to produce different journey paths and find the best and worst things that could potentially happen along any of those journey paths. The only information that is needed to perform a risk simulation is the size of the average winning trade, the size of the average losing trade and the percentage win rate. It's then possible to generate a series of random trade sequences to find out just how safe a trading system really is.

The information above can be obtained either from a backtest or a forward test statement. Whichever method is used, it's important that there are enough trades in the report for it to be truly representative. In other words, it's no good if the report just covers a period of a few weeks. Secondly, if a backtest is used, it's important that the data used for the test is accurate. That means that data with a 90% modelling quality is the absolute minimum that should be used. If the system is a scalping system with low SL and TP values, significant attention needs to be paid to the spread used in the test and, if possible, 99% modelling quality tick data should be used.

The chances are that there will be either no, or only limited, forward test available available for most new EAs, in which case the only option will be to use the backtest data in a risk simulation exercise.

The other thing that's important to note about risk simulation is that trade lot sizes are generally fixed within the simulation test, and the compounding effects achieved by using any form of money management are ignored. This means that the system NEEDS TO BE PROFITABLE IN TERMS OF PIPS WON, not just in terms of money. Many Martingale type systems don't fulfill this criteria, and a risk simulation will simply show straight away that there is a 99.9% risk of ruin. Risk simulation certainly shouldn't be ignored!

Risk Simulation Results and Example

As an example, I've entered some imaginary results into a risk simulator to demonstrate how it works.

The average win size of this imaginary system is 4.4 pips, its average loss size is 30.3 pips, and the win rate is 89%. I've set it up to simulate 2,000 random trades using 0.1 lot sizes with an initial $2,000 deposit. Using fixed lot sizes, a conventional MetaTrader report would show the system to be profitable with a Profit Factor of 1.17.

Monte Carlo Simulator

The simulator very quickly makes 5,000 random passes and tells me that the likely return is 58.1%, the likely drawdown is 12.9%, there's a 1.0% risk of incurring a 30% drawdown (I chose this drawdown level in the test), and that only 14.6% of users will not see their account balance dip below their $2,000 deposit (meaning that 85.4% of users will see their deposit eroded at some stage).

I could obviously have set the maximum drawdown level at any level I wanted, but I chose 30% because experience dictates that this is the level at which most people can take no more pain and switch the system off. The mere fact that there was a 1.0% chance of hitting a 30% drawdown is not good enough and renders the system as being unsafe, so the next stage of the risk simulation process involves finding out what minimum deposit level is needed to run this imaginary system so that there is zero chance of incurring a 30% drawdown.

Fortunately, the simulator provides that information as well. It just continues increasing the deposit amounts and running fresh sequences of random passes until it reaches an amount where the risk of ruin is 0.0%.

Minimum Deposit

In the case of our imaginary system, the simulator suggests that a minimum deposit of $2,4333 would be necessary to start trading 0.1 lots with a 0.0% risk of hitting a 30% drawdown. Similarly, a minimum deposit of $243 would be needed to start trading the system with micro lots.

Having established the minimum deposit which is needed to run the system safely, the final task is to get an idea of how long it will take to see a return from the system which is higher than the drawdown which has been incurred along the way.

Minimum Trades

The simulator tells us that it would probably take around 261 trades before the return exceeded the drawdown. Assuming the system is a relatively high frequency trader which takes, say, 5 trades a day, it's worth bearing in mind that it might take 10 or 11 weeks to see this return. You would, therefore, need to be quite patient if you were to use this system live, as most people expect to see a return in a far shorter time. This is precisely the sort of scenario I was referring to in my previous article entitled "Why do all Expert Advisors Fail?"

Hopefully, the above will give some insight of what can be gained from a test report and it underlines the importance of backtests using accurate data. Even so, you'll notice that I've used the words "probably" and "likely" in the article above. That's because there are no cast-iron guarantees when it comes to trading. It is fraught with risks which can never be removed, and successful traders will simply use Probability Theory to control those risks.

Discussion (2 comments)

  1. On 07/27/2013 at 11:21, Bob said:

    what is the name of the software that you use for this analysis?

  2. On 07/27/2013 at 11:41, MellyForex Admin said:


    This particular software is called MTReport 4, but there is other software available which will do the same sort of thing.

Add a Comment

;-) :-) :-D :-( :-o :-O B-) :oops: :-[] :-P

To prevent automated Bots form spamming, please enter the text you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.