Expert Advisor Strategy Design: Money Management Techniques (2024)

Expert Advisor Strategy Design: Money Management Techniques (1)

An important consideration as to whether or not an expert advisor can be used profitably in forex trading comes down to the money management it uses. Even if the most advanced logic is build into an expert advisor and backtests show amazing results over a long period – it will ultimately fail live if its money management inputs are not sound.

The problem is that most traders haven’t the slightest idea what money management really is or how it can be used to one’s advantage in automated forex trading.

In this article you can learn how to design an Expert Advisor strategy using solid money management techniques and implementing the expectancy of max drawdown and consecutive loss to help your EA trade the market for longer.

In essence, money management applies to the strategic manipulation of position sizes on different trades to ensure a positive outcome. With an intelligent money management system, losing trades are reigned in and losing streaks are accounted for, and position sizes grow steadily and modestly along with equity growth.

Every expert advisor is going to have losing streaks. When they come and how long they last – no one knows. There will also be profitable winning streaks, but it is losing streaks that can wipe your account and thus need to worry about. Hence, before you even set the inputs of your EA’s money management, you must know in advance the potential degree of your losing streak.

The Expectancy of Max Draw Down and Consecutive Loss

Money management or position sizing depends mostly on your trading system’s expectancy for the worst case scenario – that is, the potential max consecutive losing trades and max draw down.

Assuming we are dealing with a 10 year backtest with accurate historical data, there is at least 2 different ways of determining your potential losing streak. The easiest way is to look at your max historical draw down and consecutive losing trade number.

Expert Advisor Strategy Design: Money Management Techniques (2)

As you can see, the Maximal drawdown is $1800, and it carries more weight than the percentage number beside it. The percentage number of 9.7% is the high to low equity drawdown, which is interesting, but to further handicap the system, you should imagine that the system started at the beginning of the drawdown and suffered $1800, which would make the percentage drawdown 18%. The other number to look at is the Maximum consecutive losses (losses in money), which is 12 (totaling $676) — and this gives us the size of a losing streak. Obviously, because the maximal drawdown of $1800 is much larger than the $676 losing streak, there must have been a few back to back losing streaks to get the maximal drawdown figure. Because the maximal drawdown of $1800 (18%) is the larger number, it becomes the baseline for the worst case scenario.

An alternative method to calculate the potential max consecutive losing trades (and maxmimal drawdown) is to look at Loss trades (percentage of total) to calculate the probabilities of consecutive losing streaks. For instance, if we take the performance of our 10-70 SMACross (Method2) on 0.1 lots, we have 70% losing trades. In two trades, there is a 0.70 * 0.70 = 0.49 or 49% chance of two losses and a 0.30 * 0.30 = 0.09 or 9% of two gains, while the rest is 100 – (49 +9) = 42% change of 1 gain and 1 loss. This is important because it shows how easy it is to have 2 consecutive losses while it is unlikely (but still possible) to have 2 consecutive gains. In order for a possibility to be significant it has to have at least a 5% chance of happening. If you multiple 0.7 by 0.7 seven times, it gives us 0.57 or a 5.7% chance of happening, meaning it is realistic to expect 7 consecutive losses. To further handicap our system, we have to imagine double that, or 14 consecutive losses, in a real trading scenario. Interestingly enough, this is close to the 12 consecutive losses we experienced in the 10 year backtest, which means we are on the right track in our calculations.

Once you know your max losing streak, you can then multiply it with either the average loss per trade or the stop loss of your trade to determine the max draw down of your system. If you multiplied 14 X average losing trade of 93 pips, you would have 1300 pip DD, and if you multiplied 14 X stop loss of 200 pips, you would have 2800 pips. The historical max draw down is somewhere in the middle at $1800 (or 1800 pips), and that is probably the best compromise between the two.

Max Risk Preference: No more than 25% DD

The objective of money management is to limit losses such that when the unfortunate event of experiencing that high number of consecutive losses we would still have enough equity to still trade and experience the gains.

Note: if we lose 20%, the remaining 80% would need to gain 25% to recover (the 20% loss is equal to 25% of our remaining 80% equity). If however we lost 50%, the remaining 50% in equity would need to have 100% gains to recover, which is difficult to do. This is where risk preference comes into the picture. Let’s say we’re only comfortable with losing 25%, the remaining 75% would need 33% gain to recover to the original equity, which is a more achievable objective.

Another way of looking at this max risk preference is to see it as the UNCLE POINT or the amount of draw down that provokes a loss of confidence in either the investors or the fund management. If either the investors or the managers become demoralized and withdraw from the enterprise, then the fund or strategy dies. Generally the uncle point is 25% draw down, to issue a loss of confidence in the strategy and discontinuation of trading it.

So now we can bring in our calculated expectancy of 14 max consecutive losing trades of 128 pips each into the picture. We don’t want our 14 max consecutive losing trades of 100 pips each to exceed our 25% max risk preference.

What then do we make as a percentage to risk on each trade?

If each losing trade incurs approximately 100 pips, we would need those 14 losses to take 25% of our equity, 25 / 14 = 1.78. So each time we trade we would only put 1.78% of equity to ensure that at worse we would only have a 25% loss in equity.

Thus, you can only expect to have 0.18 lot size at most on a 10K account size in order to have less than 25% DD (1.8 X 100 X 14 = 2520). Our 1.78% for each trade would give us less gain than when placing say 5% in each trade; however, we would also have significantly less chance of blowing up.

The KEY Is that when and exactly where the expert advisor takes a hit from the market, it must insulate your equity and hit back harder each time bringing your account back on track as quickly as possible. It must manage position sizing to ensure that in the long run your account remains on track to a respectable return.

Note: there is an indicator that you can place that works with your stoploss size (or substitute your average loss for your stoploss) and account equity to determine your lot size.

EA Built in Money Management Code: Percentage Risk per Trade.

There are many ways to determine the money management of an EA, but I am going to point out one that has gained some popularity in recent months. It is a money management mechanism adopted by Funyoo in his template – used in my MACross EA –that auto-calculates the lot sizes based on your account size and your pre-selected risk percentage and stop loss amount.

The external parameters look like this:

Expert Advisor Strategy Design: Money Management Techniques (3)

You can turn on the money management feature by setting MM=true. If MM=false, then lots = 0.1 or whatever you set for this field. The risk you set is the percentage of the account, and you also indicate the minlot and maxlot minimal and maximal lots allowed by your broker.

The code of the money management looks like this:

double lotsoptimized(){
double lot;
if(stoploss>0)lot=AccountBalance()*(risk/100)/(stoploss*pt/MarketInfo(Symbol(),MODE_TICKSIZE)
*MarketInfo(Symbol(),MODE_TICKVALUE));
else lot=NormalizeDouble((AccountBalance()/lotsize)
*minlot*risk,lotdigits);
return(lot);
}

Funyoo’s adoption of the money management mechanism is basically the % per trade risk rule in effect. It is calculated by taking the difference between your entry price and initial stop-loss exit and multiplying it with your trade size. This will give you the dollar loss if you are stopped out.

2% Per Trade Risk Formula
Account size x 2% = Risk Amount
$10,000 X 2% = $200

If you had a $10,000 account balance and 200 pip stop and selected 2% risk per trade, you would be able to trade only 0.1 lots because 0.1 lots stopped out at the 200 pips stop loss would be $200 or 2%. If indeed the 10-70 MACross stopped out at 200 pips each, I would not want the risk percentage to be 2%, because it would not be able to handle more than 14 losing trades of 2% each and still be less than 25% max draw down. However, since the average losing trade is closer to $100 per trade, I can increase the risk percentage just a little, making it closer 2.5% in order to be less than 25% max draw down with 14 losing trades.

Let us see what the performance of the system would be with a 2.5% risk:

Expert Advisor Strategy Design: Money Management Techniques (4)

The system has near doubled in return, achieving $12500 while staying below the 25% maximum DD risk tolerance level. We achieved our goal of trying to get the most out each trade with a comfortable risk level. If we added any more percentage risk we would increasing our return at the expense of a greater, more uncomfortable draw down. It is always a fine balance between the two, and you should always err on the side of caution, that is, on the side that leads to less draw down. The drawdown of the future can always be much more than our backtest and calculations, and we should always expect and prepare for the worst.

Funyoo’s money management code automates the lot sizing for us – making the money management seem very simple. You just need to select the risk percentage – 2 or 3%– and the EA handles the rest. It is indeed very simple, so long as you are modest and fully aware of the worst case scenario. It is just as simple to increase this risk percentage to 10 or more, and consequently jeopardize the account. Money management is thus one of those powerful tools that can lead to more profits if controlled or more losses if not.

Conclusion

Profits and losses do not likely alternate with smooth regularity but instead appear as winning and losing streaks. When you realize that this is natural, it are more likely to stay the course during drawdowns, and also to stay appropriately modest during winning streaks.

In general, good risk management combines several elements. There must be a calculation and clarification of the potential max consecutive loss and drawdown of the system determined through backtesting and extrapolation. There must also be a clarification of the max risk preference of the system going forward, such as no more than 25% draw down. Once you have an idea of your system’s historical (and potential) max drawdown, you can begin to add a money management system (such as the offered by Funyoo) that auto-adjusts the lots only to the degree that each trade will not exceed its selected %risk (in relation to account size and stop loss) and that a accumulation of such losing trades in the form of a losing streak will not exceed your predetermined max risk tolerance.

Generally, in order for your system to be around for the long run, it should never exceed a 2% risk (of trading account size) on any given trade, but exceptions can be made if the average losing trade is much less than the stop loss. This smaller percent risk is an acknowledgment that 10+ losing streaks can and do happen, and you have to be able to comfortably survive them. If you are trading with concurrent systems, it is also important to never exceed an overall 6% risk (of your trading account size) at any given time. You can have three strategies with 2% risk each or 6 strategies with 1% risk each, but having more than 10% combined risk is asking for trouble –no matter how non-correlated you think the systems or currencies are to each other.

In sum, then, money management is all about taming the dragon – once you know that you can survive its claws (approaching gingerly with tight stop losses) and fire (stealing yourself against a losing streak), you may profitably mount and ride the beast upwards (steadily rise in equity). If you approach her with humility and respect, setting your risk inputs modestly, you can shield yourself from danger and come out the winner. If instead you approach her with greed and set your risk inputs for maximal gain, sooner or later your EA will turn against you and consume your account.

Expert Advisor Strategy Design: Money Management Techniques (2024)

FAQs

How to create a trading EA? ›

Steps that you need to follow to create EA from a trading strategy.
  1. Set Your Account. ...
  2. First steps in EA Studio. ...
  3. Create or generate strategies and create EA. ...
  4. Choose a Strategy from the Collection. ...
  5. Analyzing the Trading Rules and Statistics of the Strategy. ...
  6. Export an Expert Advisor. ...
  7. Test an Expert Advisor with MetaTrader.
Apr 29, 2020

What is the money management method in forex? ›

Basically money management in trading is a defensive strategy that is meant to preserve capital. It is a way to decide how many shares or lots to trade at any given time based on your available capital. Successful money management can save you from draining your account when you hit a bad streak of losing trades.

What is the most profitable trading strategy of all time? ›

Three most profitable Forex trading strategies
  1. Scalping strategy “Bali” This strategy is quite popular, at least, you can find its description on many trading websites. ...
  2. Candlestick strategy “Fight the tiger” ...
  3. “Profit Parabolic” trading strategy based on a Moving Average.
Jan 19, 2024

What strategy do most traders use? ›

Top 10 Most Popular Trading Strategies
  • Trading Strategy #1 – Buy and Hold. ...
  • Trading Strategy #2 – Value Investing. ...
  • Trading Strategy #3 – Swing Trading. ...
  • Trading Strategy #4 – Momentum Trading. ...
  • Trading Strategy #5 – Scalping. ...
  • Trading Strategy #6 – Day Trading. ...
  • Trading Strategy #7 – Positions Trading.
Feb 23, 2023

How to build an EA without coding? ›

EA Builder Pro is the ultimate tool for creating EA's without having to write a single line of code. We've got everything you need in one place. Indicators, Conditions, advanced Stop Loss and Take Profit, Money Management and out-of-the-box EA templates. Backtest your EA with the built-in backtester.

What is the best Expert Advisor builder? ›

EA Studio is definitely one of the best expert advisor builders that is web-based, which means you don't need to install any software on your computer. With EA Studio, you can generate automated trading strategies quickly and easily. The software has a simple interface that makes it easy for even beginners to use.

Why use EA for trading? ›

Advantages of using an EA: Discipline – these programs are set to certain parameters and will manage your positions based on the programmed strategy. Using a set of yes/no triggers it will make trading decisions and act on them instantly without changing their decisions like humans would do.

What is the number one rule of money management? ›

The 50-30-20 rule recommends putting 50% of your money toward needs, 30% toward wants, and 20% toward savings. The savings category also includes money you will need to realize your future goals.

What are the 3 basic steps in money management? ›

Understanding how to create a realistic budget, track your spending, and set attainable savings goals are essential steps in the process. It can be overwhelming to take on all these tasks at once, but when broken down into smaller steps, money management success is achievable.

How do you control money management? ›

How to manage your money better
  1. Make a budget. According to the Capital One Mind Over Money study, people dealing with financial stress struggle more with budgeting. ...
  2. Track your spending. ...
  3. Save for retirement. ...
  4. Save for emergencies. ...
  5. Plan to pay off debt. ...
  6. Establish good credit habits. ...
  7. Monitor your credit.

How to make a MT5 Expert Advisor? ›

Here are the steps you can follow to create an EA in MT5:
  1. Open the MetaTrader 5 platform on your computer.
  2. Go to the "File" menu and select "New." This will open the "New Project" window.
  3. In the "Project Types" panel, select "Expert Advisors."
  4. In the "Templates" panel, select "Empty Project."
Jan 2, 2023

How to build Expert Advisor MT4? ›

To create an EA ( Expert Advisor ) in MT4 , you will need to have some basic programming knowledge and understanding of the MQL4 language . First , open the MetaEditor by clicking on the " Tools " menu and selecting " MetaQuotes Language Editor " or by pressing the F4 key .

How to program an Expert Advisor for MT5? ›

How to setup an Expert Advisor (EA) and Algo trading in MT5 5
  1. From the navigator window, under Expert Advisors, drag the EA you are trying to use and drop it on a chart.
  2. From the setup pop-up window, check the boxes for “allow modifications of signal settings” and “allow algo trading”.
  3. Click “o*k” to save the settings.
Mar 14, 2024

What is the simplest most profitable trading strategy? ›

One of the simplest and most widely known fundamental strategies is value investing. This strategy involves identifying undervalued assets based on their intrinsic value and holding onto them until the market recognizes their true worth.

What is smart money trading strategy? ›

What Is SMC Strategy in Trading? The SMC forex strategy involves identifying patterns and signals that indicate the involvement of institutional investors. This includes analysing order blocks, liquidity zones, breaks of structure (BOS), changes of character (ChoCH), and fair value gaps.

What is the difference between risk management and money management in trading? ›

While risk management is about keeping losses small relative to your gains, money management is about ensuring that loss per trade is small relative to your total account size.

Top Articles
Latest Posts
Article information

Author: Ray Christiansen

Last Updated:

Views: 6374

Rating: 4.9 / 5 (69 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Ray Christiansen

Birthday: 1998-05-04

Address: Apt. 814 34339 Sauer Islands, Hirtheville, GA 02446-8771

Phone: +337636892828

Job: Lead Hospitality Designer

Hobby: Urban exploration, Tai chi, Lockpicking, Fashion, Gunsmithing, Pottery, Geocaching

Introduction: My name is Ray Christiansen, I am a fair, good, cute, gentle, vast, glamorous, excited person who loves writing and wants to share my knowledge and understanding with you.