Moving averages also called as Simple moving average uses latest data point and discards the oldest data to calculate average. The Simple Moving Average is possibly the most popular technical analysis tool used by traders and investors.
Generally, the calculation of moving average is always based on the closing prices. Sometimes, moving averages are also calculated using other variable 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 the stock or index finally settles for the day.
The Simple Moving Average (SMA) is mostly used to identify trend direction, and to generate potential buy and sell signals. Let us take an example of a Simple Moving Average:
Suppose, above is closing price of a stock named XYZ, 566.55/5= 113.31, this is the average price of stock named XYZ, for last 5 trading sessions. Now, moving ahead, the next day market opened is on 11/05/2020(9,10 being Saturday, Sunday). Now to calculate the lastest 5day average we will drop the data of 04/05/2020. Below is how it will look like:
577.35/5=115.47, now this is the latest 5days average price of the stock XYZ, we have omitted the data of 04 and included the data on 11. Likewise, for 12 we will omit 05 and include 12 so on and so forth.
As, we have read above Moving averages or Simple moving average uses latest data point and discards the oldest data to calculate average. That is the reason it is called moving average, as the data we are using is the latest, above is an example of 5day SMA, as we are using only latest 5day data.
You can calculate moving average(MA) for any time frame, from minutes, hours to years. Depending upon your need you just need to select it on the software tool provided to you. Just for reference you can do the same in MS excel, similar to below you can use (10,25,50,100,200) data to create different SMA.