Indicators

What MACD Is and How to Use This Indicator in Practice

The MACD, short for Moving Average Convergence Divergence, is a trend and momentum indicator built from exponential moving averages. It helps visualize when short-term movement is gaining or losing strength relative to a slightly longer-term move.

How the MACD is calculated

The indicator has three parts. The MACD line is the difference between two exponential moving averages, usually 12 and 26 periods:

MACD line = EMA(12) − EMA(26)

The signal line is a 9-period exponential moving average calculated on the MACD line itself:

Signal line = EMA(9) of the MACD line

The histogram shows the difference between the two lines:

Histogram = MACD line − Signal line

A simplified numerical example

Suppose that, at a given moment, a stock's 12-period exponential moving average is at R$ 25.40 and its 26-period exponential moving average is at R$ 24.80. The MACD line sits at:

MACD line = R$ 25.40 − R$ 24.80 = 0.60

If the signal line, calculated on the MACD line's recent values, is at 0.45, the histogram sits at:

Histogram = 0.60 − 0.45 = 0.15

A positive, growing histogram, like in this example, indicates the MACD line is moving away from the signal line upward, which is usually read as reinforcing short-term bullish momentum.

Crossover between the lines

When the MACD line crosses above the signal line, it's usually interpreted as a signal of possible short-term buying strength. When it crosses below, the reading is usually the opposite. These crossovers tend to be more reliable when they occur aligned with the chart's bigger trend, and less reliable when the market is moving sideways, a situation where the MACD can generate several false crossovers in a row.

The zero-line crossover

Besides the crossover between the two lines, it's also worth watching when the MACD line itself crosses above or below zero. This happens when the 12-period average moves past the 26-period one, or vice versa, signaling a broader shift in the relationship between the two averages, usually associated with a somewhat longer-term trend change than a simple crossover between the MACD line and the signal line.

Divergence in the MACD

Just like the RSI, the MACD can also form a divergence with the price. If the price makes a new high, but the MACD histogram forms a lower peak than the previous one, that suggests the upward move is losing strength, even if the price hasn't reversed yet. The opposite applies to a bearish divergence. Divergence is a warning sign about the move's strength, not an exact prediction of when the reversal will happen.

Common mistakes when trading with MACD

  • Entering every trade just because of a crossover, without considering the bigger chart's trend.
  • Ignoring that the MACD is a lagging indicator, built on moving averages, which means it confirms moves after part of the move has already happened.
  • Using only the MACD, without cross-referencing the reading with support, resistance, or volume.
  • Changing the default 12, 26, and 9 parameters without first testing whether the change actually improves results on the traded asset and timeframe.

MACD in a trending market versus a sideways market

The MACD usually delivers its best signals in markets that are already in a defined trend, because in that scenario the crossovers tend to track longer-lasting moves. In a sideways market, with no clear direction, the two moving averages that form the indicator keep crossing frequently, generating a series of signals that cancel out quickly and can cause losses for those trying to trade every crossover as if it were a new trend starting. Because of that, before trusting a MACD signal, it's worth checking whether the bigger chart really shows a trend underway or whether the asset is just oscillating within a range.

How to fit the MACD into a more complete analysis

The MACD works best as a momentum confirmation within an analysis that already considers the bigger trend and relevant price levels, rather than as the sole entry trigger. Testing the indicator's behavior on the specific asset's history before trusting it in real trades helps you understand under which market conditions it usually works best and under which it usually generates more false signals.

Practice before you risk. Open your Astron account and test your ideas on the demo account with R$ 10,000 in virtual funds.

Create free account