How to add a SMA(21,Close) column to a data frame

Does anyone know how to calculate a simple moving average of 21 periods based on the close price from a stock data frame and add the SMA-21 to the data frame.

I don't know what SMA-21 is but for moving averages I would use the slider package.

Sorry, The SMA-21 is the simple moving average for the last 21 periods based on the stock close price from the TTR package using the get_symbols method.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.