View source: R/technical_indicators.R
| calc_moving_average | R Documentation |
Calculates simple moving average for each column in the data.
calc_moving_average(data, window = 20)
data |
Data frame with Date column and price columns |
window |
Number of periods for moving average (default: 20) |
Data.table with moving average values
data("sample_prices_weekly")
ma20 <- calc_moving_average(sample_prices_weekly, window = 20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.