Detrended price oscillator


The detrended price oscillator is an indicator in technical analysis that attempts to eliminate the long-term trends in prices by using a displaced moving average so it does not react to the most current price action. This allows the indicator to show intermediate overbought and oversold levels effectively.
The detrended price oscillator is a form of price oscillator, like the "percentage price oscillator" and the "absolute price oscillator" both of which are forms of Gerald Appel's MACD indicator. The APO is an equivalent to the moving average convergence/divergence indicator while the PPO is an improved alternative to the APO or the MACD for use when a stock's price change has been large, or when comparing the oscillator behavior for different stocks which have significantly different prices.
Although these are not so commonly used with the DPO, for the other price oscillators, as for the MACD, a signal line is frequently generated for the price oscillators by taking an exponential moving average of the price oscillator values and plotting the two lines together. A histogram can also be generated for the price oscillators, if desired, just as is done for the MACD indicator.

Formula and calculation

The DPO is calculated by subtracting the simple moving average over an "n" day period and shifted n/2+1 days back from the price.
To calculate the detrended price oscillator:
Decide on the time frame that you wish to analyze. Set "n" as half of that cycle period.
Calculate a simple moving average for n periods.
Calculate
Subtract the moving average, from days ago, from the closing price:
DPO = Close - Simple moving average