The MACD was developed by Gerald Appel and is probably the most popular price oscillator. The MACD function documented in this page compares a fast moving average (MA) of a series with a slow MA of the same series. It can be used as a generic oscillator for any univariate series, not only price.
Object that is coercible to xts or matrix; usually price, but can be volume, etc.
Number of periods for fast moving average.
Number of periods for slow moving average.
Number of periods for signal moving average.
Other arguments to be passed to the
The MACD function either subtracts the fast MA from the slow MA, or finds the rate of change between the fast MA and the slow MA.
A object of the same class as
x or a matrix (if
fails) containing the columns:
The price (volume, etc.) oscillator.
The oscillator signal line (a moving average of the oscillator).
The MACD is a special case of the general oscillator applied to price. The MACD can be used as a general oscillator applied to any series. Time periods for the MACD are often given as 26 and 12, but the function originally used exponential constants of 0.075 and 0.15, which are closer to 25.6667 and 12.3333 periods.
The following site(s) were used to code/document this
Moving Average Convergence/Divergence (MACD):
SMA, etc. for moving average
options; and note Warning section.
1 2 3 4 5
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.