Calculate a 9 exponential moving average with an Excel formula

grid

Board Regular
Joined
Dec 4, 2009
Messages
56
Hello folks,

I have a question about how I can calculate a 9 exponential moving average with an Excel formula without using a script. It is important to me to know the formula for it. In this great forum I can only find a script for it that I don't need. I also searched the Internet and came across a website that explains the formula. I only see that the result is not correct or I am doing something wrong. To be more specific I have added an example that says exactly what I want :)

9ema formula.xlsx
ABCDE
1
2Meta close prices of 3-1-2023 until 28-1-2023
3
4DateClose
53-1-2023124,74
64-1-2023127,37
75-1-2023126,94
86-1-2023130,02
99-1-2023129,47
1010-1-2023132,99
1111-1-2023132,89
1212-1-2023136,71
1313-1-2023136,98In D17 is a 9ema of 17-1-2023 i tried to make by myself by replacing 12 in the formula with 9 but I'm not sure if that's correct.
1416-1-2023135,36I need here the correct 9ema like any charting platform would display. In this case it would be 132,95. Could somebody help me with the correct Excel formula? I don't need a script because I need to have it working for example with Google Sheets too.
1517-1-2023135,36
1618-1-2023133,02131,8208333133,6444444
1719-1-2023136,15132,486859134,14555569ema on charting platform is 132,95
1820-1-2023139,37
1923-1-2023143,27
2024-1-2023139,37In C17 is a 12ema that is calculated with the help of: https://investexcel.net/how-to-calculate-ema-in-excel/
2125-1-2023141,5
2226-1-2023147,3
2327-1-2023151,74
2428-1-2023147,06
Blad1
Cell Formulas
RangeFormula
C16C16=AVERAGE(B5:B16)
D16D16=AVERAGE(B8:B16)
C17C17=B17*2/(12+1)+C16*(1-2/(12+1))
D17D17=B17*2/(9+1)+D16*(1-2/(9+1))


Here is the link that has a script to calculate the 9 EMA: Exponential moving average using array in Excel VBA

Thank you very much!

grid
 
Last edited:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Your equation for the ema is correct, however to understand why your answer is different to the trading platform answer you need to understand that the Exponential Moving Average is an infinite series so, what value you get depends totally on not just what the starting value is but also when you start the ema calculation. The platform value has probably be running for years so you would need to put many years of values in to get exactly the same answer. ( actually 90 days is probably sufficient for a 9 day ema) If you put the value from the platform into D16 instead of your average and then check your value against the value from the platform in D17 they should be the same.
 
Upvote 0
Hello offthelip,

So I need the last 90 close prices to get the accurate 9ema? I could get them. Anyways sorry for the late response and thanks for your answer.

Greets,

grid
 
Upvote 0
I have always used a factor of 10 as being adequate, however it really depends on how much the data you are calculating the moving average from varies. As an example if you put the value 10 in A2 to a45 and the value 50 in A46 to A150 and then put the 9 day moving average calculation in column B starting with zero in B2. You can see that on row 45 ( the last row with 10 in it) the EMA hass got to 9.999319435 which is with 0.007% of the target, after 90 days with target of 50 the values has got to 49.99825772, which is within 0.0003% of the target, both of these are very close. However if you now type the value 20 into A80 the value in B90 changes to 49.35401263 this is within 0.13% much further away. So how long you need to "stabilise" your ema is up to your judgement . I suggest you do a bit of testing. If it is convenient to download 90 days get all the data , then make comparisons between the values you get from starting with the full 90 days, then the last 60 days then the last 30 days and see what sort of difference you get and whether the difference is tolerable.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top