Simple and exponential moving averages calculation formula.
Every trader needs not just to know how to use an indicator but also to understand how it is built and what it shows.
There is just one way of the simple moving average formula calculation:
SMA = (P1 + P2 + P3 + … + Pn)/N
Where P stands for “price” and N is the quantity of days for which we need to find the calculation.
Nowadays there is no need to calculate this formula by yourself because all the calculation will be made automatically by Forex Tester or by your live trading terminal. But still it is very useful to know what the average is all about. To tell about it in a simple way, you just need to know the following:
- You set the parameter of the Moving Average (let it be 10 as an example)
- Forex Tester will immediately calculate the sum of the previous 10 prices and divide it by 10
- This action will be done for every single bar except the first 10 bars on the chart.
It is convenient to get an aggregate information about each bar (candlestick) with the help of Forex Tester’s Data Window. There you will see the date, time, open, high, low and close prices, volumes, bar index and all the values of the indicators that are going through this particular bar.
Moving average formula calculation described on a real market example.
# of the bar | The close price | SMA | EMA | Values for MAs | Quantity of bars |
---|---|---|---|---|---|
1 | 1.14742 | ||||
2 | 1.14925 | ||||
3 | 1.14969 | ||||
4 | 1.14884 | ||||
5 | 1.14832 | ||||
6 | 1.14749 | ||||
7 | 1.14728 | ||||
8 | 1.14728 | ||||
9 | 1.14755 | ||||
10 | 1.14679 | ||||
11 | 1.14826 | 1.14808 | 1.14826 | Bar 1 – Bar 10 | 10 |
12 | 1.15130 | 1.14828 | 1.14881 | Bar 2 – Bar 11 | 10 |
13 | 1.14721 | 1.14803 | 1.14852 | Bar 3 – Bar 12 | 10 |
14 | 1.14613 | 1.14766 | 1.14809 | Bar 4 – Bar 13 | 10 |
15 | 1.14670 | 1.14760 | 1.14783 | Bar 5 – Bar 14 | 10 |
16 | 1.14838 | 1.14769 | 1.14793 | Bar 6 – Bar 15 | 10 |
17 | 1.14855 | 1.14782 | 1.14805 | Bar 7 – Bar 16 | 10 |
18 | 1.14872 | 1.14796 | 1.14817 | Bar 8 – Bar 17 | 10 |
19 | 1.14927 | 1.14813 | 1.14837 | Bar 9 – Bar 18 | 10 |
20 | 1.15048 | 1.14867 | 1.14875 | Bar 10 – Bar 19 | 10 |
The formula for the Exponential Moving Average is not that simple. At first we need to use this moving average formula for finding out the multiplier which differs for every period of this line.
M= 2/ (N+1)
To calculate moving average with a 10 period parameter you should find the multiplier first:
M=2/ (10+1) = 0.1818
Period | Multiplier | Percentage |
10 | 0.1818 | 18.18% |
11 | 0.1666 | 16.66% |
12 | 0.1538 | 15.38% |
13 | 0.1429 | 14.29% |
14 | 0.1333 | 13.33% |
15 | 0.125 | 12.5% |
16 | 0.1176 | 11.76% |
17 | 0.1111 | 11.11% |
18 | 0.1053 | 10.53% |
19 | 0.1 | 10% |
20 | 0.0952 | 9.52% |
The final formula for EMA calculating will look like this:
EMA = (Price of this bar – EMA of the previous bar) * Multiplier + EMA of the previous bar.