Two Plus Two Older Archives

Two Plus Two Older Archives (http://archives2.twoplustwo.com/index.php)
-   The Stock Market (http://archives2.twoplustwo.com/forumdisplay.php?f=28)
-   -   Exponential Moving Average (http://archives2.twoplustwo.com/showthread.php?t=1471)

04-18-2002 02:07 PM

Exponential Moving Average
 


From Yahoo! Finance :


"An exponential moving average differs slightly from a simple moving average in that it gives extra weight to more recent price data. This allows investors to track and respond much more quickly to recent price trends that takes more time to appear on an SMA. The formula for an EMA is: EMA = price today * K + EMA yest * (1-K) where K = 2 / (N+1)."


As everyone seems to be using EMA's, could someone please explain why, for example, a 10% EMA is associated with 19 days? I am wondering where the familiar formula, Percentage = 2/(N + 1), comes from.



04-18-2002 02:44 PM

the formula I prefer
 


My opinion is that exponentials decline far too quickly. Meaning, the price 2 days ago has almost no weight compared to the price today.


Average = 0; Days = 0;

While Days

04-18-2002 02:46 PM

whoops, I forgot the less-than/greater-than thing
 


My opinion is that exponentials decline far too quickly. Meaning, the price 2 days ago has almost no weight compared to the price today.


Average = 0; Days = 0;

While Days (is less than) 10 begin


Average = Average + price(Today - Days)/(Days + 1);


Days = Days + 1;

end;


In this example*, the price two days ago would have only 1/3 the weight of the price today. Now suppose we substituted


Average = Average + price(Today - Days)*(10-Days);


The price 2 days ago would have 8/10 the weight of the price today. For whatever reason - and there is a hypothetical reason which I won't drudge up right now - this seems to work better for most purposes.


eLROY


*This code will not produce any useful result in any interpreter, compiler, or API I know of:) It might not even be right. But writing this warning was easier than making this warning unnecessary.



04-18-2002 10:12 PM

Re: whoops, I forgot the less-than/greater-than th
 


I wouldn't get too worked up about it. I don't think EMA or any other trendline was really created to be predictive in anyway. Trendlines generally are used to show where stock sentiment is or was at any given time and also can at times point to overvalued or undervalued positions, although just a trendline should never be relied on for that. Further when using them I would generally cover a longer time frame because short term charts are best left for short term traders.

04-18-2002 11:15 PM

thanks...but
 


Thanks eLROY and wildbill for the replies. However, I would be grateful if you could answer me why k = 2/(n+1), and not, say, 3/(n+2)? Some of the smartest people I know who are into technical analysis don't seem to know.



04-19-2002 07:48 AM

Re: thanks...but
 


If we use 19, then 2/(n + 1) = 2/20 = 1/10 = 10% weight for the most recent data point.


My guess is that 2 is just the smallest number you can put in the numerator. If you used 1/(n + o), maybe the weight of the current number would not be "exponential."


But you don't want to use the same formula as everyone else anyway, unless by design.


eLROY



04-20-2002 12:04 AM

Statistical information
 


It looks like the formula is intended to equate the statistical information of (a) the N day exponential moving average, and (b) the N day (ordinary) average. In particular, if we assume that the prices are independently and identically distributed with variance V, then the variance of both moving averages is equal to V/N.

04-20-2002 11:20 AM

r u sure?
 


I would bet you are sure.


But since no money is at risk...


Suppose we have a 10-day ordinary.


On each day, the average moves by, like, 10% times a typical 10-day move. Right?


Using the exponential - what does 2/11 - hmmm...


Okay, suppose we also used 3/(n + 2). What would be the relative variance of the two moving averages then? And what would be the variance of either, relative to the price?


Over any given number of periods, is the trendy moving average likely to have moved more, or less than the jumpy price or 1-day? Always the same amount, right?


eLROY

04-20-2002 12:29 PM

Easy to verify recursively
 


I originally solved this by using the "John von Neumann method" (explicitly summing the infinite series). But it's easier to solve recursively. We are looking for the value of K such that the variance of the EMA is equal to V/N (the variance of the ordinary N day moving average). From the formula for EMA, we have:


Var[EMA(t)] = K^2 Var[P(t)] + (1-K)^2 Var[EMA(t-1)]


The price variance is V and the variance of the ordinary N day moving average is V / N, so we want to solve for K in the equation:


V/N = K^2 V + (1-K)^2 (V/N)


Try solving this and see what you get.

04-20-2002 01:00 PM

I see - trendy things have lower variance [img]/images/smile.gif[/img] *NM*
 





All times are GMT -4. The time now is 06:30 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.