Thursday, April 9, 2020

MACD-Moving Average Convergence and Divergence

Moving Average Convergence and Divergence (MACD)

The Moving Average Convergence and Divergence (MACD) indicator was developed by Gerald Appel in the late seventies. Traders consider MACD as the grand old daddy of indicators. Though invented in the seventies, MACD is still considered as one of the most reliable indicators by momentum traders.
As the name suggests, MACD is all about the convergence and divergence of the two moving averages. Convergence occurs when the two moving averages move towards each other, and a divergence occurs when the moving averages move away from each other.
A standard MACD is calculated using a 12 day EMA and a 26 day EMA. Please note, both the EMA’s are based on the closing prices.We subtract the 26 EMA from the 12 day EMA, to estimate the convergence and divergence (CD) value. A simple line graph of this is often referred to as the ‘MACD Line’.  Let us go through the math first and then figure out the applications of MACD.
DateClose12 Day EMA26 Day EMAMACD Line
1-Jan-146302
2-Jan-146221
3-Jan-146211
6-Jan-146191
7-Jan-146162
8-Jan-146175
9-Jan-146168
10-Jan-146171
13-Jan-146273
14-Jan-146242
15-Jan-146321
16-Jan-146319
17-Jan-1462626230
20-Jan-1463046226
21-Jan-1463146233
22-Jan-1463396242
23-Jan-1463466254
24-Jan-1462676269
27-Jan-1461366277
28-Jan-1461266274
29-Jan-1461206271
30-Jan-1460746258
31-Jan-1460906244
3-Feb-1460026225
4-Feb-1460016198
5-Feb-1460226176
6-Feb-14603661536198-45
7-Feb-14606361306188-58
10-Feb-14605361076182-75
11-Feb-14606360836176-94
12-Feb-14608460666171-106
13-Feb-14600160616168-107
Let us go through the table starting from left:
  1. We have the dates, starting from 1st Jan 2014
  2. Next to the dates we have the closing price of Nifty
  3. We leave the first 12 data points (closing price of Nifty) to calculate the 12 day EMA
  4. We then leave the first 26 data points to calculate the 26 day EMA
  5. Once we have both 12 and 26 day EMA running parallel to each other (6th Feb 2014) we calculate the MACD value
  6. MACD value = [12 day EMA – 26 day EMA]. For example on 6th Feb 2014, 12 day EMA was 6153, and 26 day EMA was 6198, hence the MACD would be 6153-6198 = – 45
When we calculate the MACD value over a series of 12 and 26 day EMAs and plot it as a line graph, we get the MACD line, which oscillates above and below the central line.
DateClose12 Day EMA26 Day EMAMACD Line
1-Jan-146302
2-Jan-146221
3-Jan-146211
6-Jan-146191
7-Jan-146162
8-Jan-146175
9-Jan-146168
10-Jan-146171
13-Jan-146273
14-Jan-146242
15-Jan-146321
16-Jan-146319
17-Jan-1462626230
20-Jan-1463046226
21-Jan-1463146233
22-Jan-1463396242
23-Jan-1463466254
24-Jan-1462676269
27-Jan-1461366277
28-Jan-1461266274
29-Jan-1461206271
30-Jan-1460746258
31-Jan-1460906244
3-Feb-1460026225
4-Feb-1460016198
5-Feb-1460226176
6-Feb-14603661536198-45
7-Feb-14606361306188-58
10-Feb-14605361076182-75
11-Feb-14606360836176-94
12-Feb-14608460666171-106
13-Feb-14600160616168-107
14-Feb-14604860516161-111
17-Feb-14607360456157-112
18-Feb-14612760456153-108
19-Feb-14615360486147-100
20-Feb-14609160606144-84
21-Feb-14615560686135-67
24-Feb-14618660796129-50
25-Feb-14620060926126-34
26-Feb-14623961036122-19
28-Feb-14627761186119-1
3-Mar-1462216136611720
4-Mar-1462986148611236
5-Mar-1463296172611359
6-Mar-1464016196612175
7-Mar-1465276223613192
10-Mar-14653762566147110
11-Mar-14651262886165124
12-Mar-14651763246181143
13-Mar-14649363546201153
14-Mar-14650463806220160
Given the MACD value, lets try and find the answer for few obvious questions:
  1. What does a negative MACD value indicate?
  2. What does a positive MACD value indicate?
  3. What does the magnitude of the MACD value actually mean? As in, what information does a -90 MACD  convey versus a – 30 MACD ?
The sign associated with the MACD just indicates the direction of the stock’s move. For example if the 12 Day EMA is 6380, and 26 Day EMA is 6220 then the MACD value is +160. Now, under what circumstance do you think the 12 day EMA will be greater than the 26 day EMA? Well, we had looked into this in the moving average chapter. The shorter term average will generally be higher than the longer term only when the stock price is trending upwards. Also, do remember, the shorter term average will always be more reactive to the current market price than the longer term average. Hence a positive sign tells us that there is positive momentum in the stock, and the stock is drifting upwards. The higher the momentum, the higher is the magnitude. For example, +160 indicate a positive trend which is stronger than +120.
However, while dealing with the magnitude, always remember the price of the stock influences the magnitude. For example, higher the underlying price such as Bank Nifty, naturally, the higher will be the magnitude of the MACD.
When the MACD is negative, it means the 12 day EMA is lower than the 26 day EMA. Therefore the momentum is negative. Higher the magnitude of the MACD, the more strength in the downward trend.
The difference between the two moving averages is called the MACD spread. The spread decreases when the momentum mellows down and increases when the momentum increases. To visualize convergence and the divergence traders usually plot the chart of the MACD value, often referred to as the MACD line.
The following is the MACD line chart of Nifty for data points starting from 1st Jan 2014 to 18th Aug 2014.
M2-Ch15-Chart1
As you can see the MACD line oscillates over a central zero line. This is also called the ‘Center line’. The basic interpretation of the MACD indicator is that:
  1. When the MACD Line crosses the center line from the negative territory to positive territory, it means there is divergence between the two averages. This is a sign of increasing bullish momentum; therefore one should look at buying opportunities. From the chart above, we can see this panning out around 27thFeb
  2. When the MACD line crosses the center line from positive territory to the negative territory it means there is convergence between the two averages. This is a sign of increasing bearish momentum; therefore one should look at selling opportunities. As you can see, there were two instance during which the MACD almost turned negative (8th May, and 24th July) but the MACD just stopped at the zero line and reversed directions
Traders generally argue that while waiting for the MACD line to crossover the center line a bulk of the move would already be done and perhaps it would be late to enter a trade.  To overcome this, there is an improvisation over this basic MACD line. The improvisation comes in the form of an additional MACD component which is the 9 day signal line. A 9 day signal line is a exponential moving average (EMA) of the MACD line. If you think about this, we now have two lines:
  1. A MACD line
  2. A 9 day EMA of the MACD line, also called the signal line
With these two lines, a trader can follow a simple 2 line crossover strategy as discussed in the moving averages chapter, and no longer wait for the center line cross over.
  1. The sentiment is bullish when the  MACD line crosses the 9 day EMA wherein MACD line is greater than the 9 day EMA. When this happens, the trader should look at buying opportunities
  2. The sentiment is bearish when the MACD line crosses below the 9 day EMA wherein the MACD line is lesser than the 9 day EMA. When this happens, the trader should look at selling opportunities
The chart below plots the MACD indicator on Asian Paints Limited. You can see the MACD indicator below the price chart.
M2-Ch15-Chart2
The indicator uses standard parameters of MACD:
  1. 12 day EMA of closing prices
  2. 26 day EMA of closing prices
  3. MACD line (12D EMA – 26D EMA) represented by the black line
  4. 9 day EMA of the MACD line represented by the red line
The vertical lines on the chart highlight the crossover points on the chart where a signal to either buy or sell has originated.
For example, the first vertical line starting from left points to a crossover where the MACD line lies below the signal line (9 day EMA) lies and suggests a short trade.
The 2nd vertical line from left, points to a crossover where the MACD line lies above the signal line, hence one should look at buying opportunity. So on and so forth.
Please note, at the core of the MACD system, are moving averages. Hence the MACD indicator has similar properties like that of a moving average system. They work quite well when there is a strong trend and are not too useful when the markets are moving sideways. You can notice this between the 1st two line starting from left.
Needless to say, the MACD parameters are not set in stone. One is free to change the 12 day, and 26 day EMA to whatever time frame one prefers. I personally like to use the MACD in its original form, as introduced by Gerald Appel.

No comments:

Post a Comment

TRADING-How to increase usability of trading style-Part 3 -"Pattern Confirmation"

So how do we confirm a pattern? There are several methods and it is down to personal preference as to how you decide to confirm your pa...