What the Detrended Price Oscillator is
The Detrended Price Oscillator (DPO) does one job: strip out the longer-term trend from a price series so that the shorter cycles riding on top of it become visible. Most oscillators traders use day-to-day — RSI, MACD, Stochastics — are momentum indicators. DPO is different. It is not a momentum indicator. It has no overbought or oversold zones, and it does not generate crossover buy and sell signals.
What DPO does instead is answer one question: given a moving average that represents the trend, how far above or below that trend was price at a specific point in the recent past? Repeated every bar, that question produces a wave oscillating around zero. If price has a repeating short-term cycle, that cycle shows up cleanly in the DPO line — the longer-term drift has been mathematically removed.
It is a cycle-identification and cycle-timing tool — use it to ask "is there a roughly 10-day rhythm in this stock?"
The formula
The calculation is short but contains one subtlety: DPO does not use today's price. It uses a price from the past compared against the current moving average.
For a period N (commonly 20):
code-highlightDPO[today] = Price[today − (N/2 + 1)] − SMA(Price, N)[today]
Three steps: compute the N-period simple moving average ending today; look at the closing price from (N/2 + 1) bars ago; subtract. The difference is today's DPO value. Because the price reference is shifted backwards by half the moving-average window plus one, DPO is effectively centered on a historical point rather than the current bar. The output is a wave hovering around zero: positive when the lagged price was above its surrounding trend, negative when it was below.
A consequence of this design is that the most recent (N/2 + 1) bars do not have a DPO value. The indicator leaves a gap at the right edge of the chart — the price of being centered on the trend instead of trailing it.
A worked example
Imagine a hypothetical stock drifting sideways for a month with a clear short-term wobble layered on top. We will use N = 20, so the lookback for the lagged price is 20/2 + 1 = 11 bars.
On a given day:
code-highlightSMA(20) of the most recent 20 closes = $Y Closing price from 11 bars ago = $X DPO[today] = X − Y
If 11 bars ago the close was four dollars above the current 20-day average, DPO is +4. If it was three dollars below, DPO is −3. Repeat that every day and you get a series that swings positive and negative.
Plot that series for a stock that has tended to rally for roughly five trading days and pull back for roughly five. The DPO will trace out a near-sinusoidal wave with peaks roughly ten bars apart and troughs roughly ten bars apart. That spacing is the dominant short-term cycle. The longer-term direction — whether the stock grinded up two percent or down two percent over the month — has been filtered out, because the moving average absorbed it.
The values themselves are not the point. The spacing of the peaks and troughs is.
How to read the signal
There are a few things to look at when you put DPO on a chart.
Zero line crossings tell you where the lagged price sat relative to trend. Above zero means the price (N/2 + 1) bars ago was above the current moving average — a cyclical high. Below zero means it was below — a cyclical low.
The distance between successive DPO peaks (or troughs) estimates the cycle length. If peaks consistently land roughly ten bars apart, the security is exhibiting a ten-bar cycle. Consistency matters more than the absolute reading. Two peaks at random intervals are noise; five peaks at similar intervals are a pattern worth tracking forward.
Amplitude tells you how strong the cycle is. A DPO that swings widely above and below zero is identifying a meaningful rhythm. A DPO that mostly hugs zero with shallow waves suggests no clear cycle is present.
Choosing N controls which cycles you see. A smaller N filters out shorter trends, leaving only the shortest cycles. A larger N retains medium-term swings while filtering out the long drift:
N = 10to study weekly-ish cycles in daily dataN = 20for two-to-three-week cyclesN = 60for roughly quarterly cycles
The general rule is to choose N slightly longer than the cycle you want to isolate. The moving average then captures and removes the next-longer trend, leaving your target cycle in the DPO output.
DPO vs other oscillators
It helps to be explicit about what DPO is not.
MACD is a trend-following momentum indicator. It uses moving-average differences and a signal line, and traders watch for line crossovers, zero-line crossings, and divergences against price. DPO has none of that. It is a single line oscillating around zero with no signal companion.
RSI and Stochastic are normalized 0-to-100 momentum oscillators with built-in overbought and oversold zones. DPO is unbounded — its scale is dollars (or whatever the price units are) and depends on the volatility of the underlying. There is no "DPO above 70 is overbought" rule.
Most importantly, MACD, RSI, and Stochastic give a current-bar reading and are commonly used to generate entries on the most recent bar. DPO deliberately does not. The output is shifted into the past, so you cannot use today's DPO to make a same-day call. You use the pattern of past peaks and troughs to project where the next cyclical turn should occur, and then act on price near that projected turn. DPO is a map, not a trigger.
When to use it
DPO earns its keep in two situations. The first is when you suspect a security has a tradeable short-term rhythm — sector rotation flows, monthly options-expiration effects, recurring earnings-cycle compressions — and you want to confirm whether that rhythm actually exists in the data. Putting DPO on the chart with a sensible N and looking at peak-to-peak spacing answers that question in seconds.
The second is when you have already identified a cycle and want a clean visual anchor for where the last few cyclical lows have been relative to the current trend. If the last four troughs were spaced roughly twelve bars apart, the next is plausibly around twelve bars out. You can then set a price-level alert sized to the typical pullback amplitude and let the market come to you.
DPO works best on range-bound or mildly trending names. Strongly trending names overwhelm the cycle component — the trend is the dominant signal and there is little useful short-term wave for DPO to isolate.
Limitations
A few things to keep in mind. The lag is structural — the most recent (N/2 + 1) bars do not have DPO values, so you are always looking at where cycles were.
Financial-market cycles are unstable. A clean ten-bar rhythm visible for three months can dissolve the next month as the underlying flow regime changes. DPO does not predict that breakdown — it can only show it after the fact, as the once-regular peaks start landing at different intervals.
It is easy to overfit. Picking N after staring at the chart will often produce a value that makes recent peaks line up beautifully but does not persist forward. Choose N based on a theoretical cycle length (weekly, monthly, options-expiry, earnings-spaced) before looking at the output.
DPO tells you nothing about trend direction — you need a separate trend filter to know which side of the cycle to take. And the indicator is dollar-denominated, not normalized, so comparing DPO values across different securities is meaningless without scaling.
How to use DPO with Stock Alarm Pro
Because DPO is a cycle-mapping tool rather than a same-bar trigger, the natural way to use it alongside Stock Alarm Pro is to translate its cycle estimate into a concrete price-level alert.
A typical workflow: identify a security with a recurring short-term cycle in DPO, note the typical amplitude of pullbacks at cyclical lows, and project the next expected trough forward by the cycle length. Then set a price alert in Stock Alarm Pro Alerts at the level where the next cyclical low is likely to land. Instead of watching the chart and second-guessing the turn, you let the alert fire when price actually arrives there. If the cycle holds, you have a high-quality entry; if price never reaches the projected level, the alert never fires and you have lost nothing.
Combine that price-level alert with a trend filter — only act on cyclical-low alerts in stocks whose longer-term trend is up — and DPO becomes the timing component of a workflow otherwise driven by trend and price structure. That is the most disciplined way to put a cycle-mapping indicator to work.


