Moving averages are of particular significance for traders. They are straightforward, yet very effective tools to gauge buying and selling points in a chart. Although you can directly use it on the chart to gain a better understanding of how it functions let’s understand the moving average calculation.
How to Calculate Moving Average?
As you know the moving averages use past price data to deduce market trends so it becomes essential to understand how different moving averages behave when price data is fed to them.
But is moving average a good indicator? Well for this let’s understand how to calculate the value of both the indicators.
Following are the ways to calculate moving averages i.e Simple Moving Average and Exponential Moving Average.
Simple Moving Average Calculation
It is one of the simplest moving averages to calculate. A simple moving average is calculated by dividing the opening, closing, high or low prices (you can choose any one of them for calculation) of a stock over a specific period say 5 days, 20 days, or 50 days.
Let’s show you an example of how it works. To better understand, we have taken the 5 days closing price of HDFC Bank between June 28 and July 4th, 2022.
Now to calculate SMA, you simply have to use the average formula as under:
SMA = P1 + P2 + P3 + P4 + P5 / N
where, N= Number of Days
Putting the values in the formula, ₹6747.25/5
Simple Moving Average = ₹1349.45
In this way, you can calculate SMA for any number of months, weeks, days, hours or minutes.
As you know exponential moving averages (EMA) are faster moving averages so short-term traders prefer them.
Exponential moving averages are used by traders to establish the current trend.
EMA does so by tracking the price line. In simpler terms when the stock price line on a chart moves above the exponential moving average line from below, it will generate a buy signal.
In case the price line moves below the EMA line from above, it will be a sell signal for traders.
However, the Exponential Moving Average is highly reactive to price changes which is why it needs to be traded carefully. Even a simple reaction can look like an upcoming trend, generating an incorrect trading decision.
Now let’s come to the point i.e calculation of the Exponential moving average.
As you know EMA gives us the flexibility in forming trading strategies with high, low, open, or close prices of security so you can choose any one of four of them.
Also, you can choose any period length ranging from minutes to days to calculate an exponential moving average.
Let us show you how to calculate the exponential moving average with an example.
Here we have taken the 5 days closing price of Tata motors from April 28th to May 5.
Now to calculate EMA, first, you have to find the SMA value of the defined period.
SMA = P1 + P2 + P3 + P4 + P5 / N = ₹2156.30 /5
SMA = ₹431.26
Now, using the EMA formula:
EMA = K*(Current Price – Previous EMA) + Previous EMA
- K is the weighting factor for EMA
- K = 2 / (n+1), here ‘n’ is the number of selected time periods
- Previous EMA = Previous day EMA or if calculating for the first time, SMA is used in the place of previous EMA
With this formula, the EMA would be ₹429.62
Now, you can see that the EMA of the closing price is ₹429.62 which is more close to the current price of the stock (price on May 5th) while the SMA is ₹431.26, therefore, it reflects that EMA follows the price more closely as compared to SMA.
That is why EMA is used for short-term trade rather than, SMA which is more feasible for long-term trades. You can gain a better understanding of the differences between the two in a complete review of SMA vs EMA.
This is how you can calculate EMA or SMA for a specific period. Seems to be difficult, well you can select these indicators on the chart and gain an idea of the bullish or bearish trend in the market.
Hope you got the idea of the calculation of moving averages. If you want to learn more about moving averages, and their use in trading you can subscribe to our Stock Pathshala course.
In case you’d like us to call you back to explain more about stock market learning, just leave your contact info below:
Before investing capital, invest your time in learning Stock Market.
Fill in the basic details below and a callback will be arranged for more information: