Skip to content
Menu

Detrended Price Oscillator (DPO)

By Chad Smith, Director of Research & Analysis · Updated

On this page
  1. What it measures
  2. The formula
  3. Default settings
  4. How to read it
  5. DPO vs MACD, CCI and the Elder-Ray
  6. Common strategies
  7. Weaknesses
  8. Indicators it pairs with
0DPO 20
Illustration, not real price data

The detrended price oscillator (DPO) removes the longer-term trend from price so that shorter cycles are easier to see. It compares price with a moving average that has been shifted back in time by about half its length. The result oscillates around zero. Unlike most oscillators, DPO is not designed to track the current bar's momentum. It is a tool for measuring the timing and size of cycles.

What it measures

DPO measures where price sits relative to its trend, after the trend itself has been taken out. A trend can hide shorter rhythms: in an uptrend, every swing low may still be higher than the last, which makes it hard to see the regular rise and fall underneath. Subtracting a moving average strips away the trend and leaves those rises and falls.

The key detail is the shift. A simple moving average reflects the center of its window, not its end. A 20-period SMA is most representative of prices about 10 bars ago. DPO compares price with the SMA from that midpoint, so the two are better aligned in time. This makes the cycles clearer, but means the latest DPO values do not reflect today's relationship to the trend.

Because of this, DPO is used mainly to find cycle lengths, the typical distance between peaks and troughs, rather than to trigger trades.

The formula

Shift = (N / 2) + 1

DPO = Close − SMA(Close, N), with the SMA taken from Shift bars ago

Equivalent form on some platforms:
DPO(t) = Close(t − Shift) − SMA(Close, N) at time t
(plotted at time t − Shift)

where N = the lookback period (20 by default)

Platforms differ in whether they shift the SMA back or plot DPO back. Both approaches produce the same cycle shape. The second version, which plots DPO back, leaves the most recent bars blank because the future data needed to center them does not exist yet.

Worked example (illustrative numbers). With N = 20, the shift is (20 / 2) + 1 = 11 bars. Suppose the 20-period SMA from 11 bars ago was 48.00 and today's close is 49.50. DPO = 49.50 − 48.00 = 1.50. Price is above the centered trend value, which places it in the upper part of its short-term cycle. If the DPO line shows peaks roughly every 18 to 22 bars on the chart, that suggests a cycle of about that length.

Default settings

SettingCommon value
Period20
ShiftN / 2 + 1
SourceClose

Traders studying a specific cycle often set N to roughly match it. The detrended price oscillator is built into TradingView; on MetaTrader it is usually added as a custom indicator.

How to read it

Above or below zero. A positive DPO means price was above its centered trend; negative means below. These show the upper and lower halves of short-term cycles.

Peaks and troughs. Measure the distance between successive DPO peaks or troughs. If they occur at fairly regular intervals, the market may have a dominant cycle of that length.

Amplitude. The height of DPO swings shows how large the short-term cycles are relative to the trend. Larger swings mean bigger moves around the trend.

Not a trend tool. By design, DPO has the trend removed. A rising DPO does not mean the market is in an uptrend, only that price is moving up within its cycle.

DPO vs MACD, CCI and the Elder-Ray

MACD compares two moving averages and keeps the trend in view. DPO compares price with one centered moving average and removes the trend. MACD is built to follow trends; DPO is built to look past them.

The CCI also compares price with its moving average, but it scales the difference by mean deviation and uses the current, unshifted average. CCI is a real-time momentum tool; DPO is a cycle-analysis tool.

The Elder-Ray index compares highs and lows with an EMA that is not shifted, and keeps the EMA's slope as a trend filter.

Common strategies

Finding cycle length

Plot DPO and mark several peaks and troughs. Count the bars between them. If a consistent rhythm appears, traders use that length to set the period of other oscillators or to estimate when the next turn might come.

Cycle-aware timing

Once a cycle length is estimated, traders watch for price to approach the expected timing of a cycle low, then look for confirmation from real-time tools such as the stochastic oscillator or a bullish engulfing pattern.

Overbought and oversold within cycles

Compare current DPO readings with past peaks and troughs. When DPO reaches levels similar to previous cycle extremes, price may be near the edge of its usual cycle range.

Tuning other indicators

Some traders set the period of RSI or other oscillators to about half the cycle length DPO reveals, aiming to match the oscillator to the market's rhythm.

Weaknesses

DPO is not aligned with the current bar. The shift means the latest values either use an older average or are not plotted at all, so it is unsuitable for live entry signals.

Cycles are not stable. Markets change their rhythm, so a cycle length measured in the past may not hold going forward.

The period choice shapes the result. A different N reveals different cycles, and it is easy to find patterns that are not really there.

It ignores volume and volatility. DPO only describes price relative to a centered average.

Indicators it pairs with

  • The stochastic oscillator or RSI, as real-time tools tuned to the cycle length DPO reveals.
  • Moving averages, to keep the removed trend in view.
  • ZigZag, to compare swing timing with DPO cycles.
  • CCI, Lambert's cycle-oriented momentum oscillator.
  • Bollinger Bands, to see how cycle extremes line up with volatility bands.

For more on cycles, trends and oscillators, see the technical analysis course.

Brokers with strong charting to practice on

Put this into practice on a demo account first, with no money at risk.

Frequently asked questions

What does the detrended price oscillator show?

It shows price relative to a shifted moving average, which removes the longer-term trend. What remains are the shorter cycles of highs and lows.

Why is DPO not used for trading signals in real time?

DPO compares price with a moving average from the middle of the lookback, so it is not aligned with the latest bar. It is designed for studying cycles, not for timing entries at the current moment.

What period is used for DPO?

A 20-period setting is common. Traders often choose a period related to the cycle length they want to study.

How is DPO different from MACD?

MACD compares two moving averages and follows the trend. DPO compares price with a single shifted moving average and is designed to remove the trend.

What does a positive DPO mean?

It means price was above the displaced moving average at that point, so it was in the upper part of its short-term cycle.