The MACD Indicator

The Moving Average Convergence Divergence (MACD) is a trend-following momentum indicator that shows the relationship between two moving averages of a security’s price.

The MACD is calculated by subtracting the 26-period Exponential Moving Average (EMA) from the 12-period EMA. The result of this calculation is the MACD line. A nine-day EMA of the MACD called the “signal line,” is then plotted on top of the MACD line, which can function as a trigger for buy and sell signals.

A histogram is usually also plotted along with the MACD and signal lines, the histogram represents the difference between the MACD and the signal line. Traders may buy the security when the MACD crosses above its signal line and sell, or short, the security when the MACD crosses below the signal line. The cross of signal line and MACD is also represented by the histogram crossing above and below the zero level.

The Chart View

See the following chart for a visual orientation.

Extra Indicators

  • ZigZag Line
    • The ZigZag line is plotted over the chart in order to highlight the peaks and valleys. One of the parameters to the ZigZag line is the granularity which determines how far a stock must move in order for a new peak or valley to be detected. Higher numbers mean the ZigZag is detecting larger variations in price. Smaller numbers can be used to highlight more fine-grained variations.
  • Lower Low (Price)
    • Calls out the close price of the stock was lower than the previous low picked out by the ZigZag line
  • Higher Low (MACD)
    • Calls out the MACD was higher than at the last valley in price.

How the MACD can be used for trading

The nuances of the MACD pattern include the following aspects:

  1. Convergence and Divergence: The namesake of the MACD revolves around the convergence and divergence of its moving averages. Convergence occurs when the moving averages move towards each other, suggesting a weakening of the current trend. Divergence occurs when the moving averages move away from each other, which indicates that the current trend is strengthening.
  2. Signal Line Crossovers: The most common MACD signals are when the MACD line crosses above or below the signal line. Crosses above the signal line signal bullish conditions and might indicate a good time to buy, while crosses below signal bearish conditions, suggesting a potential sell-off.
  3. Zero Crosses: The MACD’s movement around the zero line also provides insight into market momentum. When the MACD crosses above the zero line, it indicates bullish momentum, suggesting it might be a good time to buy. Conversely, a move below the zero line indicates bearish momentum, possibly a good time to sell.
  4. Histogram: The MACD histogram measures the distance between the MACD line and its signal line. The histogram is positive when the MACD line is above the signal line (bullish) and negative when the MACD line is below the signal line (bearish). The histogram increases in positive value as the MACD line diverges further above the signal line, indicating increasing bullish momentum. Conversely, the histogram becomes more negative as the MACD line diverges below the signal line, indicating increasing bearish momentum. A shrinking histogram suggests a weakening trend or a potential reversal.
  5. Overbought/Oversold Conditions: While the MACD does not have traditional overbought or oversold levels, traders can look for the MACD and signal lines to stretch far away from the zero line to identify potentially overextended market conditions.
  6. Divergences between MACD and Price: A significant nuance in using MACD is spotting divergences between the MACD indicator and price action. A bullish divergence occurs when the price records a lower low, but the MACD forms a higher low, suggesting a potential reversal in downtrend. Conversely, a bearish divergence occurs when the price hits a higher high, but the MACD forms a lower high, indicating a possible reversal in an uptrend.

Understanding these nuances can help traders better interpret the signals provided by the MACD and make more informed trading decisions based on momentum and trend strength. However, it’s also crucial to use the MACD in conjunction with other indicators and analysis methods to confirm trends and signals due to the possibility of false signals.

Scanning For MACD patterns

The best scanners for all the above conditions are the EdgeRater PRO MACD templates.

There are 4 templates:

  • MACD Daily Bullish Divergence
  • MACD Weekly Bullish Divergence
  • MACD Daily Bearish Divergence
  • MACD Weekly Bearish Divergence

Daily templates look for divergences on the daily timeframe, Weekly on the weekly timeframe. Bullish Divergence templates look for bullish divergences between MACD and price while Bearish Divergence templates look for bearish divergences between MACD and Price.

Together, these templates represent the most comprehensive MACD scanning capabilities available.

The Template Output

Price and MACD Divergence Detection

To detect divergences between MACD and Price, 4 separate ZigZag granularities are used:

  • Extra Large (9%)
  • Large (7%)
  • Medium (5%)
  • Small (2%)

And they are reported together in the following format:

Each level of granularity has 4 columns:

  • Div Contains a ‘Yes’ if a there is a divergence in price and MACD between the last two troughs (or peaks for bearish divergences).
  • Since Shows the number of bars since the divergence was detected. Green highlight if less than 10.
  • P Shows the price % difference between the last two troughs (or peaks for bearish divergences)
  • M Shows the MACD difference between the last two troughs (or peaks for bullish divergences)

Example MACD Divergences

MACD Indicator Status

The following columns detail the interesting conditions of the MACD and Histogram.

  • MACD Val and % contain the value of the MACD and what that value is as a percentage of price
  • MACD vs Zero: Pos contains the Position ‘Above’ or ‘Below’ of the MACD vs the zero line.
  • MACD vs Zero: #Bars contains the number of bars since the condition occurred (eg. MACD crossed below zero 10 bars ago).
  • Histogram Val and % contain the value of the Histogram and what that value is as a % of price
  • Histogram vs Zero: Pos Contains the Position ‘Above’ or ‘Below’ of the Histogram vs the zero line
  • Histogram vs Zero: #Bars contains the number of bars since the condition occurred (eg. Histogram crossed above zero 5 bars ago).

Note that one of the conditions to look for with MACD is the MACD line crossing the signal line. This is detected here by the Histogram crossing zero 1 bar ago.

Everything in one place

The reports contain all the useful MACD indications and conditions on one worksheet. You can sort and filter the report using the headings. Single click the heading cell to sort, click again to reverse sort. Use the drop-down to filter by value.


The MACD indicator is a multi-faceted indicator, allowing the trader to detect stock momentum, continuation and potential reversals. EdgeRater has developed a comprehensive set of templates to allow the trader to identify all of these conditions.

You can try out this template with the free trial of EdgeRater PRO.

Make sure you are signed up for our free email newsletter to receive more useful tips on trade simulation and advanced scanning. We run regular free webinars too, if you are on the email newsletter list you will be notified and invited to attend.

Please also remember to Subscribe to our YouTube channel, where you will find a wealth of information on stock market analysis, scanning and backtesting