The Study Of Stock Market Through Technical Analysis

Lesson -> The Concept of Moving Averages

Averages are something we all learned in school. The moving average is an extension of this. Because they are simple and effective, moving averages are often used as trend indicators. Let's first review how averages are calculated before we get into moving averages. Imagine five people sitting on a sunny beach, enjoying a chilled bottled beverage. Each person ends up having several bottles of the drink because the sun is so bright and beautiful. Let's say that the final count is something like this. 

S.NPersonNo.of bottles


Take 6ThA person walks in and finds 29 bottles of beverages around him. He quickly can determine how many bottles were consumed by simply dividing them.[The total number of bottles]By[Total number of people].

It would be:

=5.8 bottles per head.

In this example, the average tells us how many bottles each person has drank. There would be very few people who had consumed more than the average. Person E, for example, drank 8 bottles of beverage. This is way more than the 5.8 bottle average. Person D also drank only 3 bottles of beverage, which is significantly less than the 5.8 bottle average. The average is an estimation and cannot be considered to be exact.

Here are the closing prices for ITC Limited in the 5 most recent trading sessions. This is how the 5-day average close would look like:

DATEClosing Price


= 1719.75/ 5.
= 343.95

The average ITC closing price over the past 5 trading sessions was 343.95.

13.1 - The Simple moving average

Imagine that you need to calculate Marico Limited's average closing price for the following scenario:Latest 5 days. These are the data:



= 1212.3/ 5
= 242.5

The average Marico closing price over the past 5 trading sessions was 242.5

The next day, i.e. We now have a new data point for the 28th of July (26th and27th were Saturdays and Sundays, respectively). This means that the "new" latest 5 days are now 22nd, 23rd and 24th of July respectively. As our goal is to calculate the 5-day average, we will remove the 21st data point.


TOTAL = 1223.2

= 1223.3/ 5.
= 244.66

The average closing price for Marico in the past 5 trading sessions was 244.66

To calculate the 5-day average, we included the most recent data (28 July) and eliminated the older data (21 July). 29th would have 29th and 22nd data. 30th would have 30th and 23rd data points.

In essence, we are moving to the most recent data point and discarding older to calculate the 5-day average. This is why the average is called "moving".

The closing prices are used to calculate the moving average in the example above. Moving averages can also be calculated using other parameters, such as high, open, or low. The closing prices, however, are mainly used by traders and investors because it represents the final settlement price of the market.

You can calculate moving averages for any time period, from minutes to hours to years. You can choose any time frame from the charting software, depending on your needs.

Here is an example of how MS Excel calculates moving averages. The cell reference changes in the average formula. This removes the oldest data points and allows for the latest.

CELL REFERENCEDATEVALUE(closing)Average (of 5 days)Formula(aveerage)


It is obvious that the closing price changes will cause the moving average to change. A moving average, also known as a "Simple Moving Average" (SMA), is calculated using the above formula. It is also known as a 5 Day SMA, as it is calculated using the most recent 5 days of data.

A smooth curving line also called as the moving average line is formed with joining the average of 5/10/50/100/200days and with passage of time it continues.

Below is a chart I created that overlays a 5 Day SMA graph over ACC's candlestick.


What is a moving average indicator? And how can one use it effectively? There are many applications for moving averages, and I will soon introduce a simple trading strategy based on moving averages. Let's first learn more about the Exponential moving average.

13.2 - Moving average -The exponentially concept

Take a look at the data points in this example.

DatePrice (closing)


There is an assumption that one must make when calculating the average of these numbers. Each data point is given equal importance. Assuming that the 22nd July data point is equally important as the 28th July data point, we are basically assuming this. This may not be the case when it comes markets.

Keep in mind the fundamental assumption of technical analysis: Markets discount everything. This means that the most recent price you see (on 28 th July), discounts all the unknown and known information. This means that the price you see on the 28th is considered more sacred than the one on the 25th.

It would be nice to assign weightage to datapoints based on the 'newness of the data. The data point of 28 July receives the most weightage. 25 July is next, 24 July is third, and so forth.

This has allowed me to scale the data points according its newness. The most recent data point receives the greatest attention and the oldest gets the least.

This scaled set of numbers is used to calculate the Exponential Moving average (EMA). The EMA calculation was skipped by me because technical analysis software allows us to drag and drop the EMA on price. We will therefore focus on the application of EMA, not its calculation.

Here's a chart for Cipla Ltd. On the closing prices of Cipla, I have plotted a 50-day SMA (black), and a 50-day EMA (red). Both EMA and SMA are valid for a period of 50 days. However, the EMA is more responsive to the closing prices and stays closer to them.

EMA reacts faster to market prices because it gives greater importance to the most recent data points. This allows traders to make quicker trading decisions.Use of SMA is prefered over EMA by the Traders.

13.3 - Simple application of moving average

You can use the moving average to find buying and selling opportunities based on its merit. If the stock price is higher than its average, traders will be willing to purchase the stock at a premium price. The traders are hopeful that the stock will rise. You should therefore look for buying opportunities.

The stock price falling below its average price means that traders will sell the stock for less than its average. The traders may be pessimistic about stock price movements. One should therefore look for selling opportunities.

These conclusions can be used to create a simple trading strategy. A trading system is a set or rules that helps you to identify entry and exit points.

Now, we will try to define a trading system that uses a 50-day exponential moving mean. A good trading system will give you both a signal for entering a trade or closing it. These are the rules that can be used to define a moving average trading system:

Rule 1When the current market price is higher than the 50-day EMA, buy (go long). You should not sell once you have gone long.

Rule 2When the current market price is lower than the 50-day EMA, you can exit the long position (square off).

This chart shows how the trading system was applied to Ambuja cement. The 50-day exponential moving mean is shown in the black line.

Beginning from the left, the first chance to buy came at 165. This is highlighted in the charts as B1@165. At point B1, the stock's price rose to a point above its 50-day EMA. According to the trading system rule, a new long position is initiated.

We remain invested in the trading system until we receive an exit signal. This signal was marked S1@187 at 187. This trade yielded a profit of Rs.22 each share.

Next, a signal to go long was received at B2@178 and squaring of at S2@182 of signal follows. The trade did not produce a large profit, however it was still impressive. The last trades, B3@165 and S3@215, were impressive. They resulted in a profit amounting to Rs.50.

Below is a brief summary of these trades, based on how the trading system performed:

Sl NoRate(purchasing)Rate(selling)Profit/loss Return (in%)

The above table clearly shows that the first and the last trades were profitable. However, the 2 and 3 trades weren't so profitable. It is clear that the stock trended during the first and third trades, but it moved sideways during the second trade.

This brings us to an important conclusion about moving averages. The moving averages work well when there is a trend, but they fail to perform when stocks move sideways.It means the Moving average is a trend following system.

Based on my personal experience trading using moving averages, there are a few key characteristics that I have observed.

  1. You can use moving averages to trade in a sideways market. These signals can result in marginal profits or even losses.
  2. However, it is not uncommon for one of these trades to result in a huge rally (like B3@165), which can lead to significant gains
  3. It would be difficult to separate the big winners from the many small traders.
  4. The trader shouldn't be selective about which signals the moving average system suggests. The trader should actually trade all trades suggested by the system.
  5. Keep in mind that although the losses are minimal with a moving average system the 1 large trade can be enough to offset all losses and give you enough profits
  6. Profit-making trades ensure that you stay in the trend for as long as it lasts. Sometimes even upto several months. MA can be used to identify long-term investment ideas.
  7. MA trading is about taking all trades and not being judgmental about signals generated by the system.

Another example of BPCL is this: the MA system suggested several trades in the sideways market, but none of them were really profitable. The last trade made 67% profit within 5 months.


13.4 - Moving Average Crossover System

It is obvious now that the problem with the simple vanilla moving average system generates too many trading signals in an upside-down market. The moving average crossover system is an improvement on the standard vanilla moving average system. This allows traders to make fewer trades in sideways markets.

The trader uses two moving averages instead of one in a MA crossover. This is often referred to simply as "smoothing".

An example would be to combine a 50-day EMA with a 100-day EMA. The faster-moving average is the shorter moving average (50 days). The slower moving average is the one with a longer average of 100 days.

A shorter moving average requires fewer data points to calculate and it reacts faster to market prices. It takes longer to calculate the average moving average and it is therefore slower to react to the current market price. The reactions are therefore slower.

This chart from Bank of Baroda shows how the moving averages stack up on a chart loaded with them.


As you can see the black 50-day EMA line is closer than the current market price because it reacts quicker than the pink 100 day EMA which reacts slower.

To smoothen the entry and exit points, traders have combined the plain vanilla MA system (with the crossover system). Although the trader receives fewer signals, the odds of it being profitable are high.

These are the entry and exit rules to the crossover system:

Rule 1-when the lomg term moving average is less than the short term moving avaerage then BUY(fresh long),and hold the trade till upto the condition is satisfied.

Rule 2When the short-term moving average becomes less than the longer-term average, exit the long position (square off).

Let's apply the MA crossover method to the same BPCL instance that we examined. To make it easier to compare, I reproduced the BPCL chart with a single 50-day MA.


Notice how MA suggested at most 3 trading signals when markets were going sideways. The 4 th trade won, resulting in 67% profit.

Below is a chart showing the application of a MA Crossover System with 50 and 100 Days EMA.


The 100 -day moving average is plotted through the pink line and the 50-day moving average is plotted through the black line.when the 100 day moving average is crossed by the 50-day moving average the signal to go long takes place,As per the cross overrule.the biggest advantage of a cross over system is that the traders are kept away from the 3 trades which are unprofitable.

Any combination can be used by traders to create MA cross-over systems. These are some of the most popular combinations for swing traders:

  1. 9-day EMA with 21-day EMA - Use this for short term trades (upto a few trading sessions)
  2. 25-day EMA with 50-day EMA - Use this to identify medium-term trading (upto a few weeks).
  3. This is a 50-day EMA and a 100-day EMA - this can be used to identify trades that are up to a few months in duration
  4. 100-day EMA and 200-day EMA - Use this to find long term trades (investment possibilities), some of which can last up to a year.

Keep in mind that the more timeframe, the fewer trading signals.

Here's an example of a crossover between 25 EMA and 50 EMA. The crossover rule allows for three trading signals.


The MA crossover system can be used for intraday trading, too. To identify intraday opportunities, one could use the crossover of 15 x 30 minutes. An aggressive trader might use a 5-x-10-minute crossover.

This is a common saying you may have heard in the markets: "The trend will be your friend." The moving averages can help you identify your friend.

MA is a trend-following system. As long as there's a trend, moving averages work well. It doesn't matter what time frame or cross-over combination you use.

Key points

  1. A standard average calculation is an approximate approximation of a set of numbers.
  2. A Moving Average is an average calculation in which the most recent data is used and the oldest is excluded.
  3. The simple moving average (SMA), gives equal weight to all data points in a series.
  4. The data is scaled according to their newness using an exponential moving average (EMA). The most recent data is given the highest weightage and the oldest data the lowest.
  5. An EMA is better than an SMA for all practical purposes. Because the EMA gives greater weight to the most recent data points, this is why it is better to use an EMA than an SMA.
  6. If the current market price exceeds the EMA, the outlook is bullish. If the current market price is lower than the EMA, the outlook becomes bearish
  7. Moving averages can cause whipsaws in a market that is not trending, which could lead to frequent losses. An EMA crossover system can be used to overcome this problem.
  8. A typical crossover system overlays the price chart with two EMAs. The shorter EMA reacts faster, while the longer EMA takes longer to react.
  9. Bullishness is seen when the faster EMA crosses the line and is higher than the slower EMA. The stock should be considered for purchase. Trades last up to a point at which the faster EMA begins going below the slower EMA.
  10. The trading signals will be lower the longer one selects for a cross-over system.