Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

addMA

Add Moving Average to Chart


Description

Add one or more moving averages to a chart.

Usage

addSMA(n = 10, on = 1, with.col = Cl, overlay = TRUE, col = "brown")

addEMA(n = 10, wilder = FALSE, ratio=NULL, on = 1,
       with.col = Cl, overlay = TRUE, col = "blue")

addWMA(n = 10, wts=1:n, on = 1, with.col = Cl, overlay = TRUE, col = "green")

addDEMA(n = 10, on = 1, with.col = Cl, overlay = TRUE, col = "pink")

addEVWMA(n = 10, on = 1, with.col = Cl, overlay = TRUE, col = "yellow")

addZLEMA(n = 10, ratio=NULL, on = 1, with.col = Cl, overlay = TRUE, col = "red")

Arguments

n

periods to average over

wilder

logical; use wilder?

wts

a vector of weights

ratio

a smoothing/decay ratio

on

apply to which figure (see below)

with.col

using which column of data (see below)

overlay

draw as overlay

col

color of MA

Details

see the appropriate base MA functions in TTR for more details and references.

Value

A moving average indicator will be draw on the current chart. A chobTA object will be returned silently.

Author(s)

Jeffrey A. Ryan

References

see MovingAverages in TTR written by Josh Ulrich

See Also

Examples

## Not run: 
addSMA()
addEMA()
addWMA()
addDEMA()
addEVWMA()
addZLEMA()

## End(Not run)

quantmod

Quantitative Financial Modelling Framework

v0.4.18
GPL-3
Authors
Jeffrey A. Ryan [aut, cph], Joshua M. Ulrich [cre, aut], Wouter Thielen [ctb], Paul Teetor [ctb], Steve Bronder [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.