MACD measures the difference between two Exponential Moving Averages (EMAs). A positive MACD indicates that the 12-day EMA is trading above the 26-day EMA. On the other hand, a negative MACD indicates that the 12-day EMA is trading below the 26-day EMA. Basically, when the MACD is above the 0 line, it is indicating that the momentum is bullish. When the MACD is negative however, it is indicating that the momentum is bearish.

When the 12 days moving average crosses the 26 day moving average, you should watch the next price movements very carefully as it tends to signal a trend reversal. If the 12 days MA crosses above the 26 days MA, it’s a bullish signal. On the flip side, if the 12 days MA crosses below the 26 das MA, it’s a bearish signal.

This is a good indicator to watch while markets are moving like they are now.

declare lower;

input fastLength = 12;

input slowLength = 26;

input MACDLength = 9;

def fastAvg = sum(data = (close * volume), length = fastLength)/sum(data = volume, length = fastLength);

def slowAvg = sum(data = (close * volume), length = slowLength)/sum(data = volume, length = slowLength);

plot Value = fastAvg - slowAvg;

plot Avg = ExpAverage(data = Value, length = MACDLength);

plot baseline = 0;

plot diff = value - avg;

diff.AssignValueColor (if diff >= 0 then Color.UPTICK else Color.DOWNTICK);

diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

diff.SetDefaultColor(GetColor(8));

Avg.SetDefaultColor(GetColor(5));

Value.SetDefaultColor(GetColor(1));

baseline.SetDefaultColor(GetColor(0));

*(can also be found in default studies)*