Moving average convergence divergence, or MACD, is one of the most popular tools or momentum indicators used in technical analysis. This was developed by Gerald Appel towards the end of 1970s. This indicator is used to understand the momentum and its directional strength by calculating the difference between two time period intervals, which are a collection of historical time series. In MACD, ‘moving averages’ of two separate time intervals are used (most often done on historical closing prices of a security), and a momentum oscillator line is arrived at by taking the difference of the two moving averages, which is also denoted as ‘divergence’. The simple rule for taking the two moving average is that one should be of shorter time period and the other longer time period. Generally, exponential moving averages (EMA) are considered for this purpose.

The main points for an MACD indicator are:

a) Time period or interval – which the user can define. Commonly used time periods are:

Short-term intervals – 3, 5, 7, 9, 11, 12, 14, 15-day intervals, but 9-day and 12-day durations are more popular

Long-term intervals – 21, 26, 30, 45, 50, 90, 200-day intervals; 26-day & 50-day intervals are more popular

b) Momentum oscillator line or divergence or MACD line – which can be simple plotting of ‘divergence’ or difference between two interval moving averages

c) Signal Line – which is exponential moving average of divergence data e.g. 9-day EMA

d) Normally a combination of 12-day and 26-day EMA of prices and 9-day EMA of divergence data is used, but these values can be changed depending on the trading goal and factors

e) The above data is then plotted on a chart, where the X- axis is for time and Y-axis is price, to get MACD line, signal line and histogram for the difference between the MACD and signal line, which is shown below the X-axis

Example:

Take the 12-day and 26-day exponential moving averages of closing prices of a security. To calculate the exponential moving average of closing prices, you need to take the weighted calculation of simple moving averages, where the weighing multiplier needs to be calculated. For calculation, refer to the exponential moving average concept. Then both the EMA data difference will be taken and used to draw an MACD line for the said duration and plotted as a line graph. This area is below the time axis and is divided by the 0 axis or called as centreline to show negative and positive. Then nine-day EMA will be calculated for MACD data in the same manner as above, which is called the ‘signal line’. Then a bar graph or histogram is drawn in the same area where the bar length shows movement variation in the MACD line and the signal line at single point. 

The MACD and signal line move above and below the zero axis or centreline to signal a trend such as overbought and oversold conditions. When the EMA points are close to each other, that is called convergence, and when they are apart, it is called divergence. The shorter the moving average, the more the reaction of the MACD line. There are three ways to interpret the MACD:

Here are some of the indications of an MACD and what they mean:-

1) Signal Line crossovers: Signal line is EMA of the MACD line. So it trails the average line and helps spot the turns in the MACD. When the MACD crosses turn above the signal line, it shows bullishness and is called a bullish crossover. If it turns below the signal line, that’s called a bearish crossover.
2) Centreline crossovers: When the MACD crosses turn above the zero line, it shows bullishness and is called a bullish centreline crossover. If it turns below the zero line, it’s a bearish centreline crossover. A positive crossover happens when the shorter EMA of the underlying security moves above the longer EMA.
3) Divergence: This shows a point where the MACD deviates and does not follow price action. When the price touches a new low, but the MACD does not confirm the same by making a new low, that’s considered a bullish divergence. Whereas in a bearish divergence, the price touches a new high, but the MACD does not make a new high on its own. The divergence points can show subtle shifts in a security.

Some other important points:
· The MACD indicator should be used when there is a proper trend. It doesn’t work in a rangebound market.

· Long bars in a histogram show divergence while short bars show convergence of the moving averages

· MACD has a positive momentum when a shorter EMA moves above the longer one, but when it moves below the longer EMA, that signals negative momentum.

· When the MACD rises significantly and short EMA pulls from the longer one, that signals an overbought condition

· There can be fake signals from the MACD too. For instance, there can be a bullish signal line crossover but a steep decline in price of a security.

Similarly, there can be a negative crossover but a sharp rise in the price of the underlying. So an event needs to be looked at for a longer duration for confirmation.