[R-SIG-Finance] exponential moving avg appears to use future data
BBands
bbands at gmail.com
Sat Jan 19 16:18:31 CET 2008
On Jan 18, 2008 10:09 AM, John Putz <johnputz3655 at yahoo.com> wrote:
> Hello,
>
> As usual, I'm not sure if this is the correct list to ask this, but it appears that the exponential moving average functions (emaTA and EWMA) use future information to calculate the moving average for periods prior to the kick-in of the weightings. E.g. at one point it sets:
>
> ylam[1] = mean(y[1:startup])
>
> which, i am not quite able to trace through the rest of the function calls, but seems to be having the effect of starting the moving average calculation based on the average of future prices. Am I correct in this? If so, is there a reason why this might work that way?
What you are seeing in a method of finding a seed value for the ema.
There are many methods, each with its own pros and cons. In any case,
you need to respect an run-in period after which the seeding method is
largely moot.
The article here is not a bad intro:
http://en.wikipedia.org/wiki/Weighted_moving_average#Exponential_moving_average
jab
--
John Bollinger, CFA, CMT
www.BollingerBands.com
If you advance far enough, you arrive at the beginning.
More information about the R-SIG-Finance
mailing list