The function computes a moving average of a vector.
MA(y, order, pad =NULL)
Arguments
y: a numeric vector
order: An integer. The order of the moving average. The function is defined such that order one returns y (see Examples).
pad: Defaults to NULL. If not NULL, all elements of the returned moving average with position smaller than order are replaced by the value of pad. Sensible values may be NA or 0.
Returns
Returns a vector of length length(y).
References
Gilli, M., Maringer, D. and Schumann, E. (2019) Numerical Methods and Optimization in Finance. 2nd edition. Elsevier. tools:::Rd_expr_doi("10.1016/C2017-0-01621-X")