I looked up EMA on wikipedia, but I could not understand the explanation. Can anyone break it down with an example ?
1 Answer
EMA = (Price * Alpha) + (Previous EMA* (1 - Alpha))
Where Alpha = 2/(1+N)
AND N = Number of Trading sessions.
Suppose Reliance is trading at Rs. 1000 a share and its previous days EMA is 950, then to calculate EMA for 10 days, It would be like:-
(1000* (2/(1+10)) + (950 * (1-(2/1+10))
=(1000 * (2/11)) + (950 * (1-(2/11))
=(2000/11) + (950 * (1-(2/11)
=181.81 + (950 *0.8181)
=181.81+777.27
= 959.08
If you need to calculate EMA for 15 days, then just substitute N with 15.
Cheers!
-
Lets say I will be calculating EMA for today, but I do not have a previous day EMA, so I go back to calculate the previous days' EMA, so on and so forth until I reach a day D0, which is the beginning of the trade for that stock, so How would I get the EMA on day D0. Or is there another easy way to calculate the previous days' EMA? I am going to calculate based on yahoo stock data.– NRJOct 6, 2014 at 17:44
-
EMA means exponential moving AVERAGE. So on d0, the average will be the price of the stock. Oct 6, 2014 at 17:55
-
1I disagree with your comment, for purposes of a moving average, the average itself becomes meaningful on the Nth day. Oct 7, 2014 at 11:14
-
@JoeTaxpayer: Agreed; it isn't meaningful until the Nth day of data (if it's meaningful at all, which is open to debate). But for purposes of getting the calculation going, starting the calculation with PreviousEMA at the value on the earliest day you have records for and calculating forward from that is a reasonable approach.– keshlamOct 7, 2014 at 11:57