# How is the MACD positive in this example when the 12-day MA is below the 26-day MA?

I learned that the MACD for an asset will be negative when the 12-day moving average is below the 26-day moving average, so I was confused when I looked at the price of bitcoin a few months ago with the MACD.

The line with the histogram is the 0 level and according to my logic the MACD should go below this line when the blue line passes under the sea green line in the chart depicted in the top half of the screenshot.

Why is the MACD still above the zero line at this point?

• I think that if you created the MACD and its signal line in a spreadsheet then you would clearly see the mathematical relationship between the EMA12, EMA26 and the EMA9 signal line. You can google for the formulas. Commented Jun 13, 2021 at 0:18
• A pet peeve of mine (not just on this question) is that when we get price charts pasted on SE, they are often so aggressively cropped that we can't see labels of the lines/bars/axes. I don't understand why. It makes things harder to understand and interpret. Commented Jun 13, 2021 at 8:12
• It's a legitimate peeve because without the labels, it's hard to interpret and it's impossible to know if the charts were lined up properly. Commented Jun 13, 2021 at 16:17

tl;dr EMA versus SMA.

No one seems to have answered your actual question. The blue MACD line in the lower chart is the difference between the 12-day and 26-day exponential moving averages (EMAs) of price. So you rightly ask why this blue MACD line remains positive when you see the 12-day dipping below the 26-day in the upper chart. This is a sensible sanity check, regardless of how the MACD line is subsequently used (9-day EMA and histogram).

The answer is that the upper chart appears to show simple (not exponential) moving averages. A clear indication of this is that the 26-day is seen rising while above price, which EMAs never do (they rise while below price and fall while above price). If you adjust the upper chart to show EMAs, then the difference should be consistent with the MACD line.

• This is what I noticed when I went back to trading view and noticed that the MACD indicator defaulted to EMA's and that you have to toggle SMA's. Upon doing that everything made sense Commented Jun 15, 2021 at 1:05

You are mixing up the moving average lines for the price with the MACD signal periods.

The price chart above shows two moving average lines based on the price movement.

Whilst the MACD Line is the 12-period EMA minus 26-period EMA. The signal line is then the 9-period EMA of the MACD Line. And the MACD Histogram goes into negative territory when the MACD line crosses below the Signal Line. The MACD Histogram goes into positive territory when the MACD line crosses above the Signal Line.

So the MACD Line is based on the 12-period and 26-period moving averages of the price but it is not the same as the 12-period and 26-period moving averages of the price.

As the MACD is a momentum indicator, a buy signal arises whenever the MACD line crosses above the Signal Line due to that being the point went the trading momentum changes from bearish to bullish (so momentum is increasing on the buy-side).

Similarly, a sell signal arises whenever the MACD line crosses below the Signal Line due to that being the point went the trading momentum changes from bullish to bearish (so momentum is increasing on the sell-side).

• I thought the 12-period signal line and the 26-period signal line you're talking about are actually the 9-period signal line and the 26-period line subtracted from the 12-period signal line (MACD)? Commented Jun 10, 2021 at 7:29
• @Bradley - my answer has been corrected. Commented Jun 10, 2021 at 8:21
• The signal line has the longest moving average so technically, the MACD Histogram goes into negative territory when the MACD Line crosses the signal line. Commented Jun 10, 2021 at 15:04
• @Victor thank you, and if you feel like it could you explain why a buy signal is produced whenever the MACD crosses the 9-period MA? Commented Jun 11, 2021 at 3:04
• @Bradley - done, I have added more to my answer explaining the buy and sell signals. Commented Jun 12, 2021 at 5:10

The MACD is the difference between the 12-period EMA and the 26-period EMA. Since shorter term moving averages are more responsive to price, EMA-12 is more volatile. When it crosses above the EMA-26, MACD goes positive. When it crosses below the EMA-26, the MACD goes negative. When they are equal, the MACD is zero.

The histogram is calculated by subtracting the 9-period EMA of the MACD from the MACD. It follows the same concept as above. When the MACD is greater than MACD-9 then the histogram is positive, etc.