Learn R Programming

quantmod (version 0.4.20)

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")

Value

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

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

Author

Jeffrey A. Ryan

Details

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

References

see MovingAverages in TTR written by Josh Ulrich

See Also

addTA

Examples

Run this code
if (FALSE) {
addSMA()
addEMA()
addWMA()
addDEMA()
addEVWMA()
addZLEMA()
}

Run the code above in your browser using DataLab