addMA: Add Moving Average to Chart

addMAR Documentation

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

addTA

Examples

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

## End(Not run)

quantmod documentation built on May 29, 2024, 8:03 a.m.