# Moving Average Convergence Divergence (MACD) and Histogram (MACDH) (v16)

MACD is the difference between two moving averages. The moving averages are traditionally exponential with the longer moving average subtracted from the shorter moving average. Another moving average is usually applied to the raw MACD to use as a signal line or trigger.

## The basic format of the raw MACD is XAVGCs - XAVGl where s is the short and l is the long moving average.

So an Indicator Formula for an exponential MACD 12,26 can be written as follows.

XAVGC12 - XAVGC26

And an Indicator Formula for a simple MACD 5,35 can be written as follows.

AVGC5 - AVGC35

## The signal line or trigger of the MACD is a moving average applied to the raw MACD.

The Personal Criteria Formula Language does not allow us to write the x period exponential moving average of XAVGCs - XAVGCl as XAVG(XAVGCs - XAVGCl,x) but this ends up being the same as XAVG(XAVGCs,x) - XAVG(XAVGCl,x).

So an Indicator Formula for an exponential MACD 12,26,9 signal line or trigger can be written as follows.

XAVG(XAVGC12,9) - XAVG(XAVGC26,9)

And an Indicator Formula for a simple MACD 5,35,10 signal line or trigger can be written as follows.

AVG(AVGC5,10) - AVG(AVGC35,10)

## The MACD Histogram is the raw MACD minus its signal line or trigger.

So an Indicator Formula for an exponential MACD 12,26,9 Histogram can be written as follows.

XAVGC12 - XAVGC26 - XAVG(XAVGC12,9) + XAVG(XAVGC26,9)

And an Indicator Formula for a simple MACD 5,35,10 can be written as follows.

AVGC5 - AVGC35 - AVG(AVGC5,10) + AVG(AVGC35,10)