MACD and RSI Strategy (Backtest And Example)

Last Updated on December 21, 2022

There are different ways of performing technical analysis. While some focus on price action, others make use of indicators. Both moving average convergence divergence (MACD) and the relative strength index (RSI) rank among the most popular indicators used in technical analysis and trading. But what is the MACD and RSI strategy?

The MACD and RSI strategy refers to a trading method that makes use of both indicators in analyzing and trading the markets. The combination of both momentum indicators may give more insight into what the market may do next and how it could move in the future.

The MACD indicator is a moving average-based momentum oscillator primarily used to analyze trends, while the RSI is a momentum indicator primarily used to identify overbought/oversold conditions in the market.

In this post, we take a look at the MACD and RSI strategy and we end the article with a backtest.

What is MACD?

MACD (or MAC-D, as it’s often called by its lovers) is the short form for Moving Average Convergence/Divergence. It is a momentum indicator that is mostly used to trade trends. It is based on two exponential moving averages (EMAs) — a 26-period EMA and a 12-period EMA. On the chart’s indicator window, it appears as two lines — the MACD line and the signal line — that fluctuate up and down about the centerline (zero line) without any upper or lower limit. The indicator is actually an oscillator, as it oscillates above and below the zero line. But despite being an oscillator, it is not commonly used to determine overbought or oversold conditions.

How the MACD indicator is calculated

The MACD indicator consists of two lines: the MACD line and the signal line. The MACD values (which are plotted as the MACD line) are calculated by subtracting the value of a 26-period EMA from a 12-period EMA, while the signal line is gotten by calculating a 9-period EMA of the MACD values.

As the 12-period EMA is constantly converging toward, and diverging away from, the 26-period EMA, the MACD values are converging toward, and diverging away from, zero. In essence, the MACD line oscillates above and below the zero level. The signal line, which is a 9-period EMA of the MACD line, oscillates around the MACD line. Sometimes, the MACD line (or in some cases, the difference between the MACD line and the signal line) is plotted as a histogram.

MACD indicator

How MACD is interpreted

Here are the common interpretations of the MACD indicator:

  1. The MACD line rising above zero is considered bullish, while falling below zero is bearish. That is, when MACD turns up from below zero it is considered bullish, and when it turns down from above zero it is considered bearish.
  2. The MACD line crossing from below to above the signal line is considered bullish — the further below the zero line the earlier the signal. Conversely, the MACD line crossing from above to below the signal line is considered a bearish signal, and the further above the zero line, the earlier the signal.
  3. A divergence signal occurs when the MACD line and the price swing are not in sync, with either making a higher high or lower low when the other is not making the same.

Note that in a range-bound market, the indicator will whipsaw, with the MACD line crossing back and forth across the signal line. It may be best to avoid using the indicator in this situation or even avoid trading at all until the market direction is clear.

What is RSI?

Developed by J. Welles Wilder, the RSI is a momentum oscillator that measures the speed and change of price movements. The indicator consists of a single line that oscillates between zero and 100. Traditionally, when the RSI is above 70 and overbought, the market is considered overbought, and when it is below 30, the market is considered oversold. Apart from the overbought/oversold signals, divergences and failure swings can be interpreted as signals. Some even use higher-period RSI to identify the general trend.

How the RSI indicator is calculated

It requires a multi-step calculation:

  • Step 1: calculating the Up days and Down days
  • Step 2: Calculating the relative strength RS by dividing a smoothed moving average (SMMA) of the Up by the SMMA of the Down days
  • Step 3: Computing the RSI from the RS using this formula: RSI = 100 – [100/(1+RS)]

How RSI is interpreted

RSI indicator
  • Overbought/oversold signal: When the RSI is above 70 and overbought, the market is considered overbought, and when it is below 30, the market is considered oversold. However, you can adjust the levels if necessary to better fit the market you want to trade. For example, if the market is repeatedly reaching the overbought level of 70, you may want to adjust this level to 80. But note that during strong trends, the RSI may remain in an overbought or oversold region for extended periods.
  • Divergence signal: This happens when the market makes a new high or low that isn’t confirmed by the RSI, and it can signal a price reversal.
  • Swing failure: If the RSI makes a lower high and then follows with a downside move below a previous low, a Top Swing Failure has occurred. If the RSI makes a higher low and then follows with an upside move above a previous high, a Bottom Swing Failure has occurred.
  • Gauging the trend: In an uptrend or bull market, the RSI tends to remain in the 40 to 90 range with the 40-50 zone acting as support. On the flip side, during a downtrend or bear market, the RSI tends to stay between the 10 to 60 range with the 50-60 zone acting as resistance. These ranges will vary depending on the RSI settings and the strength of the market trend.
  • RSI patterns: RSI also often forms patterns, such as double tops or bottoms, as the price swings. These RSI patterns may signal a potential price reversal.

What is the MACD and RSI strategy?

The MACD and RSI strategy refers to a trading method that makes use of both indicators in analyzing and trading the markets. The combination of both momentum indicators may give more insight into what the market may do next and how it could move in the future.

From what we have discussed so far, you can guess that there are many ways you can combine the MACD and the RSI not just to gain more clarity about what the price is doing but also to formulate a trading strategy. For instance, you can use the MACD to identify the overall direction of the trend, while you use the RSI to identify price swings. In this case, you can create a swing trading strategy by specifying the levels of the MACD and the RSI to make a long or a short trade.

Another option is to use both indicators as swing-trading oscillators and use one to confirm the other. Let’s take an example: the strategy could be to go long if the MACD is rising above the signal line and the RSI is rising after falling into the oversold region, as you can see in the chart below:

MACD and RSI strategy

The opposite can also be used to get a short signal: when the MACD line falls below the signal line and the RSI is descending after rising to the overbought region. See the chart below:

MACD and RSI strategy

Is MACD and RSI a good combination?

Yes, the combination can be good. But it depends on who you ask. Some technical analysts would argue that both are momentum indicators and combining them would amount to redundancy. In other words, why use two indicators if one indicator can show the same thing? Most of the time, when the RSI is rising from the overbought region, the MACD line would cross the signal line. If both tell the same story about the market, why clutter the chart with many indicators? Even the most indicator-loving analyst would agree that the chart should be kept clean to reduce the likelihood of analysis paralysis.

While the above argument is legitimate, many traders do combine MACD and RSI to get the best of both indicators. Depending on who is using it and how they are using it, MACD and RSI combination can be a good thing, and here’s why:

  • You need one to confirm the signal from the other: The RSI tends to lead, and one thing about leading indicators is premature signals. You will need a slower indicator like the MACD to confirm a signal from the RSI. There are times the RSI may be in the overbought region and keep oscillating around there for a long time. In that situation, you would need the MACD to know when the momentum has shifted to the downside.
  • You get more confident in your strategy: With more confirmations, you reduce the chances of false signals. This can help you develop more confidence in your strategy.
  • You can create more strategies from the combination: There are many ways you can combine the two indicators to create a trading signal. This may include changing the settings to get what is suitable for the market you are trading.

Which is more accurate MACD or RSI?

Both MACD and RSI are similar in many ways — they are both momentum oscillators used to determine the power of the market trend. Using their traditional settings and signal methods, the RSI tends to generate more signals; but it also has more false signals. To know which one is more accurate, you will need to backtest them.

However, even if backtesting shows that one is more accurate than the other based on the parameters you use and the markets you test, it does not mean that the other cannot perform better in a different scenario with different parameters or markets. After all, experienced traders apply these indicators to their trading strategies in different ways. So, when it comes to comparing the MACD and the RSI to find out which one is better, it all depends on the trading scenarios in which one performs better than the other and generates more accurate results. 

The focus shouldn’t be on which is more accurate, but rather, on how to create profitable trading strategies with each indicator or a combination of both indicators.

MACD and RSI examples

There are many ways to use the MACD and RSI in trading, as we have hinted above. Here are some common examples of trading signals from each of them:

MACD trading examples

Take a look at the chart below. You can see that the MACD follows the momentum of the market very well. It rises as the market rises and falls as the market falls. We labeled just two signals to show this example. The first one is a long signal that was generated when the MACD line rose above the signal line, far below the zero level. You can see the price bar where a trade would have been entered. By the time the MACD turned below the signal line after rising far above the zero level (a short signal), a lot of profit would have been made. Even the short signal produced a good price decline from the end of August to the beginning of October.

MACD trading example

RSI trading examples

RSI trading example

From the chart above, you can see that the RSI rose to the overbought region and then descended from there, which was a signal to short the asset. The signal played out well. By the time the RSI fell into the oversold region and created a buy signal, you would have made a lot of profit. Notice that without a sizeable stop loss, the buy trade would have been stopped out before the price rose. Finally, note the divergence signal that just occurred is playing out at the moment.

How can you use RSI and MACD together?

There are many different ways you can combine the MACD and RSI to get a good trading strategy. One way is to use each to confirm the other when trading price swings, which we have shown above. Another way is to use custom settings that make the RSI faster while the MACD is slower, such that the MACD shows the price trend, while you use the RSI to find mean-reversion trades in the direction of the MACD momentum.

MACD and RSI strategy backtest

A strategy backtest with trading rules and settings is coming shortly.

Similar Posts