DPO {TTR}R Documentation

De-Trended Price Oscillator

Description

The Detrended Price Oscillator (DPO) removes the trend in prices - or other series - by subtracting a moving average of the price from the price.

Usage

  DPO(x, ma = list("SMA", n=10), shift = ma$n/2+1, percent = FALSE)

Arguments

x Price, volume, etc. series to use.
ma A list whose first component is a string containing the moving average function name; additional parameters may also be specified as named components.
shift The number of periods to shift the moving average.
percent logical; if TRUE, the percentage difference between the slow and fast moving averages is returned, otherwise the difference between the respective averages is returned.

Details

The Detrended Price shows cycles and overbought / oversold conditions. Note the calculation shifts the results shift periods, so the last shift periods will be zero.

Value

A vector containing the DPO values.

Note

As stated above, the DPO can be used on any univariate series, not just price.

Author(s)

Josh Ulrich

References

The following site(s) were used to code/document this indicator:
http://www.fmlabs.com/reference/DPO.htm
http://www.equis.com/Customer/Resources/TAAZ/?c=3&p=48

See Also

See EMA, SMA, etc. for moving average options; and note Warning section. See oscillator for other oscillators.

Examples

  data(ttrc)
  price.dpo <- DPO(ttrc[,"Close"])
  volume.dpo <- DPO(ttrc[,"Volume"])

[Package TTR version 0.13-1 Index]