MACD: Moving Average Convergence Divergence

Description Usage Arguments Value Author(s) References See Also Examples

Description

Computes the Moving Average Convergence Divergence (MACD), a trend-following momentum indicator that shows the relationship between two moving averages of a security’s price.

Usage

1
2
MACD(price, period = c(12, 26), signal_line = FALSE, slp = 9,
  k = NULL)

Arguments

price

A vector of past prices or an xts object.

period

c(sp,lp), a vector containing the length of the short period EMA and the length of the long period EMA.

signal_line

Boolean, if true the signal line using a period of slp is computed.

slp

Signal line period, the length of the period of the EMA used as signal line.

k

Weighting multiplier for the underlying Exponential MA, defualt if NULL.

Value

A vector or an xts object, accordingly to the input, of the same length of the input. If also the signal line is computed, a list with two elements: MACD and signal, or a multiple timeseries if it is an xts.

Author(s)

Giovanni Kraushaar <giovanni.kraushaar@usi.ch>

References

Murphy John J. (1999), Technical Analysis of the Financial Markets, New York Institute of Finance.

See Also

Moving average: MA.

Examples

1
2
# Compute Exponential Moving Average of Bank of America quotes
MACD( BAC$Close )

giovannikraushaar/TradingIndicatoR documentation built on May 20, 2019, 12:14 p.m.