macd4 {ttrTests}R Documentation

MACD oscillator

Description

A new way of computing the MACD oscillator where a fourth parameter is allowed to vary. Typically this parameter is fixed at 1 arbitrarily.

Usage

macd4(x, params = c(12, 26, 1, 9))

Arguments

x A univariate series
params First parameter - the 'fast' average parameter Second parameter - the 'slow' average parameter Third parameter - the new parameter, indicating a 'fast' averaging of the MACD line instead of the typical choice of the MACD line itself Fourth parameter - the 'slow' averaging for the MACD signal line

Details

The standard interpretation of the MACD is a 'crossover' rule, i.e. when the MACD oscillator crosses from positive to negative, that's a sell signal, and vice versa.

Value

A univariate series computed as the difference between the MACD line and the MACD signal line. "macd4" replaces the MACD line with a fast average of the MACD line.

Author(s)

David St John

References

http://cran.r-project.org/web/packages/TTR/ http://en.wikipedia.org/wiki/MACD

Examples


spData <- as.vector(getYahooData("SPY",start="20060101",end="20081231")[,"Close"])
oscillator <- macd4(spData)
plot(oscillator)


[Package ttrTests version 1.4 Index]