DPO: De-Trended Price Oscillator

Description Usage Arguments Details Value Note Author(s) References See Also Examples

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

1
2
  DPO(x, n = 10, maType, shift = n/2 + 1, percent = FALSE,
    ...)

Arguments

x

Price, volume, etc. series that is coercible to xts or matrix.

n

Number of periods for moving average.

maType

A function or a string naming the function to be called.

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.

...

Other arguments to be passed to the maType function.

Details

The Detrended Price shows cycles and overbought / oversold conditions.

Value

A object of the same class as x or a vector (if try.xts fails) containing the DPO values.

Note

DPO does not extend to the last date because it is based on a displaced moving average. The calculation shifts the results shift periods, so the last shift periods will be zero.
As stated above, the DPO can be used on any univariate series, not just price.

Author(s)

Joshua 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
http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:detrended_price_osci

See Also

See EMA, SMA, etc. for moving average options; and note Warning section. See MACD for a general oscillator.

Examples

1
2
3
data(ttrc)
priceDPO <- DPO(ttrc[,"Close"])
volumeDPO <- DPO(ttrc[,"Volume"])

TTR documentation built on April 15, 2017, 8:31 a.m.

Related to DPO in TTR...