# Moving Averages Simple Exponential

We have all learnt about averages in school, moving average is just an extension of that. Moving averages are trend indicators and are frequently used due to their simplicity and effectiveness. Before we learn moving averages, let us have a quick recap on how averages are calculated.

📷

Assume 5 people are sitting on a nice sunny beach enjoying a nice chilled bottled beverage. The sun is so bright and nice that each one of them end up drinking several bottles of the beverage. Assume the final count to be something like this:

Sl NoPersonNo of Bottles01A0702B0503C0604D0305E08Total # of bottles consumed29

Assume a 6th person walks in to find out 29 bottles of beverages lying around them. He can quickly get a sense of ‘roughly’ how many bottles each of them consumed by dividing [the total number of bottles]  by [total number of people].

In this case it would be:

So, the average in this case tells us roughly how many bottles each person had consumed. Obviously there would be few of them who had consumed above and below the average. For example, Person E drank 8 bottles of beverage, which is way above the average of 5.8 bottles. Likewise, person D drank just 3 bottles of beverage, which is way below the average of 5.8 bottles. Therefore average is just an estimate and one cannot expect it to be accurate.

Extending the concept to stocks, here are the closing prices of ITC Limited for the last 5 trading sessions. The last 5 day average close would be calculated as follows:

DateClosing Price14/07/14344.9515/07/14342.3516/07/14344.2017/07/14344.2518/07/14344.0Total1719.75

= 1719.75 / 5 = 343.95

Hence the average closing price of ITC over the last 5 trading sessions is 343.95.

## 13.1 – The ‘moving’ average (also called the simple moving average)

Consider a situation where you want to calculate the average closing price of Marico Limited for the latest 5 days. The data is as follows:

DateClosing Price21/07/14239.222/07/14240.623/07/14241.824/07/14242.825/07/14247.9Total1212.3

= 1212.3/ 5 = 242.5

Hence the average closing price of Marico over the last 5 trading sessions is 242.5

Moving forward, the next day i.e 28th July (26th and 27th were Saturday and Sunday respectively) we have a new data point. This implies now the ‘new’ latest 5 days would be 22nd, 23rd, 24th, 25th and 28th. We will drop the data point belonging to the 21st as our objective is to calculate the latest 5 day average.

DateClosing Price22/07/14240.623/07/14241.824/07/14242.825/07/14247.928/07/14250.2Total1223.3

= 1223.3/ 5 = 244.66

Hence the average closing price of Marico over the last 5 trading sessions is 244.66

As you can see, we have included the latest data (28th July), and discarded the oldest data (21st July) to calculate the 5 day average.  On 29th, we would include 29th data and exclude 22nd data, on 30th we would include 30th data point but eliminate 23rd data, so on and so forth.

So essentially, we are moving to the latest data point and discarding the oldest to calculate the latest 5 day average. Hence the name “moving” average!

In the above example, the calculation of moving average is based on the closing prices.  Sometimes, moving averages are also calculated using other parameters such as high, low, and open. However the closing prices are used mostly by the traders and investors as it reflects the price at which the market finally settles down.

Moving averages can be calculated for any time frame, from minutes, hours to years.  Any time frame can be selected from the charting software based of your requirements.

For those of you familiar with excel, here is a screenshot of how moving averages are calculated on MS Excel. Notice how the cell reference moves in the average formula, eliminating the oldest to include the latest data points.

Cell RefDateClose Price5 Day AverageAverage FormulaD31-Jan-141287.7D42-Jan-141279.25D53-Jan-141258.95D66-Jan-141249.7D77-Jan-141242.4D88-Jan-141268.751263.6=AVERAGE(D3:D7)D99-Jan-141231.21259.81=AVERAGE(D4:D8)D1010-Jan-141201.751250.2=AVERAGE(D5:D9)D1113-Jan-141159.21238.76=AVERAGE(D6:D10)D1214-Jan-141157.251220.66=AVERAGE(D7:D11)D1315-Jan-141141.351203.63=AVERAGE(D8:D12)D1416-Jan-141152.51178.15=AVERAGE(D9:D13)D1517-Jan-141139.61162.41=AVERAGE(D10:D14)D1620-Jan-141140.61149.98=AVERAGE(D11:D15)D1721-Jan-141166.351146.26=AVERAGE(D12:D16)D1822-Jan-141165.41148.08=AVERAGE(D13:D17)D1923-Jan-141168.251152.89=AVERAGE(D14:D18)

As it is evident, the moving average changes as and when the closing price changes. A moving average as calculated above is called a ‘Simple Moving Average’ (SMA). Since we are calculating it as per the latest 5 days of data it is called referred to as 5 Day SMA.

The averages for the 5 day (or it could be anything like 5, 10, 50, 100, 200 days) are then joined to form a smooth curving line known as the moving average line, and it continues to move as the time progresses.

In the chart shown below, I have overlaid a 5 day SMA over ACC’s candlestick graph.

📷

So what does a moving average indicate and how does one use it?  Well, there are many applications of moving average and shortly I will introduce a simple trading system based on moving averages. But before that, let us learn about the Exponential Moving Average.

## 13.2 – The exponential moving average

Consider the data points used in the this example,

DateClosing Price22/07/14240.623/07/14241.824/07/14242.825/07/14247.928/07/14250.2Total1214.5

When one calculates the average across these numbers there is an unstated assumption. We are essentially giving each data point equal importance. Meaning, we are assuming that the data point on 22nd July is as important as the data point on 28th July. However, when it comes to markets, this may not always be true

Remember the basic assumption of technical analysis – markets discount everything. This means the latest price that you see (on 28th July) discounts all the known and unknown information. This also implies the price on 28th is more sacred than the price on 25th.

Going by this, one would like to assign weightage to data points based on the ‘newness’ of the data. Therefore the data point on 28th July gets the highest weightage, 25th July gets the next highest weightage, 24th July gets the 3rd highest, and so on.

By doing so, I have essentially scaled the data points according to its newness – the latest data point gets the maximum attention and the oldest data point gets the least attention.

The average calculated on this scaled set of numbers gives us the Exponential Moving Average (EMA). I deliberately skipped the EMA calculation part, simply because most of the technical analysis software lets us drag and drop the EMA on prices. Hence we will focus on EMA’s application as opposed to its calculation.

Here is a chart of Cipla Ltd. I have plotted a 50 day SMA (black) and a 50 day EMA (red) on Cipla’s closing prices. Though both SMA and EMA are for a 50 day period, you can notice that the EMA is more reactive to the prices and hence it sticks closer to the price.

📷

The reason why EMA is quicker to react to the current market price is because EMA gives more importance to the most recent data points. This helps the trader to take quicker trading decisions. Hence for this reason, traders prefer the use of the EMA over the SMA.

## 13.3 – A simple application of moving average

The moving average can be used to identify buying and selling opportunities with its own merit. When the stock price trades above its average price, it means the traders are willing to buy the stock at a price higher than its average price. This means the traders are optimistic about the stock price going higher. Therefore one should look at buying opportunities.

Likewise, when the stock price trades below its average price, it means the traders are willing to sell the stock at a price lesser than its average price. This means the traders are pessimistic about the stock price movement. Therefore one should look at selling opportunities.

We can develop a simple trading system based on these conclusions. A trading system can be defined as a set of rules that help you identify entry and exit points.

We will now try and define one such trading system based on a 50 day exponential moving average. Remember a good trading system gives you a signal to enter a trade and a signal to close out the trade.  We can define the moving average trading system with the following rules:

Rule 1) Buy (go long) when the current market price turns greater than the 50 day EMA. Once you go long, you should stay invested till the necessary sell condition is satisfied

Rule 2) Exit the long position (square off) when the current market price turns lesser than the 50 day EMA

Here is a chart that shows the application of the trading system on Ambuja cements. The black line on the price chart is the 50 day exponential moving average.

📷

Starting from left, the first opportunity to buy originated at 165, highlighted on the charts as B1@165. Notice, at point B1, the stock price moved to a point higher than its 50 day EMA. Hence as per the trading system rule, we initiate a fresh long position.

Going by the trading system, we stay invested till we get an exit signal, which we eventually got at 187, marked as S1@187. This trade generated a profit of Rs.22 per share.

The next signal to go long came at B2@178, followed by a signal to square off at S2@182. This trade was not impressive as it resulted in a profit of just Rs.4. However the last trade, B3@165, and S3@215 was quite impressive resulting in a profit of Rs.50.

Here is a quick summary of these trades based on the trading system fared:

From the above table, it is very clear that the first and last trades were profitable, but the 2nd trade was not so profitable. If you inspect why this happened, it is evident that during the 1st and the 3rd trade, the stock was trending but during the 2nd trade the stock moved sideways.

This leads us to a very important conclusion about the moving averages. Moving averages works brilliantly when there is a trend and fails to perform when the stock moves sideways. This basically means the ‘Moving average’ in its simplest form is a trend following system.

From my own personal experience of trading based on moving averages, I have noticed a few important characteristics:

Here is another example of BPCL, where the MA system suggested multiple trades during the sideways market, however none of them were really profitable. However, the last trade resulted in a 67% profit in about 5 months.

📷

## 13.4 – Moving average crossover system

As its evident now the problem with the plain vanilla moving average system is that it generates far too many trading signals in a sideway market. A moving average crossover system is an improvisation over the plain vanilla moving average system. It helps the trader to take fewer trades in a sideways market.

In a MA crossover system, instead of the usual single moving average, the trader combines two moving averages. This is usually referred to as ‘smoothing’.

A typical example of this would be to combine a 50 day EMA, with a 100 day EMA. The shorter moving average (50 days in this case) is also referred to as the faster moving average. The longer moving average (100 days moving average) is referred to as the slower moving average.

The shorter moving average takes lesser number of data points to calculate the average and hence it tends to stick closer to the current market price, and therefore reacts more quickly. A longer moving average takes more number of data points to calculate the average and hence it tends to stay away from the current market price. Hence the reactions are slower.

Here is the chart of Bank of Baroda, showing you how the two moving averages stack up when loaded on a chart.

📷

As you can see, the black 50 day EMA line is closer to the current market price (as it reacts faster) when compared to the pink 100 day EMA (as its reacts slower).

Traders have modified the plain vanilla MA system with the crossover system to smoothen out the entry and exit points. In the process, the trader gets far fewer signals, but the chances of the trade being profitable are quite high.

The entry and exit rules for the crossover system is as stated below:

Rule 1) – Buy (fresh long) when the short term moving averages turns greater than the long term moving average. Stay in the trade as long as this condition is satisfied

Rule 2) – Exit the long position (square off) when the short term moving average turns lesser than the longer term moving average

Let us apply the MA crossover system to the same BPCL example that we looked at. For ease of comparison, I have reproduced the BPCL’s chart with a single 50 day MA.

📷

Notice, when the markets were moving sideways, MA suggested at least 3 trading signals. However the 4th trade was the winner which resulted in 67% profit.

The chart shown below shows the application of a MA crossover system with 50 and 100 day EMA.

📷

The black line plots the 50 day moving average and the pink line plots the 100 day moving average. As per the cross over rule, the signal to go long originates when the 50 day moving average (short term MA) crosses over the 100 day moving average (long term MA). The crossover point has been highlighted with an arrow. Please do notice how the crossover system keeps the trader away from the 3 unprofitable trades. This is the biggest advantage of a cross over system.

A trader can use any combination to create a MA cross over system. Some of the popular combinations for a swing trader would be:

9 day EMA with 21 day EMA – use this for short term trades ( upto few trading session)25 day EMA with 50 day EMA – use this to identify medium term trade (upto few weeks)50 day EMA with 100 Day EMA – use this to identify trades that lasts upto few months100 day EMA with 200 day EMA – use this to identify long term trades (investment opportunities), some of them can even last for over a year or more.

Remember, longer the time frame the lesser the number of trading signals.

Here is an example of a 25 x 50 EMA crossover. There are three trading signals that qualify under the crossover rule.

📷

Needless to say, the MA crossover system can also be applied for intraday trading. For instance one could use the 15 x 30 minutes crossover to identify intraday opportunities. A more aggressive trader could use 5 x 10 minute crossover.

You may have heard this popular saying in the markets – “The trend is you friend”. Well, the moving averages help you identify this friend.

Remember, MA is a trend following system – as long as there is a trend, the moving averages works brilliantly. It does not matter which time frame you use or which cross over combination you use.

### Key takeaways from this chapter

A standard average calculation is a quick approximation of a series of numbersIn a average calculation where the latest data is included, and the oldest is excluded is called a Moving AverageThe simple moving average (SMA) gives equal weightage to all data points in the seriesAn exponential moving average (EMA) scales the data according to its newness. Recent data gets the maximum weightage and the oldest gets the least weightageFor all practical purposes, use an EMA as opposed to SMA. This is because the EMA gives more weightage to the most recent data pointsThe outlook is bullish when the current market price is greater than the EMA. The outlook turns bearish when the current market price turns lesser than the EMAIn a non trending market, moving averages may result in whipsaws thereby causing frequent losses. To overcome this a EMA crossover system is adoptedIn a typical crossover system, the price chart is over laid with two EMAs. The shorter EMA is faster to react, while the longer EMA is slower to reactThe outlook turns bullish when the faster EMA crosses and is above the slower EMA. Hence one should look at buying the stock. The trade lasts upto a point where the faster EMA starts going below the slower EMAThe longer the time frame one chooses for a crossover system, the lesser the trading signals.

See All