The detrended price oscillator (DPO) is designed to filter out the underlying trend to highlight the underlying cycles of price movement. Detrended prices should allow the trader to identify cycles and overbought/oversold levels more easily. The DPO is used to remove trend from price so you can do so more effectively.

The DPO typically is not aligned with the most current prices. It is shifted backward in time; in practice, it is shown that this helps to remove the current trend. Because the DPO is offset to the past, it is not considered a momentum oscillator. It only measures past prices against a simple moving average as a way to gauge a cycle’s high/low range, as well as the cycle’s typical duration.

Long-term cycles are made up of a series of short-term cycles. Analyzing these shorter-term components of the long-term cycles can be helpful in identifying major turning points in the longer-term cycle. The DPO helps with this as well.

### Calculation

To calculate the DPO, you specify a time period. Cycles longer than that period are the ones that are removed from price, and cycles shorter than that period are the ones that remain.

First, create an n-period simple moving average (where “n” is the number of periods that you desire in the moving average). Now, subtract the moving average calculation from so many days ago ((n / 2) + 1) from the closing price.

The result is the DPO.

**DPO = Close – (Moving Average ((n / 2) + 1)) days ago)**

The distance the oscillator is shifted depends on the calculation (n / 2) + 1. For example, a 20-day DPO would use a 20-day simple moving average (SMA) that is displaced by 11 periods ((20 / 2) + 1 = 11). This displacement shifts the 20-day SMA 11 days to the left, which puts it in the middle of the look back period.

The value of the 20-day SMA is then subtracted from the price in the middle of this look back period. In short,

DPO (20) equals the price from 11 days ago minus the 20-day SMA. The DPO is most effective with indicator periods of 21 days or less.

### Trading with the DPO

There are several ways to analyze stocks with the DPO.

1. The real power of the DPO is in identifying turning points in longer cycles:

- When it shows a higher trough, expect an upturn in the intermediate cycle.
- When it experiences a lower peak, expect a downturn in the intermediate cycle.

2. You can set overbought and oversold levels based on the observation of past price behavior:

- Go long when the DPO crosses below and then back above the oversold level.
- Go short when the DPO crosses above and then back below the overbought level.

3. Use the DPO to identify the direction of the trend, and then only trade in that direction:

- Take only long trades when it crosses below zero and then turns back above.
- Take only short trades when it crosses above zero and then turns back below.

Divergence is another powerful way to apply the DPO. When divergence appears between a detrended price and the current price, it indicates a high probability that the current trend will end soon.

Using this analysis, a buy signal is generated when a new low is formed below the previous low and a corresponding detrended price value is higher than the previous value. Likewise, a short signal is generated when a new high is formed above the previous high and a corresponding detrended price value is lower than the previous value.