powered by
Calculates simple moving average for each column in the data.
calc_moving_average(data, window = 20)
Data.table with moving average values
Data frame with Date column and price columns
Number of periods for moving average (default: 20)
data("sample_prices_weekly") ma20 <- calc_moving_average(sample_prices_weekly, window = 20)
Run the code above in your browser using DataLab