MarketInOut Stock Screener Log In | Sign Up

Detrended Price Oscillator (DPO)

By MarketInOut · Updated November 16, 2026

The Detrended Price Oscillator (DPO) removes the longer trend from prices so the shorter cycles underneath are easier to see. It compares price with a moving average that has been shifted back by half its length, which lines the average up with the middle of the window it covers. What remains are the short swings above and below that centered average: their highs, lows and spacing. The DPO is a tool for studying cycles and stretched prices, not a trend or timing indicator.

How it is calculated

n     = period (20 by default)
shift = n / 2 + 1   (11 bars for n = 20)
DPO   = close − SMA(close, n) as it stood shift bars ago

Centered form: DPO = close shift bars ago − SMA(close, n) today

Both lines describe the same thing: how far price was from the average of the bars around it. The first form compares today’s close with an older average; the second compares an older close with today’s average, which puts the close in the middle of the 20-bar window. Charting packages use one or the other, so the same DPO can appear shifted by about half a period. Our dpo(20) uses the centered form: on our data it equals the close 11 bars ago minus today’s 20-day SMA. The DPO is in price units, like the price itself.

How to read it

  • Cycle highs and lows. Peaks and troughs in the DPO mark the short-term swing highs and lows with the trend taken out. Measuring the bars between several troughs gives a rough idea of the stock’s typical cycle length.
  • Above and below zero. A positive DPO means price was above its centered average, a negative one that it was below. In an uptrend the line still spends plenty of time below zero, because the trend has been removed.
  • Stretched readings. A DPO far from zero compared with its own recent swings shows price stretched away from its average, often near a short-term turning point.
  • Cycle low in a trend. A DPO trough that forms while the longer trend is up can mark a pullback low. Traders combine the two: the trend from a long average, the timing from the DPO cycle.

Settings and common mistakes

  • Choosing the period. The DPO removes cycles longer than its period and keeps the shorter ones. 20 bars suits swings of a few weeks on daily charts; a longer period keeps longer cycles.
  • Treating it as a real-time signal. Because the average is centered, the DPO is always about half a period behind. Its latest value describes the cycle as of roughly two weeks ago (for n = 20), not today.
  • Reading zero-line crosses as trend changes. The trend is exactly what the DPO removes. A cross of zero only means price moved across its centered average.
  • Comparing values across stocks. The DPO is in price units, so a reading of 5 is large for a $30 stock and small for a $700 one. Compare a stock with its own past readings, or divide by price or ATR first.

SPY (S&P 500 ETF), daily, with the Detrended Price Oscillator (20).

Live chart: SPY (S&P 500 ETF), daily, with the Detrended Price Oscillator (20). The chart updates every trading day.

Screen for it on MarketInOut

The DPO is dpo(period) in our formula language. Stocks in a long-term uptrend where the DPO has just turned up from a trough below zero, with RSI below 50:

exch(nyse,nasdaq) and type(stock) and price > 1 and advol(21) > 1
and price > sma(200) and dpo(20) < 0 and dpo(20) > dpo(20)@1
and dpo(20)@1 < dpo(20)@2 and rsi(14) < 50

The first form of the formula can be written directly. Stocks above their 200-day average whose close just moved above the 20-day SMA as it stood 11 bars ago, the classic DPO crossing above zero:

exch(nyse,nasdaq) and type(stock) and price > 1 and advol(21) > 1
and price > sma(200) and c > sma(20)@11 and c@1 < sma(20)@12

Related: Moving averages, Overbought and oversold, Price Rate of Change.




Disclaimer - Privacy Policy - Terms of Service - Cookies - FAQ - Affiliates - Blog