Forex algorithm- Risk Management

woman, writing, table-7520626.jpg

Hey,

This article outlines my plan to prevent the algorithm from collapsing, so if you do not understand any part of this, please feel free to ask me.

FIGURE 1: MT4 account summary

Now, you may already be running the algorithms or just about to start, and 98% of the time everything runs passively (automatically), which is great. But I want to remind you that there will come a day when a sharp spike will occur, and this article is here to guide you on what to do.

 

One of the biggest questions I get asked is why I suggest such a large deposit when the algorithm uses so little of the amount and the average unrealized PnL is under -£100, as in this example where it is -£12.42.

 

The reason why you need a large deposit is so you can hold an overnight sharp spike. This strategy is dependent on reversal, and you need to be able to hold the movement being made.

What are the limits of your account?

FIGURE 2: Nov 2019- Feb 2021

Most of you are using a £1000 account and running my most tested currency pair EURAUD at a 0.01 lot size and at 25 pip intervals. From trading history, we know this strategy can typically withstand around 550–600 pips for a sharp spike. Just to provide some perspective, I’ve added a figure above that shows you the extent of this movement. Remember, it can hold 550-600 pips either way from the current price down (blue area) or up (green area). So £1000 does go a long way.

 

According to my calculations between 2020 and February 2021, there were two instances (grey areas in Figure 2) where your account would likely have been at risk of being wiped out if you didn’t take the following steps. However, both times, as long as you followed these steps, your account would have been fine. Admittedly, the hardest part is having the courage to make these drastic changes, but nowadays, with the wealth of online resources available, making the decision is easier. The last five months have been relatively calm, so expect a storm to come soon.

 

Before we discuss the ways we can micromanage your accounts to prevent a collapse, let’s talk about these two grey areas in Figure 1 and why the strategy cannot cope with them.

 

In summary, the strategy works by hedging against the trend and closing 10-pip profits with the trend. The full explanation can be found in my other articles. In any trend, we are looking for a 30–40% reversal to make a profit, and considering EURAUD is one of the most stable ranging markets, always following a mean reversion (the theory implying that asset prices gradually move towards the long-term mean), there are only a few examples when your account could be in jeopardy.

FIGURE 3: Candlestick Day chart between 29th May 2020–5th June 2020 (EURAUD)

This is a zoomed-in version of Figure 1 for the regions between May 29, 2020, and June 5, 2020.

To describe the graph, the grey area represents the 575 pip range seen in Figure 1, which is the region we can hold with our current model.

The trend moved 730 pips before it reversed by more than 50% (as seen by the pink lines). This phenomenon exists with EURAUD, as whenever there is a sharp spike, the currency will always experience a retracement or reversal. In other words, if your account could hold the maximum range of 730 pips plus, this wouldn’t even be a problem.

 

However, here lies the dilemma: how much money should you deposit to statistically cover most of the sharp spikes? Now, I can tell you that if you ran the £1000, 0.01 lot, 25 pip step model with a starting balance of £1800 instead, this 730 pip movement would be close to profitable as the grey area would cover the entire trend. However, £1800 will also have its limitations. In theory, if you had an infinite deposit, this strategy would always work, as I can confidently say there will always be a 30–40% reversal, as this has been happening for the last 17 years.

 

From this information, I hope you can clearly see that by increasing the pip range that your account can hold, the risk will be reduced. This is important because towards the end of the article, I will explain the different risk management strategies that extend the pip range.

The variable of the algorithm and how they increase the pip range

As I mentioned, most of you are running the £1000 model with 0.01 lots at 25 pip intervals. I may have directed you to this section of the article if you wanted to increase your risk to generate higher returns.

Lot size

The lot size is the unit of the trade. A 0.01 lot is a micro-lot and is the lowest size you can open. Increasing the lot size means the algorithm generates more profit as you are investing more per trade, and it also reduces the reversal required, creating a tighter range for closure. The figure below shows the comparison of the take profit range (blue dotted line) of a 0.01 and 0.02 account. Having a smaller range means more trades open and close in a day, therefore resulting in a higher daily yield. However, during a spike, the 0.02 account will experience a greater drawdown (unrealized PnL). This is why a 0.02 account must have a greater starting balance to hold the recommended 550–600 pip range.

FIGURE 4: Real-time comparison between 0.01 lots, 25 pip interval account with a 0.02, 20 pip interval account

Pip Interval

The pip interval is the minimum distance between each new trade placed by the algorithm. So, if the market moved 200 pips:

A 25 pip interval account would typically have an average of 8 positions opened.

A 10 pip interval account would typically have an average of 20 positions opened.

Similar to lot size, reducing the pip interval increases the profit generated and tightens the gap between the two take profit ranges, resulting in a greater frequency of trades closing in a single day. However, having more positions opened will increase the drawdowns on your account.

What can we do if the market is experiencing a sharp spike?

A market spike
If you are reading this section of the article, it either means you are trying to understand what could happen, or the market is currently spiking and you are trying to understand your options. If this is the case, it’s important not to panic. You’ve trusted the strategy this far, so now is the time to give the market some breathing room. After every single sharp spike, there has always been a retracement. Just remember that EURAUD moving 200 pips, from 1.51 to 1.49, means globally every 1 Euro which was worth A$1.51 Australian dollars is now worth A$1.49. That’s a lot of money being wiped off the earth. You can hold 550–600 pips, and by following the risk management strategies below, you can extend the range.

Calculate how much the spike has moved so far

FIGURE 5: MT4 Account summary

Firstly, I want you to see how much the market has moved since the first positions. To do this, calculate the difference (underlined in red).

(1.58854 – 1.56906) = 0.01948. Then, for simplicity, (0.01948 x 10000) = 194.8 pips.

As you can see, a drawdown of 194.8 pips results in a loss of -£43.55 when the account balance is £1000.

 

Up until a 350 pip drawdown, when the unrealized PnL is around -£250, the market is within normal limits. However, if this type of movement happens within a very short period, it’s best to check the global news.

 

Now, depending on your account balance (credit, existing profit, initial deposit), between the range of 350 pips to 600 pips, there are four different risk management steps.

Risk Management Step 1: Take a small loss or pre-emptively stop trading.

There is nothing wrong with taking a small loss and shutting down the algorithm temporarily to start trading another day. Big movements typically occur due to fundamental news such as Brexit, coronavirus, general elections, natural disasters, and other country-specific events. Additionally, after major news events, the markets often become calmer for a while, so you will likely recover from the small loss. It’s important that you are aware of news affecting your currency pairs, as ultimately the decision is yours to make.

Yahoo Finance EURAUD

TradingView EURAUD

Wallet investor EURAUD

Investing.com EURAUD

 

Now, of course, this is a very hard decision and it’s very personal to each person and their attitude to risk. Before I allow anyone to start trading with my algorithm, I always say to think not to be emotionally invested with your deposit. However, you should remember that a 200–400 pips movement is relatively common, and you should seek some fundamental reason for this movement.

Risk Management Step 2: Increase the pip intervals

By reducing the number of positions open, you’re allowing yourself to increase the 500–600 pip range your account can hold. Although this intervention will also mean you increase the retracement required to close the position, typically after a spike with EURAUD, there is a greater pullback. The earlier you make this change, the better, as changing the pip interval will only affect the new positions that are opened.

This is why reducing your pip interval at the start reduces the number of trades that can be opened, hence decreasing your exposure.

Risk Management Step 3: Stop the algorithm and open an opposite position to stall the sharp spike.

Now, this step is a little drastic and should only be a last resort, but it is important that you know this step exists. This is the most technical step, so if you are still unsure, please do let me know, as it will do the job to save your account.

 

Between the years 2018–2020 backtesting, there were only two incidents, both mentioned above in figure 2. In both situations, RM3 would have done the trick to save your account. Admittedly, the covid spike is questionable as you would have held on for 2 months until the price retraced, however, the other retraced back within days. Overall, managing these events is key to the longevity of your account.

Essentially, you are delaying action on the account in the hopes that the market reverses back to that exact point when in the opposite trend. The idea behind this is to give the market an opportunity to spike freely.


The total number of lots the algorithm placed was 2.52 FX “Sell” (0.86 + 0.69 + 0.56, etc.) as shown in the figure. Now, at this point, let’s say I execute RM3, which is to stall at the current price to give the market an infinite pip range.


I would switch off the algorithm and manually place 2.52 FX in the opposite “Buy” position. Now, no matter how much the market further spikes upwards, I will be gaining the same amount as losing, hence the stalling concept. At any point, the maximum loss will be fixed at whatever price was when I placed the 2.52 FX. The reason people don’t normally do this is that it’s pointless, as you have gained nothing by having both buys and sells open. But for the algorithm, it is stalling the current price for the day it bounces back.


To clarify the benefit of doing this: you are allowing your account to close at a profit if the price returns to the exact price when the opposite trend pushes the price down to the original take profit.


The reason this is a drastic measure is that you are truly at the mercy of the market; it’s simply a waiting game for the market to retrace back to this point. The reason you cannot do this step below 200 pips is that if the market does shoot to 700 pips, a greater than 50% retracement may not occur.

Lastly-Don’t be scared of a big number

With all honesty, please do not be scared of big numbers; it’s the control of your emotions that makes a trader profitable. You took a leap of faith, trust in the algorithm, and remember that the market will always bounce back. We’re just hoping for a bounceback of at least 30–40%.

Account Summary

This is proof that even though the account dropped to -£583.31, and probably more, it still closed at a profit. Additionally, the last position is lower because for clients who opt for a lot size greater than 0.01, you can also reduce the size to reduce market exposure. At the last trade, I reduced the lot size, but it bounced back anyway.

Conclusion:

After understanding the different risk management options, please do not hesitate to ask for further clarification. Keep sending me screenshots of results; it really does help my page out.

Scroll to Top