[R-SIG-Finance] Standard Deviations using Sliding window?
Robert Nicholson
robert.nicholson at gmail.com
Fri Mar 5 03:15:07 CET 2010
Here was a naive attempt to do standard deviation with sliding window
>require(quantmod)
>getSymbols("AAPL")
> AAPL$STDDEV = sd(Cl(AAPL), 20)
> AAPL$SMA = SMA(Cl(AAPL), 10)
> AAPL
apparently sd doesn't work with a sliding window where was SMA does so it seems I need to look at SMA to see how the sliding window code is handled and write my own sd that uses a sliding window?
the SD columns up the same for all rows which isn't what I want.
More information about the R-SIG-Finance
mailing list