Trend & direction

Detrended Price Oscillator · DPO

A cycle tool that strips the trend out of price to expose its shorter rhythmic highs and lows.

Works best in ranging marketsEngine-computed on a fixed sample series
14512096Above zero = bullish momentumBelow zero = bearish momentum
DPO 3.52How to read DPO on the chart — the callouts mark what to look for.

The formula

Subtract a moving average that has been shifted into the past — by roughly half the lookback plus one — from price. Because the average is displaced backward, the DPO is not aligned to the latest bar, and the final few bars are not plotted.

DPO = Price − SMA(n) displaced back (n ÷ 2 + 1) bars
Worked example
InputValue
Lookback n20
Backward shift = 20 ÷ 2 + 111 bars
Displaced SMA(20)100.0
Price at the compare point103.2
DPO = 103.2 − 100.0+3.2

DPO = +3.2 → price sits above its detrended baseline

What it is

The Detrended Price Oscillator, or DPO, is a cycle-hunting tool that deliberately throws away the trend so you can see the rhythmic ups and downs hiding underneath it. Most indicators try to measure the trend; the DPO does the opposite, subtracting a shifted moving average from price to leave only the shorter oscillation around that average. The idea is that many markets have a repeating cycle — a tendency to peak and trough at fairly regular intervals — that a rising or falling trend normally masks. By removing the trend, the DPO makes the spacing between those cyclic highs and lows easy to measure. For a beginner, the key mental shift is that the DPO is not a buy-and-sell signal line at all; it is an analytical ruler for measuring how long the market's natural rhythm tends to be. It answers the question, ignoring the overall drift, how many bars typically pass between one swing low and the next?

How it is calculated

The DPO uses a lookback length, say 20 bars, and compares price to a simple moving average of that length that has been displaced backward in time by roughly half the lookback plus one — for a 20-period setting, about 11 bars into the past. Because the average is shifted back so that it sits under the middle of its own data window, subtracting it from price removes the slow trend component and leaves the faster deviation. In the classic centred form the DPO is therefore not aligned to the most recent bar; the newest eleven or so bars have no displaced average to compare against and are simply not plotted. Some modern platforms offer a non-centred variant that reaches the current bar, but that version is really just a mean-deviation oscillator and loses the pure cycle interpretation. The output oscillates around zero, positive when price is above its detrended baseline and negative when below.

Reading it, step by step

Start by looking at the spacing of the DPO's peaks and, separately, its troughs — the number of bars from one peak to the next estimates the length of the dominant price cycle. Once you know that cycle length, you can anticipate roughly when the next trough is due and treat that window as a potential buy zone and the next peak as a potential sell zone. Crossings of the zero line simply mark where price sits above or below its detrended baseline, not a trend change. The amplitude of the swings tells you how large the typical cyclic excursion is, which helps set expectations for a swing's size. Crucially, because the classic version is displaced into the past, you must not read the right-hand edge as a live signal; the tool describes the market's rhythm historically so you can project it forward yourself. It is a measuring instrument first and a timing aid second.

Reading the signals on the chart

14512096
DPO 3.52The ▲/▼ marks flag the most recent zero-line crossings, where momentum flips from negative to positive and back.

Best timeframes

  • Scalping1m – 5m
  • Day trading5m – 15m
  • Swing1h – dailycycle study
  • PositionDaily – weekly

The DPO is shifted back about half the lookback, so its last bars are missing — it is an analysis overlay for measuring cycle rhythm, not a live trigger.

DPO vs related tools

DPOROCMACD
Removes the trendYesNoNo
Plots the latest barsNo (displaced)YesYes
Main purposeCycle lengthMomentumTrend momentum

Common price-action setups

How the signal typically plays out on the chart.

Cycle-low timing

In an established cycle, the DPO carves a trough and turns up through zero — time a long into the anticipated low, exiting near the next projected peak.

Buy the trough
Cycle upswing
Cycle-high timing

The DPO peaks and rolls back below zero at the top of its measured cycle — fade the high, covering as it approaches the next trough.

Sell the peak
Cycle downswing

Best timeframes and settings

The single parameter is the lookback length, and it should be set to encompass the cycle you want to isolate — a common starting point is 20 or 21 bars, which highlights roughly monthly cycles on a daily chart. Shorten the length to expose faster, shorter cycles and lengthen it to reveal slower ones; the right value is the one that makes the DPO's peaks and troughs line up cleanly with the swings you can see in price. It is used across daily and weekly charts by swing and position traders studying rhythm, and intraday by those looking for session cycles. Because the displacement is tied to the lookback, changing the length also changes how many recent bars go unplotted. There is no universal best setting — you are effectively tuning the tool to the market's own periodicity, which shifts over time and must be revisited as conditions change.

When and where to use it

The DPO is most at home in ranging or gently cycling markets where a genuine repeating rhythm exists, which is why its natural regime is sideways rather than strongly trending. It suits instruments and timeframes that show a recognisable ebb and flow, and it is a favourite of cycle analysts studying commodities, indices, and seasonal patterns. In a powerful, sustained trend the very notion of a stable cycle breaks down, and the DPO becomes less useful because the detrended swings get overwhelmed by directional drift. Avoid using it as a real-time entry trigger, and avoid trusting projected cycle turns in markets that have just shifted regime. Think of it as a diagnostic you run to understand a market's temperament, then hand off to a directional tool for the actual entry. It is analysis, not a signal engine.

Strategies that use it

The first strategy is cycle timing: measure the average bar-count between DPO troughs, project the next trough forward, and prepare to buy in that window when a directional tool confirms a turn, exiting near the projected peak. The second is a confluence approach: overlay the projected cycle low with a support level or a Fibonacci retracement, and only act where the rhythm and the price level agree, which filters out cycles that have drifted out of phase. The third is amplitude-based expectation setting: use the typical size of the DPO swing to judge whether a nascent move has room to run or is already near its usual exhaustion, sizing targets accordingly. Because the DPO itself gives no live edge signal, each strategy leans on a partner tool for the trigger while the DPO supplies the timing framework and the sense of how big a swing to expect.

Combining it with other indicators

The DPO is a natural partner for oscillators and trend tools that provide the directional trigger it lacks. A momentum oscillator such as the stochastic or RSI can confirm the turn at a projected cycle low, giving you an actionable entry inside the timing window the DPO defined. A moving average or the ADX provides the trend context that tells you whether the cycle read is even trustworthy, since strong trends dissolve clean cycles. Horizontal support and resistance or pivot levels give the projected turns a price to react at. Some analysts pair it with other cycle and rate-of-change tools such as the KST to cross-check the rhythm they are seeing. The general principle is that the DPO measures when, and its partners confirm whether and at what price.

Where it fails

The most common misunderstanding is treating the DPO as a live, right-edge signal generator, when in its classic form the last several bars are deliberately not plotted because the average is displaced into the past. It also assumes cycles are regular, and real markets routinely stretch, compress, or abandon their rhythm, so a projection that worked for months can fail without warning. In strong trends the detrended swings are swamped and the cycle read becomes noise. Beginners often over-optimise the lookback to fit past turns perfectly, only to find the fitted cycle evaporate going forward. The fixes are to use the DPO only for historical cycle measurement rather than for entries, to re-measure the cycle length regularly, and to demand confirmation from a directional tool before acting on any projected turn. Never trade the DPO's zero-line crosses as if they were trend signals — that is not what they mean.

A worked example

Suppose you apply a 20-period DPO to the daily chart of an index that has been chopping sideways for months. Looking back, you notice the DPO troughs fall roughly 20 to 22 trading days apart, and the last clear trough was 18 days ago. You project that the next cyclic low is due within the coming few days, and you mark a nearby horizontal support level at 4,180 as a likely reaction point. When price dips into 4,185 and the stochastic you run alongside the DPO turns up out of oversold, you buy, placing a stop below the support and targeting the projected cyclic peak about ten days out near 4,260. The DPO did not fire the trigger — the stochastic and the support did — but it told you when in the rhythm to be watching and roughly how far the swing might carry, which is exactly the role a detrended cycle tool is meant to play.

Common mistakes

  • Reading the last bars as live signals — the DPO is displaced back and those bars are not plotted.
  • Assuming price cycles are perfectly regular, which markets routinely violate.
  • Using it to judge trend direction — it deliberately strips the trend out.
  • Trading zero-line crosses mechanically instead of using the DPO to time a known cycle.
  • Pairing no directional tool with it — it is an overlay, not an entry engine.