## How MACD works

The MACD indicator is generated by subtracting two exponential moving averages (EMAs) to create the main line (MACD line), which is then used to calculate another MPE representing the signal line.

In addition, there is the MACD histogram, which is calculated based on the differences between these two lines. The histogram, together with the other two lines, floats above and below a central line, which is also known as the zero line.

**Therefore, the MACD indicator consists of three elements which move around the zero line:**

**The MACD line:** helps to determine the upward or downward thrust (market trend). It is calculated by subtracting two exponential moving averages (EMA).

**The signal line:** is an EMA of the MACD line (usually 9 period EMA). The combined analysis of the signal line with the MACD line can be useful to detect possible reversals or input and output points.

**Histogram:** is a graphical representation of the divergence and convergence of the MACD line and the signal line. In other words, the histogram is the difference between the two lines.

### How the MACD Indicator Works

In general, exponential moving averages are measured according to the closing prices of an asset, and the periods used to calculate the two EMA are generally defined by 12 periods (faster) and 26 periods (slower). The period can be configured in different ways: minutes, hours, days, weeks or months.

Assuming the default time intervals, the MACD line itself is calculated by subtracting the 26-day EMA (exponential moving average) from the 12-day EMA.

MACD line = 12d EMA – 26d EMA

As mentioned, the MACD line oscillates above and below the zero line, and this is what signals the so-called crossovers of the center line, showing traders when 12 and 26-day EMAs are changing their relative position.