Active Trading Blog

A Comprehensive Guide to the MACD Indicator

What Is MACD

The moving average convergence divergence (MACD) was developed in the 1960s by Gerald Appel and has since become one of the most commonly used indicators thanks to its simple application and interpretation. The MACD compares the differences in two moving averages of a stock price to indicate buy and sell signals via crossover of a median line. The MACD is both a trend following indicator as well as an indicator of short-term momentum.

Type of Indicator

The MACD combines two trend following indicators – two moving averages – such that it is both a trend following indicator in itself as well as an indicator of short-term price momentum.

macd indicators

MACD Calculation

The MACD line is calculated by simply subtracting the 26-day exponential moving average of a stock’s price from the 12-day exponential moving average. Typically, the MACD line is plotted as a line on a chart so that it is easy to visualize whether the MACD is positive or negative – that is, above or below the centerline.

macd centerline

In addition, the 9-day exponential moving average of the MACD itself – known as the signal line – is frequently plotted on the same chart. The chart usually features a histogram as well, which represents the difference between the MACD and the signal line.

signal line

To summarize:

MACD Line = 12-day EMA – 26-day EMA

Signal Line = 9-day EMA of MACD Line

(+) MACD when MACD Line > 0

(-) MACD when MACD Line < 0

Histogram plot: MACD – Signal Line

While these are the standard lengths and types of moving averages used in calculation of the MACD, it is entirely possible to substitute in longer- or shorter-term moving averages or to use a simple or weighted moving average rather than an exponential moving average. However, note that doing so may change the interpretation of the MACD with respect to short-term momentum.

How to Trade with MACD

The MACD is relatively straightforward to interpret. When the MACD is positive, it indicates that a stock’s price is trending upwards and it has or is gaining short-term momentum. When the MACD is negative, the price is trending downwards and it is gaining short-term momentum in the negative direction.

When the 12-day and 26-day exponential moving averages converge on a single price, signaling a lack of momentum in either price direction, the MACD line will approach zero and sit close to the centerline of the chart. The further the MACD line is in either direction above or below the signal line – that is, the more divergent the two exponential moving averages – the more short-term momentum the stock price should be considered to have.

With this in mind, the MACD can be used as an indicator for momentum trading. If there is strong divergence between the two exponential moving averages, the stock price has momentum that will take some time to wear off. An inflection in the slope of the MACD can also indicate when that wearing off begins, signaling that it might be time to exit a position. Although the MACD chart does not have upper or lower limits, it is relatively easy and informative to look back at historical MACD data for a particular equity to get an idea of what a highly positive or negative MACD is for that equity.

Signal Line Crossover

When the MACD line crosses above or below the signal line, known as a crossover, the histogram on the chart will also shift from negative to positive or vice versa. This is a common signal of the MACD and indicates that the MACD – and thus a stock’s price momentum – is shifting, since the signal line should lag behind changes in the MACD line. Crossovers can last a few days or a few weeks and should be traded on cautiously, especially if the stock in question features a lot of price volatility. However, crossovers can be a more rigorous way to identify weakening or strengthening momentum than simply looking for inflection points in the MACD line.

signal line crossover

Centerline Crossover

A crossover of the centerline can be analyzed similarly, but without the consideration of short-term momentum provided by the lagging signal line. The MACD crossing from negative to positive territory indicates that a stock’s price is gaining momentum in the upward direction, while the opposite crossover indicates that the price is gaining downside momentum.

centerline crossover

Divergence

Divergence between the stock price and the MACD can also be informative as a way to determine whether momentum is wearing off or building. For example, consider a stock with a falling price and an MACD that is growing more negative, indicating downside momentum. The stock price may continue to push lower while the MACD line inflects and begins to push upwards towards zero, thus indicating that the downside momentum is decreasing even though the stock price has not yet exhibited positive gains. The same divergence indication can be applied to a stock that is gaining in price but losing upside momentum.

divergence macd

However, it is important again to interpret divergences cautiously since many price movements, both gains and losses, involve a large initial price action followed by a long tail. While this would cause a divergence when looking at MACD, the price action will continue in its current direction until the MACD line gets much closer to zero.

Indicator Comparison

The MACD is most related to, and often used in conjunction with, the parabolic stop and reverse (PSAR) indicator. However, whereas the MACD relies on exponential moving averages to indicate short-term momentum, the PSAR uses a multiplicative factor to visually indicate when a price trend is about to flip. Swing traders often use the MACD and PSAR together to identify stocks that are experiencing changes in price momentum.

macd with psar

Examples

In this first example, numerous signal line crossovers in the MACD correspond with significant upswings and downswings in the stock price. These crossovers can be used as entrance and exit points for swing trades.

macd example one

Another example shows divergence between the MACD line and the stock price. In this case, the divergence indicates weakening momentum in the price rise of the stock, even as it continues to gain in value. This divergence is ultimately followed by a significant downtrend several weeks later.

macd example two

Conclusion

The MACD can be a powerful momentum indicator for making swing trades. The indicator can allow day traders to identify entry and exit points based on a longer-term MACD crossing over a shorter-term MACD, or it can be used to predict changes in price trends of stocks before the price itself reacts.

More Great Content

Creating Stock Scanners with Stochastics

Creating Stock Scanners with Stochastics

The stochastics indicator was first developed in the 1950s, but it’s as popular among traders now as ever before. This indicator compares the closing price of a stock to its price range over a set period to determine whether it is overbought or oversold. Whereas many...

Creating a VWAP Scanner

Creating a VWAP Scanner

The volume-weighted average price (VWAP) is an indicator that is frequently used by day traders. By taking trading volume into account throughout the trading day, VWAP is able to inform potential buying and selling levels. VWAP can be used on its own or as part of a...

Creating a Bollinger Bands Scan

Creating a Bollinger Bands Scan

Bollinger Bands are a widely used technical indicator that can help identify trends and serve as an indicator of volatility. There are a number of trading strategies that use Bollinger Bands to identify entry and exit points, either as the primary trigger or as a...

Creating Fundamental Stock Screeners

Creating Fundamental Stock Screeners

Screening stocks based on fundamental metrics can be a good way to improve the quality of your scans and complement an existing technical trading strategy. With fundamentals, traders look not just at how a company’s stock is performing, but also how the company itself...

Creating a NASDAQ Stock Screener

Creating a NASDAQ Stock Screener

The NASDAQ is home to some of the most important growth stocks in the market today. So, it makes sense that you might want to focus your trading efforts specifically on this exchange. With Scanz, you can target your screens to search only for stocks on a specific...

Creating an ETF Scanner

Creating an ETF Scanner

Exchange-traded funds (ETFs) are extremely popular assets that enable traders to gain exposure to an entire asset class or market sector in one trade. ETFs reduce your risk relative to trading a single company’s stock, but they do so largely without taking away from...