Moving average is calculated on the latest price of the stock while we drop the earlier prices from the series and taking average of the them so that we can plot them in the chart.
Moving average can be calculated on series of opening price, closing price, high price or low price of a stock.
Formula for Simple Moving Average
Simple Moving Average = (P1+P2+P5+P5+P4 ............Pn)/n
where P1,P2............Pn are stock price and n is number of days.
Example Showing Calculation For Simple Moving Averages:
Suppose we want to calculate the moving average of a closing stock price. Let the stock price of particular stock X at the end of the months from January to May are 120 Rs,140 Rs,160 Rs,180 Rs and 200 Rs respectively. The three month moving average in April will be (140 Rs + 160 Rs + 180 Rs)/5 or 160 Rs.That is sum of last three months closing including April divided by three.