# Moving Average

## Definition

Moving average is an indicator used in technical analysis to gauge the direction of the current trend in the prices of a particular security. Moving average is not a predictor of prices, it is based on past prices. In fact, it filters out too many fluctuations in prices and provides a concrete definition to the trend.

### Types of Moving Averages

There are two types of Moving Averages

1. Simple Moving Average
2. Exponential Moving Average

### Simple Moving Average

The Simple Moving Average is a form of the moving average which is calculated by adding the closing prices of stock during specific time periods and dividing the sum by the number of time periods in the calculation average; or in simple terms, the average price over a particular time period.

The formula of Simple Moving Average In this formula An refers to the closing stock prices at period n, and n is the total number of periods.

Let’s try to understand this with an example.

Consider the daily closing prices in a 5-day moving average. Here, the first day of the moving average covers the last 5 days. As the days progress, the previous day’s data point is dropped and replaced by a new data point. So the second day of the MA will drop the first data point (11) and add a new one (16). The third day continues by dropping the first data point (12) and adding a new one (17).

Thus, in the example above, prices rise from 11 to 17 in a span of 7 days. You can also notice that the MA rises from 13 to 15 within 3 days. Additionally, the price of each moving average is just below the last one. This is because prices in the previous four days were lower and this causes the moving average to lag.

## Exponential Moving Average

While the Simple moving average is based on past data, the Exponential Moving average stresses more on recent prices. The weighting applied to recent prices depends on the number of periods. This difference between SMA and EMA, makes the latter more efficient in responding to new information. In an EMA, the calculation depends on the EMA calculations of all the previous days. You need at least more than 10 days of data to calculate Exponential moving average.

### Exponential Moving Average Formula There are three steps to calculating an exponential moving average.

1. compute the simple moving average
2. calculate the multiplier for weighting the EMA. this is also called smoothening, with a formula of [2 ÷ (selected time period + 1)].
3. calculate the exponential moving average for each day between the first EMA value and current value, using the price, the multiplier, and the previous period’s EMA value.

Let’s understand EMA with an example.

Consider a 10 days time period for calculating Exponential Moving average. An exponential moving average for a 10-day time period applies an 18.18% weighting to the latest price. The weighting after applying to the most recent price is (2/(10+1) = 18.18%).