De-Trended Price Oscillator
The Detrended Price Oscillator (DPO) removes the trend in prices - or other series - by subtracting a moving average of the price from the price.
Price, volume, etc. series that is coercible to xts or matrix.
Number of periods for moving average.
A function or a string naming the function to be called.
The number of periods to shift the moving average.
Other arguments to be passed to the
The Detrended Price shows cycles and overbought / oversold conditions.
A object of the same class as
x or a vector (if
try.xts fails) containing the DPO values.
DPO does not extend to the last date because it is based
on a displaced moving average. The calculation shifts the
shift periods, so the last
periods will be zero.
As stated above, the DPO can be used on any univariate series, not just price.
The following site(s) were used to code/document this
SMA, etc. for moving
average options; and note Warning section. See
MACD for a general oscillator.
1 2 3
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.