Finding the best Forex indicator : MACD

financialcode
4 min readMay 9, 2021

In this series, we will be looking at the different indicators available and running a set of fix variables and benchmark the indicators across a series of currency pairs.

The objectives is to understand and hopefully find the best indicators or none at all.

Consideration

We will be using some fixed variables so that we have a constants test cases.

  • Lots size will be 0.1 across the board
  • We will be testing against the following currency pairs, AUD/USD, AUD/JPY, USD/JPY, EUR/USD and XAU/USD.
  • We will be testing against Timeframe of M15, M30, 1H
  • Backtest data will be for the year of 2020.

Now that we have a clear understanding of the fixed variables, we are going to be looking at RSI as an indicator today.

What is MACD

Moving average convergence divergence (MACD) is a trend-following momentum indicator that shows the relationship between two moving averages of a security’s price.

How are we going to trade today

When the MACD current value is below 0 and the MACD previous value is above 0, we will be selling.

When the MACD current value is above 0 and the MACD previous value is below 0, we will be selling.

Using the previous value of the MACD, we will be certain that the MACD have crossed the 0 point and therefore confirming the trend signal.

Using MT5, we are using the following conditions to make the trades.

The following are the parameters that will be used

input int macd_fast =12;
input int macd_slow = 26;
input int macd_signal = 9;
input double factor = 1;
input int rewardRatio = 2;

Next is the condition for trading.

if (macd_trend[ArraySize(macd_trend)-2] > 0 && macd_trend[ArraySize(macd_trend)-1] < 0){
tp = NormalizeDouble(last_tick.ask — factor * rewardRatio , _Digits);
sl = NormalizeDouble(last_tick.ask + (factor) , _Digits);
trade.Sell(0.1,_Symbol, last_tick.ask, sl,tp,””);
}

if (macd_trend[ArraySize(macd_trend)-2] < 0 && macd_trend[ArraySize(macd_trend)-1] > 0){
tp = NormalizeDouble(last_tick.bid + factor * rewardRatio , _Digits);
sl = NormalizeDouble(last_tick.bid — (factor ) , _Digits);
trade.Buy(0.1,_Symbol, last_tick.bid, sl,tp,””);
}
lastBar = iTime(Symbol(),PERIOD_CURRENT,0);
}

Results

On a single pair of the XAU/USD, we are testing it across 3 different timeframes, M15, M30, 1H.

Single Currency (XAU/USD) — Result

In this single currency pair test, we noted that across the 3 different timeframes, the win percentage is about 37.09% averaged.

By focusing on M30, we notice that we actually made a negative Nett (Profit-Loss). This surprising as we assume that by moving up the timeframe, the result should be more consistent and generate lesser false signal.

The M15 is clearly the winner in this case, with both the high Win Percentage and Nett returns. But M15 does made significantly more trades compare to the rest of the timeframe, 2.6x verse M30 and 4.48x verse 1H.

Over Multiple Pairs (AUD/USD, AUD/JPY, USD/JPY, EUR/USD and XAU/USD)

M15

M15

M30

M30

1H

1H

Summary

From the back testing result, EURUSD & AUDUSD, doesn’t seem to have any data. I probably will have to circle back and try again, as this can be an issue with the backtesting engine from MT5.

Overall, we can see that it is still a sea of reds, across the all the currency pairs excluding XAUUSD. When we are testing just a single currency, the result was very positive and we had high hopes but guess not.

Taking a look at the USDJPY & AUDJPY, we noted that both the M15 & M30 timeframe executed most the same numbers of trades. But M15 does have a higher profit factor for the USDJPY.

As for the AUDJPY, the profit factor of 0 is concerning, this will need a more in depth test to understand, as the timeframe and condition of the market does affect it.

In conclusion, MACD doesn’t perform very well against all currency pairs but if the pairs have high fluctuation, the MACD does do a good job as evident from the 1H timeframe.

For more of the other indicator review, visit the links below:

https://financialcode.medium.com/finding-the-best-forex-indicator-rsi-indicator-c8b1c30856fa

--

--