Let’s have a look at how you can set and calculate the Moving Average indicator professionally and accurately.
Calculations
The moving average can be calculated by using the following formula:
Where n is the number of values the function for the moving average calculation originally contained.
Calculating the weighting coefficient is done as follows:
Although the function’s value is normally taken by using the closing price, a moving average can also be calculated by using other points, such as the opening value, min, max, averaged value, etc. It is possible to do this in another technical analysis window.
Special cases
1. SMAs (Simple moving averages)
In this special case, the weight is always taken as 1.
2. EMAs (Exponential moving averages).
Exponential moving averages are generally expressed by using the value in the smoothing window, for example:
This results in EMAs reacting to changes in price much more smoothly than what SMAs do.
Calculation Examples
In this example, we’ll calculate 3 point moving averages for a SMA and an EMA to see the difference between them. We’ll be using the data from the graph below.
SMA
Day 1: SMA3 = (80 + 106 + 85) / 3 = 90.3
Day 2: SMA3 = (106 + 85 + 87) / 3 = 92.6
Day 3: SMA3 = (85 + 87 + 93) / 3 = 88.3
EMA
Day 1: EMA3 = EMA2 + K * [85 – EMA2]
The following is needed for the calculation:
- EMA2 = EMA1 + K * [106-EMA1]
- EMA1 = EMA0 + K * [80-EMA0] = 80
EMA2 = 80 + 2/3 * [106-80] = 97.33
EMA3 = EMA2 + K * [85 – EMA2]
Day 1: EMA3 = 97.33 + 1/2 * [85 – 97.33] = 91.165
Day 2: EMA3 = 91,165 + 1/2 * [87 – 91,165] = 89,083
The graph shows that the SMA (black line) guides the EMA (red dotted line) to smooth the strong price deviations.
Other types of Moving Averages
There numerous other types of moving averages:
- VMA – Volumetric moving average.
- WMA – Weighted moving average.
- VIDYA – Adaptive moving average of Tushara Chanda.
- KAMA – Kaufman Adaptive Moving Average.
- DEMA – Double exponential moving average.
- MMA – Modified Brown Moving Average.
- TEMA – Triple Exponential Moving Average.
- JMA – Jurik Moving Average.
- SMM – Simple moving median.
- SMMA – Smoothed moving average.
- CMA – Cumulative moving average.
For doing market analysis, moving averages are the most effective, important and simplest indicators. There are many other indicators that are in fact based on moving averages:
- “Alligator” is based on SMMA.
- MACD is based on EMA.
- Bollinger Bands are based on SMA with a period of 20.
This is a good reason why traders should get familiar with how other technical analysis indicators work with moving averages.