Detrended Price Oscillator (DPO)
What Is the Detrended Price Oscillator (DPO)?
The Detrended Price Oscillator (DPO) is an indicator designed to remove trend from price and make it easier to identify cycles. DPO does not extend to the last date because it is based on a displaced moving average. However, alignment with the most recent date is not an issue because DPO is not a momentum oscillator. Instead, DPO is used to identify cycle highs/lows and estimate cycle length.

Calculating DPO
The DPO is essentially comparing price with an SMA, but instead of comparing the latest price, it compares the SMA with the price that is right in the middle of the SMA's lookback period.
The X in this formula refers to the number of periods used to calculate the Detrended Price Oscillator. A 20-day DPO would use a 20-day SMA that is displaced by 11 periods {20/2 + 1 = 11}. This displacement shifts the 20-day SMA 11 days to the left, which places it in the middle of the lookback period. The DPO(20) value for the bar in the middle of that lookback period would be price minus the 20-day SMA from 11 days in the future.
Displacing the Moving Average
The moving average displacement actually centers the moving average. Consider a 20-day simple moving average offset 11 days to the left. There are 10 days in front of the moving average, 1 day at the moving average and 9 days behind the moving average. In reality, this moving average is in the middle of its lookback period. Roughly half the prices used in the calculation are to the right and half are to the left.
The chart below shows the S&P 500 ETF (SPY) with a 20-day SMA (green dotted line) and a 20-day SMA offset 11 days to the left (pink line). The ending values are the same (768.10), but the pink moving average ends on August 12th and the green moving average ends on August 27th, which is the last date on the chart. Also, notice how the “centered” moving average (pink) more closely follows the actual price plot.

Comparing Price with the Displaced SMA
The Detrended Price Oscillator (DPO) measures the difference between a moving average and a price in the middle of the moving average's lookback period. Keep in mind that DPO is itself displaced to the left; no DPO values can be calculated based on future SMA values that do not exist yet.
The indicator oscillates above/below zero as prices move above/below the displaced moving average. The chart below shows the S&P 500 ETF (SPY) with a 20-day moving average displaced -11 days. 20-day DPO is shown in the indicator window. Notice how DPO is positive when price is above the displaced moving average and negative when price is below the displaced moving average.

Interpreting DPO
Even though this indicator looks like a classic oscillator, it is not designed for momentum signals. The displaced moving average is set in the past, which is why the DPO is shown in the past. Even with this displacement, DPO peaks and troughs can be used to estimate cycle length. DPO filters out the longer trends to focus on shorter cycles.
The chart below displays the DPO (20) in the indicator window. Looking at the peaks and troughs, you can see a 10-day cycle with the lows in mid-December, early January, mid-January, early February, and mid-February. There are roughly 10 trading days between these lows. The cycle missed in March.

To Shift or Not to Shift
It is possible to displace the Detrended Price Oscillator (DPO) with a horizontal shift to the right. If DPO is set at 20, then an 11-period shift is needed to place it in line with the most recent price. This displacement number comes from the formula at the top (20/2 + 1) = 11. While shifting may seem like a good idea, it really defeats the purpose of this indicator, which is to identify cycles.
In the chart below, the two indicator panels show a normal DPO(20) and a DPO(20) that has been shifted forward 11 days. The shifted-forward DPO(20) does not align well with current prices. While you could still use it to determine the average length of the cycles, it would not accurately show where a given bar is in the cycle.

In the example below, the last value for DPO (20,11) is still based on the close 11 days ago and the value of the moving average. Notice that DPO turned negative as price moved below the centered moving average 11 days ago (orange box). A positively-displaced DPO simply does not match current price action.
In contrast to the shifted DPO, price has been below the 20-day SMA the last 15 days. The Percentage Price Oscillator (PPO) is better suited to identify overbought and oversold levels. PPO(1,20,1) shows the percentage difference between current price and the normal 20-day exponential moving average. Overbought/oversold conditions occur when prices get relatively far from their 20-day EMA.

The Bottom Line
The Detrended Price Oscillator shows the difference between a simple moving average and a price in the middle of the SMA's lookback period. In contrast to other price oscillators, DPO is not a momentum indicator. Instead, it is simply designed to identify cycles with its peaks and troughs. Cycles can be estimated by counting the periods between peaks or troughs. Users can experiment with shorter and longer DPO settings to find the best fit.
Charting with DPO
Using with SharpCharts
The Detrended Price Oscillator (DPO) can be found in the indicator list on SharpCharts. The default parameter is 20 periods, but this can be adjusted accordingly to find cycles. Users can also add another parameter separated by a comma. A comma plus a positive number shifts the indicator to the right. DPO can be positioned above, below, or behind the price plot.
Click here for a live version of the chart.


Using with StockChartsACP
This indicator can be added from the Chart Settings panel for your StockChartsACP chart. The indicator can be positioned above, below, or behind the security's price plot.

Click here for a live version of this chart.
By default, this indicator is calculated using 20 periods. This parameter can be adjusted to meet your technical analysis needs.
Scanning for DPO
While StockCharts members can scan for stocks based on Detrended Price Oscillator values, the Detrended Price Oscillator is not well suited for scans, because the indicator is based on an offset moving average. A 20-day DPO correlates to a price 11 days ago, which is not practical for scans.
DPO is also based on absolute levels, making it difficult to use for comparative purposes. A $100 stock will have a much wider DPO range than a $20 stock, and will typically have much larger DPO values.
Last updated
Was this helpful?

