WhitmanTrading

What Is the Detrended Price Oscillator?

Detrended price oscillator compares price to a moving average shifted back in time, removing the trend so any underlying cycle becomes visible. Because the average is displaced, the last several bars are not plotted at all — which is exactly where you wanted to trade.

Most oscillators try to tell you when to act. This one is built to answer a research question instead, and it is unusually clear about the fact that it cannot do the other job.

How it works

A price series with the trend component removed.
The detrended price oscillator removes the trend first. Illustrative chart - not real market data.

It subtracts a displaced moving average from price. Take a moving average, shift it backwards by roughly half its period, and plot the difference between price and that shifted line.

A steady series compared against a displaced average.
It compares price to a displaced moving average. Illustrative chart - not real market data.

Shifting backwards is the trick. A moving average lags price by about half its period; moving it back by that amount lines it up with the price it was describing, so the difference is the deviation rather than the lag.

A rising series with the cycle component isolated.
What is left is the cycle, if there is one. Illustrative chart - not real market data.

What remains is the wobble around the trend. If the instrument has a repeating cycle, it shows here with the direction stripped out.

A falling series where momentum is deliberately absent.
It is deliberately not a momentum tool. Illustrative chart - not real market data.

And it says nothing about momentum. Removing the trend removes exactly the information a momentum indicator uses, which is the point rather than a limitation.

The missing tail

A choppy series where the plotted line stops before the last bars.
The displacement means it is shifted back in time. Illustrative chart - not real market data.

The displacement costs you the recent bars. If the average is shifted back by ten periods, the last ten bars have no value to plot against — so the line simply stops short of the right edge.

A slow series with a visible gap at the right edge.
So the last bars are not plotted at all. Illustrative chart - not real market data.

That gap is where the decision lives. You are looking at a clean cycle that ends several bars before today, and the bars it does not cover are the ones you would be trading on.

A calm series with the untraded region marked.
That missing tail is where you wanted to trade. Illustrative chart - not real market data.

No setting fixes this. Reducing the displacement reduces the detrending, which is the thing the indicator exists to do. The blind spot and the function are the same property.

A worked example

Take this site’s shared series. Direction runs average 2.01 bars with a longest of 11. Median bar range is 0.493, ninetieth percentile 1.101.

A cycle needs repetition to be a cycle. With average runs of two bars, any oscillation the indicator finds at short settings is describing alternation, not a cycle — price going up, down, up, down is what a coin does.

At longer settings the displacement grows. A 40-period average displaced by 21 bars means the last 21 bars are unplotted. On a daily chart that is a month of blindness at the edge.

So the setting trades one problem for the other. Short enough to see recent bars means too short to find a real cycle; long enough to find one means a large hole where the present is.

A falling series with a stop level marked.
A stop fills where the market is. Illustrative chart - not real market data.

What it is actually for

Research, not signals. Run it across an instrument’s history and ask whether the oscillation has any regularity — consistent peak-to-peak spacing, repeating amplitude. Usually the answer is no, and that is a useful answer.

Confirming a cycle somebody claims exists. If a market is said to have a monthly rhythm, this is the tool that checks it with the trend removed rather than allowing a rising line to masquerade as one.

And measuring how far price typically strays. The amplitude of the oscillation is a plain measure of normal deviation, usable for sizing rather than for timing.

The original data

On this site’s shared series: direction runs average 2.01 bars with a longest of 11. Median bar range 0.493, ninetieth percentile 1.101. A round trip costs 0.0098, about 2% of the median bar.

Two-bar average runs are the finding that matters. A genuine cycle would produce runs clustering around some characteristic length; an average of two with a maximum of eleven is what alternation plus occasional persistence looks like, not a rhythm.

A candlestick chart annotated with the cost of a round trip.
A round trip costs a share of a bar. Illustrative chart - not real market data.

And any trade taken from a cycle reading pays the full round trip — charged on a signal derived from a line that stopped plotting several bars ago.

A price series with volume shown beneath.
Volume and price measure different things. Illustrative chart - not real market data.

Choosing the period

The convention is half the suspected cycle length. If you think an instrument turns roughly every forty bars, a twenty-period setting with a displacement of eleven is the standard starting point.

Which means you need a hypothesis before you start. Unlike most indicators, this one is not something you apply and read — it is a test of a claim you already have. Without a candidate cycle length there is nothing to set the period to except trial and error, and trial and error on one dataset is fitting.

Shorter periods find shorter cycles and give back less of the tail. Longer ones find longer cycles at the cost of a larger blind region. There is no setting that does both, and a setting chosen because the resulting chart looked persuasive is a setting chosen by the answer.

And the honest test is out of sample. Fix the period on one stretch of history, then check whether the cycle it found persists in a stretch you did not look at. Most do not, which is the finding people skip past on the way to the next indicator.

When it fails

The characteristic failure is trading the right-hand edge of a chart that has no right-hand edge. The oscillator looks like every other indicator — a line crossing zero, peaks and troughs — so it invites the same reading. But the line ends well before today, and a signal read from its last plotted point is a signal about a bar that is already history. The chart does not announce this; the gap just looks like the end of the data.

A candlestick series with a gap through a level.
A gap skips the level entirely. Illustrative chart - not real market data.

A second failure is finding a cycle by adjusting the period until one appears, which is fitting a setting to noise.

A third is treating it as an overbought indicator. It has no bounded range and no standard levels; high and low mean “far from the displaced average” and nothing else.

A fourth is combining it with trend-following tools, which need the component this one deletes.

A declining series cut short at a decision point.
The cycle looks clear. Where does the line stop? Illustrative chart - not real market data.

And a fifth is concluding a cycle exists from one instrument over one period, which is the smallest possible sample for a claim about repetition.

Moving average covers the line being displaced and why the lag is half the period. Market trend covers the component this indicator removes. And technical analysis covers the wider tradition it belongs to.

What I actually do

This is the rare indicator that is honest about what it cannot do. It is not built to signal entries, it is built to answer one question — is there a repeating cycle in this instrument — and the displacement that makes it work also means it refuses to say anything about right now.

— Michael Whitman

This page is educational, not financial advice. Test every idea on your own charts before risking money.