ArchitectureStrategiesResearchWhy UsPricing
Trend & Momentum Indicator Momentum Indicators

MACD: Moving Average Convergence/Divergence

Trend-following momentum oscillator displaying the relationship between two exponential moving averages.

Visual Rule Syntax: @MACD(close, 12, 26, 9) > 0

Key Takeaways

  • Combines trend direction and momentum acceleration into a single visual signal.
  • Histogram zero-line crossovers signal shifts in market acceleration.
  • Most reliable when aligned with higher-timeframe trend direction.

What It Means in Simple Terms

MACD tracks the gap between short-term market momentum and medium-term trend direction. Think of it like a rubber band stretched between a runner (fast 12-day EMA) and a walker (slow 26-day EMA). When the runner accelerates ahead, the rubber band stretches (MACD rises). When the runner slows down or reverses, the rubber band snaps back toward zero.

How It Helps You as an Investor

It gives you early warning signs of trend exhaustion before the moving average itself turns. The MACD histogram shows whether price velocity is accelerating or decelerating, helping you join fresh breakouts and avoid late entries.

Visual Node Rule Syntax & How to Plug in Values

Visual Node Expression No Code Required
@MACD(close, 12, 26, 9) > 0

Parameter Tuning & Market Calibration

The classic setting is 12, 26, 9 (Fast EMA = 12, Slow EMA = 26, Signal EMA = 9). For faster swing trading on volatile stocks, traders sometimes test 8, 17, 9. When plugging into Saral, `@MACD(close, 12, 26, 9) > 0` requires that the fast momentum line is above the slow line, confirming bullish acceleration.

Input Fields & Parameters

Field / Parameter Type Default Role & Description
close field Required Historical input price or volume series from market feed.
fastperiod int 12 Lookback period or tuning parameter for market calibration.
slowperiod int 26 Lookback period or tuning parameter for market calibration.
signalperiod int 9 Lookback period or tuning parameter for market calibration.

Mathematical Formulation

The mathematical definition of MACD (Moving Average Convergence/Divergence) as evaluated within the Saral Engine execution pipeline:

MACD Line=EMA12(P)−EMA26(P),Signal Line=EMA9(MACD),Histogram=MACD−Signal\text{MACD Line} = EMA_{12}(P) - EMA_{26}(P), \quad \text{Signal Line} = EMA_9(\text{MACD}), \quad \text{Histogram} = \text{MACD} - \text{Signal}

Variable & Parameter Definitions

Calculates the spread between a fast 12-period EMA and a slow 26-period EMA. A 9-period EMA of this spread forms the signal line, and the difference between the two forms the histogram.

Systematic Strategy Applications

Bullish Acceleration Entry Entry Rule
@MACD(close, 12, 26, 9) > 0 and close > @SMA(close, 50)

Enter long when MACD confirms positive acceleration with price trading above the 50-day average.

Common Questions & Practical Considerations

What is the difference between MACD and Percentage Price Oscillator (PPO)?

MACD is measured in absolute rupees, meaning an expensive stock like MRF (₹1,30,000) will have huge MACD numbers while a ₹100 stock will have tiny numbers. PPO converts this into a percentage, making cross-stock screening fairer.

Why do MACD crossovers fail during sideways consolidation?

When prices move horizontally in a tight range, the 12 and 26 EMAs intertwine, causing the lines to cross back and forth repeatedly. You can filter out these whipsaws by requiring ADX > 25.