In this article we will focus on the accurate setting of the popular MACD indicator / oscillator.
To calculate the linear MACD we subtract the shorter period and faster exponential moving average from the longer period and slower exponential moving average.
In most cases, the result is smoothed by the exponential moving average (EMA) in order to rectify random fluctuations.
- MACD = ЕМАs(P) – EMAl(P)
- Signal = EМАa(ЕМАs(P) – EMAl(P)) — a signal line.
- Histogram of the difference = (1) – (2) — vertical lines on the indicator
EMAs(P) — a longer period exponential moving average.
ЕМАl(P) — a shorter period exponential moving average.
EМАa(P) — a shorter period smoothing moving average of the difference between the two EMAs
P — usually a closing price, but other variants are also possible (Open, High, Low, Close, Median Price, Typical Price и т. д.)
By default, the following MACD settings are used on the daily chart:
- EMAs – (short) a 12 day EMA of closing prices (two weeks).
- EMAI – (long) a 26 day EMA of closing prices (month).
- EMAa – (smoothing average) a 9 day EMA.
The indicator is a histogram which values do not depend on the specific values of the moving averages, but show the relative difference between them. Therefore, the indicator (or rather, its histogram) fluctuates in relation to its zero axis. It has positive values when the asset grows and has negative ones when it falls.
At the same time, the MACD consists of trend-following indicators (i.e. moving averages). That’s why it incorporates aspects of both a trend indicator and an oscillator.
The MACD is a blend of trend and momentum indicator and it can give large amount of information about the trend in the market. At the same time, it is capable of determining the trend’s reversal points, as well as of working within the existing trend.
Nevertheless, like most indicators, it is extremely dangerous to use its signals without additional analysis. The MACD is perfect for creating trading algorithms, but we don’t recommend that you rely entirely on its signals.