The Moving Average Convergence/Divergence (MACD) is one of the most powerful and widely used technical indicators in trading. Understanding its formula can greatly enhance its application. While the calculation might seem complex at first glance, it’s actually quite straightforward and consists of three key components.
In this article, we’ll break down the MACD formula and guide you through each step in the simplest way possible.
MACD Formula Components
Before we dive into the formula, it’s important to note that the MACD indicator consists of three major components. Using the popular charting platform – TradingView, as an example, these components are:
- MACD DIF Line – Primary line of MACD (Blue Line)
- MACD Signal Line – Smoothing line of MACD DIF (Orange Line)
- MACD Histogram – Visual representation of difference between DIF and Signal Line
In the following sections, we will break down the formulas for the MACD line, the Signal Line, and the Histogram step by step, to help understand the meaning behind the MACD indicator.
MACD Line Formula
The MACD line, also known as the MACD DIF line, is the first component of the indicator and the first part to be calculated. The term “DIF” stands for “Differential” Line, which reflects its purpose: calculating the difference between the short-term and long-term exponential moving averages. The formula is as below:
The short-term EMA is known as the “fast line”, while the long-term EMA is known as the “slow line”. The DIF line can be actually used as an independent indicator, it represents the following meanings:
- When the DIF line value is positive, it indicates that the short-term average price is above the long-term average price, signaling a upside momentum in the market trend.
- When the DIF line value is negative, it indicates that the short-term average price is below the long-term average price, signaling a downside momentum in market trend.
In fact, the DIF line already captures the core principle of the MACD indicator by reflecting market trends and momentum through the comparison of short-term and long-term average prices. This is why, in some charting software, only the DIF line is displayed without the signal line.
MACD Signal Line Formula
The Signal Line is the next component of the MACD indicator, also known as the MACD DEA line, which stands for “Difference of Exponential Moving Average.” This line serves to smooth the MACD DIF line.
The Signal Line is derived from the exponential moving average of the DIF value, smoothing out fluctuations and filtering out short-term market noise. However, this smoothing also means that the Signal Line reacts more slowly to real-time price changes compared to the MACD DIF line.
You can think of the MACD line as a short-term moving average and the Signal Line as a long-term moving average. Their relationship is similar to that between short-term and long-term moving averages:
- When the MACD line is above the Signal Line, it indicates that the short-term average price is higher than the long-term average price, suggesting an upward market trend.
- When the MACD line is below the Signal Line, it indicates that the short-term average price is lower than the long-term average price, suggesting a downward market trend.
The Signal Line is considered a valuable tool in trading, especially when applying the 「MACD Crossover」 strategy. It plays a crucial role in generating buy or sell signals, which is why the 2-line MACD indicator, featuring both the DIF line and the Signal Line, is more widely used by most traders.
MACD Histogram Formula
The MACD histogram is the last component of the MACD indicator. Its calculation is relatively straightforward:
When the value is positive or larger, it means the short-term average price exceeds the long-term average price, indicating stronger upward market momentum. When the value is negative or smaller, it means the short-term average price is below the long-term average price, indicating stronger downward market momentum.
Simply put, the MACD histogram visually represents the difference between the MACD DIF Line and the Signal Line. While the relative position between the MACD line and the Signal Line indicates changes in their difference, the MACD histogram quantifies and visualizes this difference, allowing traders to measure the strength of the market trend’s momentum.
- When the MACD histogram is positive, rising bars indicate that upward market momentum is strengthening, while falling bars suggest that upward momentum is weakening.
- When the MACD histogram is negative, rising bars indicate that downward market momentum is strengthening, while falling bars suggest that downward momentum is weakening.
MACD Value and Reading
1). MACD Value
After understanding the MACD formula and its calculation, the next step is to grasp the significance of the MACD indicator’s value. The values of the three MACD components are essentially derived from the DIF Line (MACD Line) formula. This means the value range displayed in the MACD indicator window will match the range of the DIF Line.
The formula highlights the following key points:
- The MACD indicator has no fixed value range, unlike RSI or Stochastic indicators, because it is calculated based on the price of financial instruments, and prices can vary across different assets.
- The MACD indicator oscillates around the zero line, as the short-term moving average can only be greater than, equal to, or less than the long-term moving average. When both averages are equal, the indicator value will be zero.
2). MACD Value Reading
As the frequently asked question, do the positive or negative values of the MACD indicator carry significance?
The DIF formula helps clarify this: when the MACD is at zero, it indicates that the short-term average price equals the long-term average price, signaling market indecision between bullish and bearish conditions (consolidation).
- When the MACD value is positive, the short-term average price is higher than the long-term average, indicating an upward market trend.
- When the MACD value is negative, the short-term average price is lower than the long-term average, indicating a downward market trend.
Summary on MACD Formula
The MACD formula is actually straightforward and easy to grasp when broken down step by step:
The MACD indicator fluctuates above and below the zero line, reflecting market trends. Since it’s based on the price of financial instruments, which can vary significantly, the MACD has no fixed range.
- When the MACD is above the zero line, it signals a rising market, with the histogram’s size and trend showing the strength of upward momentum.
- When the MACD is below the zero line, it signals a falling market, and the histogram reflects the strength of downward momentum.
The MACD formula involves three key parameters: the short-term EMA, the long-term EMA, and the signal line’s smoothing parameter.