# What is a moving average?

A moving average (MA) is a widely used indicator in technical analysis that helps to gauge the direction of the current trend of the market.

##### Types of moving averages-

There are several different types of moving averages available in the market(simple, weighted, time series, VIDYA, exponential) but professional traders use only two types of moving averages namely simple moving average, also called SMA and exponential moving average, also called EMA.

##### How is a moving average calculated?

A moving average is calculated by simply calculating the mean of the underlying asset over a period of n intervals. Mean is computed by dividing the sum of ‘n’ values by number of values ‘n’.

Let us understand this with the help of an example given below-

Let us take a population of 13 datasets. Out of that population we will select a sample of 10 datasets as shown below. The moving average for period 10 is given as-

But there is a slight difference between simple mean and moving averages. Moving averages have a moving tendency as the dataset grows. Hence if we add another number ‘5’ to the dataset and keep the period constant at 10 then the new moving average will discard the oldest data point which in this case is 15. The entire scenario is depicted as follows-

##### Simple Moving average (SMA)-

A simple moving average is the simple moving mean calculation that we talked about before. It divides the sum of the values by the total number of values. As said before, simple moving average also discards older values as newer values come into existence. The formula of SMA is same as mean or MA-

The calculation of SMA with period 10 is shown below

##### Plotting a Simple Moving Average on a chart-

The chart above is of Reliance Industries limited. There are two lines running on the chart, one is green and the other one is red. The green moving average is 20-SMA and the red moving average is 50-SMA. As you can see the red moving average is moving slower as compared to the green moving average with respect to fluctuations in price. This is because the green moving average is 20-SMA, it comprises of 20 data points only and has less lag whereas the red moving average is 50-SMA, it comprises of 50 data points and has more lag due to this.

##### Exponential Moving average (EMA)-

The exponential moving average is slightly different than SMA, its calculation differs a lot and that is why when EMA is plotted, it is slightly different than SMA. The formula for EMA is given below-

The most important difference between a simple moving average and an exponential moving average is that SMA treats all prices in the ‘n’ period same whereas EMA gives more weightage to the most recent prices out of ‘n’ prices.

##### Plotting an Exponential Moving Average on a chart-

The same company “Reliance” is taken in this example as well. The green line is the 20EMA and the red line is the 50EMA. The data points are also same as the previous example for SMA, but you’ll notice that SMA and EMA are different. Basically both EMA and SMA are used to give us buy or sell signals but EMA gives us the signal a few candles before only. This is due to the fact that it gives more weightage to the recently formed candles.

##### What do Moving Averages tell you and how to use them for trading?

Moving averages lag current price action because they are based on past prices; the longer the time period for the moving average, the greater the lag. Thus, a 200-day MA will have a much greater degree of lag than a 20-day MA because it contains prices for the past 200 days. The length of the moving average to use depends on the trading objectives, with shorter moving averages used for short-term trading and longer-term moving averages more suited for long-term investors. Using either SMA or EMA is the choice of the trader. The trader can use either SMA or EMA depending on his/her trading compatibility and his/her comfort.

Following are a few ways in which professional traders use the moving averages-

- The 50-day, 100-day and 200-day MAs are widely followed by investors and traders, with breaks above and below these moving averages considered to be important trading levels.

- Positional traders use the combination of 20-day, 50-day, 100 day and 200-day moving averages.
- If 20-MA crosses above the 50-MA it signals a bullish movement whereas if the 20-MA crosses below the 50-MA it signals a bearish movement. Both these crossovers are called
**Golden Crossovers.**

- Short term or intraday traders use combinations of 5-MA, 8-MA, 13-MA and 20-MA.
- Moving averages are also seen as important support and resistance levels from where the prices might bounce back.