**In this article, we will focus on the accurate professional setting and calculations of the indicator “Moving Average”.** The calculation formula

This is the general formula for calculating of the moving average:

Where: — the value of the weighted moving average at the point t;

**n**—he number of values of the original function for the calculation of the moving average;- — the normalized weight (weighting coefficient) of the t-i value of the initial function;
- — the value of the original function at the time i intervals remote from the current time.

Normalizing of the weighting coefficients means that:

The weighting coefficient can be counted like this:

where — is the weighted coefficient of the “t-i” value of the original function.

The value of the function is usually taken using the quote of the closing price. Moving averages can be reconstructed on the basis of the other points (opening quotes, max, min, averaged values, etc.). This can be done in a separate technical analysis window.

### Special cases

The values of the weighting coefficients determine the type of the moving average.

**1. Simple moving average (SMA).**

The number 1 is always used as a weight.

1. The final formula is equal to the simple average of the arithmetic values:

**2. Exponential moving average (EMA).**

An exponential function is always used as a weight. Weights decrease exponentially and are never equal zero. It is defined by the following formula:

The coefficient can be chosen arbitrarily in the range from 0 to 1.

For example, it is expressed by means of the value of the smoothing window:

Thus, the exponential moving average reacts to price changes more smoothly.

### Example of calculations

Let’s take several values of the function (for example, the quotes for closing by day candles) and calculate the values of different moving averages. Suppose we have 5 prices (days): 80, 106, 85, 87, 93.

Let’s calculate the 3 point moving averages and see how they differ.

**SMA**

The first day: SMA (3) = (80 + 106 + 85) / 3 = 90.3

The second day: SMA (3) = (106 + 85 + 87) / 3 = 92.6

The third day: SMA (3) = (85 + 87 + 93) / 3 = 88.3

**EMA**

The first day: EMA (3) = EMA (2) + K * [85 – EMA (2)]

What we need for calculation:

• EMA (2) = EMA (1) + K * [106-EMA (1)]

• EMA (1) = EMA (0) + K * [80-EMA (0)] = 80

EMA (2) = 80 + 2/3 * [106-80] = 97.33

EMA (3) = EMA (2) + K * [85 – EMA (2)]

The first day: EMA (3) = 97.33 + 1/2 * [85 – 97.33] = 91.165

The second day: EMA (3) = 91,165 + 1/2 * [87 – 91,165] = 89,083

The third day: EMA (3) = 89,083 + 1/2 * [93 – 89,083] = 91,042

The graph shows that the EMA (the red dotted line) smoothes the strong deviations in the price, and the SMA (the black line) is guided by them. **Other MA types**

There is quite a large number of different types of moving averages:

*• Weighted moving average (WMA).*

*• The volumetric moving average (VMA).*

*• Kaufman Adaptive Moving Average (KAMA).*

*• Adaptive moving average of Tushara Chanda (VIDYA).*

*• Double exponential moving average (DEMA).*

*• Triple Exponential Moving Average (TEMA).*

*• Modified Brown Moving Average (MMA).*

*• Jurik Moving Average (JMA).*

*• Smoothed moving average (SMMA).*

*• Simple moving median (SMM).*

*• Cumulative moving average (CMA).*

Moving averages are one of the simplest, most effective and important indicators for market analysis. Many other indicators are based on them:

*• the Bollinger Bands are based on SMA with a period of 20.*

*• the MACD is based on EMA.*

*• the “Alligator” is based on SMMA, etc.*

That is why one should start getting familiar with the work of other technical analysis indicators with moving averages.

**Risk warning:**