Skip to Main Content


How to Trade the MACD Indicator

One key component of the markets that all participants should understand is the idea of momentum. Momentum is simply defined as the speed at which the price of a security increases or decreases. There are many tools a trader can use to gauge momentum, but few are more popular than the MACD indicator. In this post, we’ll dig into the indicator, explaining what it is and how to trade with it using the TrendSpider platform!

What Is The MACD Indicator?

MACD stands for ‘Moving Average Convergence Divergence’, and the indicator consists of several components:

  1. The Signal Line: This line is a 9-period EMA of the MACD line
  2. The MACD Line: This line is created by subtracting the 26-period EMA from the 12-period EMA
  3. The Histogram: A series of vertical lines representing the distance between the ‘Signal line’ and the ‘MACD line’. Green bars above the ‘Zero line’ indicate positive momentum. Red bars below the ‘Zero line’ indicate negative momentum.
  4. The Zero Line: A horizontal line that separates the positive and negative territories of the histogram.

This is an image of the MACD indicator

As is visualized in the image above, the ‘Signal’ line and the ‘MACD’ line appear as moving averages that oscillate mostly in tandem with price action. When price is increasing, the MACD line is generally going to be positioned above the Signal line and the histogram will be green. The rate at which price increases is expressed via the length of the histogram bars. The faster price increases, the farther the MACD line will get from the Signal line, and therefore, the longer the green histogram bars will become.

The opposite is true when price is decreasing. When price is decreasing, the Signal line is generally going to be positioned above the MACD line and the histogram will be red. The faster price decreases, the farther the Signal line will get from the MACD line and, therefore, the longer the red histogram bars will become.

Reversals in price tend to appear near crossovers of the MACD and Signal lines. When the MACD line crosses up on the Signal line, that suggests bullish momentum. When the MACD line crosses down on the Signal line, that suggests bearish momentum. The more deviated the MACD and Signal lines become from the Zero line, the more likely a reversal is to occur.

Trading With The MACD Indicator

Now that we understand exactly how to read the MACD indicator, let’s walk through a few different ways that it can be used to make a trading decision.

Bullish and Bearish Divergence

The most common way to trade using the MACD indicator is to look for divergence. A MACD divergence can be either bullish or bearish and occurs when the momentum of the indicator contradicts the movement in price. This divergence can point to the potential for a reversal in trend. Examples of both bullish and bearish divergences can be seen in the chart pictured below.

This is an image of both positive and negative MACD divergence.

On the left side, we see an example of bearish divergence. This occurs when price makes higher highs while MACD makes lower highs. This action tends to lead to a reversal in price to the downside. On the right side of the chart, we see the opposite, a bullish divergence. A bullish divergence occurs when price makes a lower low while MACD makes a higher low and often will result in a reversal in price to the upside.

How do we trade these divergences? Some traders might utilize this divergence in tandem with chart patterns like rising and falling wedges. When price breaks out of the wedge and there is clear divergence, whether it’s to the upside or the downside, it can be a signal that the trend is reversing. Others might look for price crossing a shorter-term moving average to help strengthen the signal of the divergence.

Bullish and Bearish Crosses

Trading a MACD cross is very similar to trading a moving average cross. In a bullish scenario, traders will be looking for the MACD line to cross up on the Signal line. The histogram can be used as a reference point for assessing the validity of a MACD cross. A cross-up below the zero line after a period of volatility contraction can result in a powerful upside move like the one shown in the chart below.

This is an image of a MACD cross up and the move that precedes it.

The bearish scenario is equal and opposite of the bullish scenario. In the bearish case, a trader will be looking for the MACD crossing down on the Signal line. Again, when this cross occurs above the zero line after a period of reduced volatility, the move lower can be powerful.

This is an image of a MACD cross down and the move that precedes it.

So, how do we trade this setup? To answer that question, we’ll refer to a previous blog post that we wrote about moving averages, as it’s possible to trade a MACD cross in similar ways to how a moving average cross would be traded. One could simply buy the cross, if desired, but a potentially more sound entry could be to buy or sell the retest of the level upon which the cross occurred. Read more about that here.

Using MACD On The TrendSpider Platform

Knowing how to trade using the MACD indicator is one thing, but finding these setups is a whole different skill set! Whether you’re interested in being alerted, scanning, or back-testing various MACD conditions, this can all be done on the TrendSpider platform using our no-code scripting functionality. Simply create a script of the MACD conditions that you’re interested in and then utilize that script across the platform.

Scripting A MACD Cross

For example, if you’re interested in defining a MACD cross, this can be scripted as shown in the image below. Do note, these conditions do not define whether the cross is up or down, only that the MACD and Signal lines are crossing. If you’d like to specify a cross-up or down, you can do so using the ‘Crossed Up’ and ‘Crossed Down’ definers.

This is an image of a macd cross script.

If you’d like to utilize this script within your account, feel free to download it here!

Scripting MACD Divergence

In order to script a MACD divergence, you’ll need to define that price is increasing while MACD is decreasing, or vice versa. In the image below, both bullish and bearish scenarios are defined. The period between candles is arbitrary and can be adjusted at a trader’s discretion.

This is an image of a MACD divergence script

If you’d like to utilize this script within your account, it can be downloaded here!

Scripting MACD Histogram Increasing Above Zero or Decreasing Below Zero

In order to script MACD Histogram conditions, you’ll need to use the ‘MACD, Histogram’ option. In the example below, we’ve defined two sets of criteria. The first specifies that the histogram has been increasing above the zero line over the past three candles. The second group defines that the histogram has been decreasing below the zero line for the past three candles.

This is an image of a MACD histogram increase or decrease script.

If you’d like to try this script on your account, download it here!

At this time, it’s only possible to share scanners and watchlists on the TrendSpider platform, but if you’d like to use any of these scanners as alerts or strategies to backtest, simply click the ‘Script Actions’ button in the top right corner of the conditions and choose the ‘Save As Template’ option. From there, you’ll be able to load the newly saved template into all of the additional tools on the platform including the Strategy Tester, Multi-Factor Alerts, Trading Bots, and Smart Checklist. 

The Take Away

If you’re on the hunt for a tool to help you gauge momentum, few indicators will work better for you than the MACD indicator. As is true with all indicators, however, there is no silver bullet in trading. The MACD will provide as many actionable signals as it will false signals, so it’s important to consider using multiple indicators that track different functions of price action when hunting for the best trade opportunities.  If you’d like to see the indicator in use, feel free to give the below video a spin!

How To Use The MACD Indicator To Improve Your Trading