Technical Analysis: Understanding Moving Averages
07 Aug 2019
Gautam Upadhyaya
Untitled Document
Moving averages
Moving average is a widely used technical indicator of stock prices that helps to smooth out the volatility in the price action by filtering out the noise from random price fluctuations. A moving average is a trendfollow lagging indicator as it is calculated taking past data into consideration. As its name suggests, a moving average is an average that moves as old values are dropped out as new values become available. Moving averages can be employed to identify the current trend in a script.
Types of moving averages
There are 3 types of moving averages
a) Simple moving average (SMA)
It is obtained by computing the simple average of price data over a defined period of time. In general, we compute the simple moving average based on the closing price of the security as it is considered to have more significance as compared to the rest of price points (Namely open/high/low price for the day). Thus, a 5day SMA is calculated by adding the closing price of 5 days and dividing this sum by the total number of days (in this case, five).
For example, the 5 days SMA of ITC is calculated as follows:
While calculating the Moving Average after the close of the trading session on July 7, 2017, we can compute the SMA value by taking the closing price of the last 5 trading session, including July 7, 2017, and dividing the same by 5. At close of the next trading session on July 10, 2017, SMA is calculated by excluding the Closing Price of July 3, 2017 by adding the new data point. (Closing Price of July 10, 2017).
As illustrated in the example below, prices gradually decreases from 342.5 to 328.85 over a period of eight days in the same timeframe the 5 Period SMA decreases from 336.44 to 332.79, indicating a lag associated with the Moving Averages. Hence, larger the time period, larger is the lag.
Date

Close Price

5 Period SMA

03Jul17

342.5


04Jul17

337.25


05Jul17

331.05


06Jul17

337.10


07Jul17

334.30

336.44

10Jul17

333.30

334.60

11Jul17

330.40

333.23

12Jul17

328.85

332.89

7TH July SMA = 336.44= (342.50+337.25+331.05+337.10+334.30)
5
10th July SMA =334.6= (337.25+331.05+337.10+334.30+333.30)
5
11th July SMA= 333.23= (331.05+337.10+334.30+333.30+330.40)
5
12th July WMA= 332.89= (337.10+334.30+333.30+330.40+328.85)
5
b) Weighted moving average (WMA)
Weighted moving average moves a step ahead from simple moving average. Here, we assign a weight to each value, with a bigger weight assigned to the most recent data points as they are more relevant than historical data points. The sum of weights should add up to 1 (or 100%). As new data points are added, the new weights will align accordingly. In contrast, in simple moving average, each value is assigned the same weight. Ideally, traders calculate WMA on the basis of closing price.
The weighted moving average is calculated by multiplying the given price by its assigned weight and then dividing the sum by total number of days. The weights assigned are subjective in nature, and it is based on the discretion of the trader. Because of its calculation methodology, WMA will follow prices more closely than a corresponding SMA. The WMA reduces the lag effect to an extent.
Date 
Close Price

Weights

WMA

03Jul17

342.5

0.07


04Jul17

337.25

0.13


05Jul17

331.05

0.20


06Jul17

337.10

0.27


07Jul17

334.30

0.33

335.34

10Jul17

333.30


334.29

11Jul17

330.40


332.89

12Jul17

328.85


331.43

7TH July WMA = 335.34= (342.50*0.07+337.25*0.13+331.05*0.20+337.10*0.27+334.3*0.33)
5
10th July WMA =334.29= (337.25*0.07+331.05*0.13+337.10*0.20+334.3*0.27+333.3*0.33)
5
11th July WMA= 332.89= (331.05*0.07+337.10*0.13+334.30*0.20+333.3*0.27+330.4*0.33)
5
12th July WMA= 331.43= (337.1*0.07+334.30*0.13+333.30*0.20+330.4*0.27+328.85*0.33)
5
C) Exponential moving average (EMA)
Exponential moving average differs from the simple and weighted moving average as an EMA is calculated by taking all the historical data points since the inception of the stock. Ideally, to calculate 100% accurate EMA, we should make use of all the closing prices right from the time of the listing of stock.
Calculation of the EMA is a 3 step process
Step 1: Since it is not practical to calculate historical data right from the inception of the stock, we use the SMA value as the initial EMA value. So, a simple moving average is used as the previous period's EMA in the first calculation.
Step 2: We calculate the weighting multiplier by dividing 2 by the sum of total periods and 1.
Step 3: We subtract the EMA of the previous day from the current closing price, and multiply this number by the multiplier. We then add this product with its previous period EMA to find out the final EMA value.
Therefore, the current EMA value will change depending on how much past data we use in our EMA calculation. The more data points we use, the more accurate our EMA will be. The goal is to maximize accuracy while minimizing calculation time.
Initial EMA value = 5period SMA
Weighting Multiplier= (2 / (Time periods + 1)) = (2 / (5 + 1) ) = 0.3333 (33.33%)
EMA= {Close – EMA of previous day} x multiplier + EMA (previous day).
A 5period EMA applies a 33.33% weighting to the most recent prices. A 10period EMA has a weighting multiplier of 18.18%. The shorter the time period, larger the weighting multiplier will be. We notice that as the time period doubles, the weighting multiplier drops ~50%.
Date

Close Price

5 Period SMA

Weighting factor

5 Period EMA

03Jul17

342.5




04Jul17

337.25




05Jul17

331.05




06Jul17

337.10




07Jul17

334.30

336.44


336.44

10Jul17

333.30

334.60

0.3333

335.39

11Jul17

330.40

333.23

0.3333

333.73

12Jul17

328.85

332.79

0.3333

332.10

7TH July EMA = 5 Period SMA= 336.44
10THJuly EMA = 335.39= (333.30336.44) x0.33 + 336.44
11THJuly EMA = 333.73= (330.40335.39) x0.33 + 335.39
12THJuly EMA =332.10= (328.85 333.72) x0.33 +333.72
Comparison of the 3 moving averages
As we see by comparing the computation methodology of the 3 moving averages, different values are generated. EMA is most commonly used by traders.
Moving Averages

SMA

WMA

EMA

Advantages

1)Smoothened Average
2)Less prone to whipsaw
3)Best average to consider for support & resistance

1)Reduction in price lag, so can be implemented for short term trading

1)Reduction in price lag, hence can be used for short term trading
2)No omission in price data points

Disadvantages

1)Has maximum price lag
2) Assigns same weight to all price data.
3)Omission of previous data points leading to all price data not made use of

1) Omission of previous data points leading to all price data not made use of
2) Chance of whipsaw

1)Chance of whipsaw

Moving Average Value comparison – The following table represents a comparison between the different values of the 3 types of Moving Averages over the same period of time
Date

Close Price

5 Period SMA

5 Period WMA

5 Period EMA

03Jul17

342.5




04Jul17

337.25




05Jul17

331.05




06Jul17

337.10




07Jul17

334.30

336.44

335.34

336.44

10Jul17

333.30

334.60

334.29

335.39

11Jul17

330.40

333.23

332.89

333.73

12Jul17

328.85

332.89

331.43

332.10

Graphical comparison on the 3 moving averages.
(Blue5 Period EMA, Green5 Period WMA, Pink5 Period SMA)
As we seen in the above graph, when there is a sharp correction in price as in the case of ITC, EMA and WMA reacted the most since they are assigned a higher weight to the most recent prices as compared to the SMA.
Applications of moving average
Trend Identification
Traders use moving averages to identify the trend in a stock. A rising 200day moving average reflects that the long term trend is up and stock can be traded with a positive bias. Similarly, a falling 200day moving average reflects a long term downtrend and hence we can consider shorting the stock or refraining from investing in it.
(Blue10 Period EMA, Green 89 Period EMA, Pink 200 Period EMA)
From the above graph, we can clearly see that L&T Fin is in a long term uptrend, the short term and medium term averages are trading above its long term, 200day moving average which is also showing an upward momentum. A price dip towards its medium term average can be considered as a buying opportunity.
Buy/Sell signals based on crossover
A buy signal is generated when a bullish crossover occurs i.e. the short term moving average crosses the long term moving average, popularly referred to as a golden cross. For example, when the 89day EMA crosses above the 200day EMA, a bullish trade can be initiated. On the other hand, a bearish dead cross occurs when the short term moving average crosses below the long term moving average. The signals generated tend to occur with a lag as we make use of 2 lagging indicators. The best trading opportunities are obtained in a trending market as compared to the sideways market wherein whipsaws or false signals are generated.
Price

89 Period EMA

Action /View

Technical Term

Trading Above 200EMA

Crosses above 200EMA

Bullish

Golden cross

Trading Below 200EMA

Crosses below 200EMA

Bearish

Dead cross

From the above graph we see how moving averages can be used to generate trading signals
Moving averages can also be used to generate signals with simple price crossovers. A bullish signal is generated when prices move above the moving average. A bearish signal is generated when prices move below the moving average. Advantage of price signals is that the time lag is reduced and traders are able to react at an early stage.
As in the Fortis Ltd case shown above, traders could have initiated a short position or could have closed their long positions when the stock price closed below its 200day EMA. Consequently, a huge surge in trading volumes with MACD Histogram getting into the negative territory indicated a change in momentum which gave added information to traders to take a bearish view, resulting in a fall in stock price by 18%.
Support & Resistance Levels
Moving averages also tend to act as support and resistance levels. A stock in a long term uptrend could find support near its medium term EMA during a pullback, similarly a stock in a long term downtrend could face resistance near is medium term moving average during any bounce back. In fact, some moving averages may offer support or resistance simply because it is widely used by many traders. As an example, a trader may not short a stock if it is trading near its 200day EMA because of the fear that other traders may be using it as a buying zone.
In the above example of JSW Steel, we see how the stock has taken support along its medium term 89day EMA on multiple occasions and has acted as a good support level to purchase the stock.
Moving Averages in sync with Candlestick pattern
Moving averages can also be traded in tandem with candlestick patterns. In the above chart of Bata India Ltd, the bullish candlestick pattern can be traded with added confidence as it coincides with the support of 200day EMA.
Moving Average in sync with Price pattern
In the above chart of United Spirits Ltd, the buy signal generated by the bullish crossover coincides with a cup and handle breakout on the daily chart, affirming a bullish bias in the stock.
Construction of Indicators
Moving averages are used in the construction of technical indicators such as Bollinger Band and MACD which are widely used by market technicians.
Key moving averages used by technical analyst
Moving averages are used based on trading horizon.
Moving Average

Trading Time frame

5 period MA

Short term

13 period MA

Short term

50 period MA

Medium Term

89period MA

Medium Term

200 period MA

Long Term

Observations on Moving Average

It is used in a trending market to give clear trend direction by eliminating the noise.
 In case of a sideways market, moving average would lead to whipsaws making the use of other indicators like RSI and Stochastic more helpful.
 Signals generated by moving averages tend to have a lag.
 It is used best when combined with technical indicators and price patterns.