MACD (Moving Average Convergence Divergence) combines trend-following AND momentum in one indicator. Day 10 shows you how to use it like professionals.
MACD Components
MACD Line = 12 EMA − 26 EMA | Signal Line = 9 EMA of MACD | Histogram = MACD − Signal
Three components, all derived from closing prices:
- MACD Line: The faster moving average minus the slower one. Shows momentum direction
- Signal Line: A smoothed average of the MACD line. The "trigger"
- Histogram: Shows the gap between MACD and Signal. Growing bars = strengthening momentum
import pandas as pd
def compute_macd(df, fast=12, slow=26, signal=9):
ema_fast = df['Close'].ewm(span=fast, adjust=False).mean()
ema_slow = df['Close'].ewm(span=slow, adjust=False).mean()
df['macd'] = ema_fast - ema_slow
df['signal'] = df['macd'].ewm(span=signal, adjust=False).mean()
df['hist'] = df['macd'] - df['signal']
return df
Key MACD Signals
1. MACD Crossover
Bullish: MACD line crosses above Signal line → buy signal. Most effective when this happens below the zero line (oversold territory).
Bearish: MACD line crosses below Signal line → sell/exit signal. Most reliable when above the zero line.
2. Zero Line Cross
When MACD crosses above 0, the 12 EMA is above the 26 EMA — trend has turned bullish. This is a slower but more reliable trend confirmation signal.
3. MACD Divergence
Like RSI divergence — price makes new high but MACD histogram is declining = bearish divergence. One of the best topping signals in the market.
Best Used For
Trend following trades, confirming breakouts, identifying trend reversals on daily/weekly charts.
Avoid Using For
Range-bound, sideways markets. MACD generates excessive false signals in no-trend conditions.
Today's Strategy
On a daily chart: wait for MACD to cross below zero (pullback confirmed), then watch for bullish MACD crossover while price is above 200 DMA. This combination has a historically high win rate.