Using moving average method to profile stock data

movingAverage(data, window, newColname)

Arguments

data

xts a time series object

window

numeric

newColname

character

Value

xts a time series object

Examples

quantmod::getSymbols("AAPL")
#> [1] "AAPL"
moving_avg_AAPL <- movingAverage(AAPL, 300, paste("movingAverage", colnames(AAPL), sep="_"))