An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20070922/1a0888e1/attachment.pl
moving average
2 messages · Alexander Moreno, Patrick Burns
Asking if your code does what you think it does is an excellent thing to do. In this case I would try it out on something like: A <- rnorm(30) A[15] <- 100 And then see if the result is what I hoped. Patrick Burns patrick at burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and "A Guide for the Unwilling S User")
Alexander Moreno wrote:
Hi, If I want to make a 12 day exponentially weighted moving average using only past data on a time series A, will this do the trick? filter(A,exp(-c(1:12)/12)/sum(exp(-c(1:12)/12)),method="convolution",sides=1) i.e. does it include today in the calculation? Or do I need to do this (which is what I think)? filter(A,c(0,exp(-c(1:12)/12)/sum(exp(-c(1:12)/12))),method="convolution",sides=1) I'm trying to play around with an MACD model and want to see the daily returns of days where the 12-day moving average < 26 day moving average and 12-day > 26 day Thanks, Alex [[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.