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.
1 
x 
Object that is coercible to xts or matrix; usually price, but can be volume, etc. 
nFast 
Number of periods for fast moving average. 
nSlow 
Number of periods for slow moving average. 
nSig 
Number of periods for signal moving average. 
maType 
Either:

percent 
logical; if 
... 
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 try.xts
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.
Joshua Ulrich
The following site(s) were used to code/document this
indicator:
Moving Average Convergence/Divergence (MACD):
http://www.fmlabs.com/reference/MACD.htm
http://www.equis.com/Customer/Resources/TAAZ/?c=3&p=66
http://linnsoft.com/tour/techind/macd.htm
http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_average_convergence_divergence_macd
Price Oscillator:
http://www.fmlabs.com/reference/PriceOscillator.htm
http://www.fmlabs.com/reference/PriceOscillatorPct.htm
http://www.equis.com/Customer/Resources/TAAZ/?c=3&p=94
http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:price_oscillators_ppo
Volume Oscillator:
http://www.fmlabs.com/reference/PVO.htm
http://www.equis.com/Customer/Resources/TAAZ/Default.aspx?c=3&p=122
See EMA
, SMA
, etc. for moving average
options; and note Warning section.
1 2 3 4 5 
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.