# Moving Average Convergence-Divergence

Contents[Hide]

The Moving Average Convergence-Divergence (MACD) function was developed by Gerald Appel. It computes the difference between a short-term and a long-term exponential moving average of the stock price. Applications of MACD include generation of buy and sell signals. Signals are generated when the MACD line crosses the zero line or its signal line.

## 1. Syntax

Moving Average Convergence-Divergence:

```MOVAVGCD(d0,s0,s1,s2,Alignment)
```

Signal Line:

```MOVAVGCDSIG(d0,s0,s1,s2,Alignment)
```

Histogram:

```MOVAVGCDHIST(d0,s0,s1,s2,Alignment)
```

## 2. Input

The Moving Average Convergence-Divergence functions require the following input series:

• d0 - Input data values - The set of data values for which the MACD is calculated, usually the daily close price of a stock.

## 3. Parameters

The Moving Average Convergence-Divergence function has the following parameters:

• s0 - Long Period - The larger number of time periods to use in the calculation of MACD. Default value is 26.
• s1 - Short Period - The smaller number of time periods to use in the calculation of MACD. Default value is 12.
• s2 - Signal Period - The number of time periods to use in the calculation of the Signal Line. Default value is 9.
• Alignment (Optional) – Hierarchy placeholder to be used as the alignment axis.

## 4. Output

The MOVAVGCD function generates the following output:

• Moving Average Convergence-Divergence - The MACD result set.

The MOVAVGCDSIG function generates the following output:

• Signal Line - This is the result of smoothing out the MACD line via the application of an exponential moving average. The Signal Line can help to identify turns in the MACD line.

The MOVAVGCDHIST function generates the following output:

• Histogram - The Histogram is computed as the difference between the MACD line and the Signal Line. This makes it easy to see when the two lines converge or diverge.