DPO¶
Indicators · Oscillators
Detrended Price Oscillator — removes trend to expose price cycles.
The Detrended Price Oscillator (DPO) does something unusual: it deliberately removes the trend from price so you can see the cycles underneath. Most indicators are dominated by the prevailing trend; DPO strips that out by comparing price to a displaced moving average, leaving a clean oscillation around zero that reveals the rhythmic peaks and troughs — the short-term cycles — that a trend would otherwise mask.
How it works¶
Over the Period (default 20) the block subtracts a moving average — shifted back by roughly half the period — from the Source. That displacement is the trick: by comparing each bar to where the average was period/2 + 1 bars ago, DPO removes the trend component and centres the result on zero. The output oscillates in a sub-pane, with Bull ↑ / Bear ↓ signals on the zero cross. Note that because of the displacement, DPO is not meant to extend to the latest bar as a real-time signal — it's a tool for studying cycle structure.
When to use it¶
Use DPO to identify and time cycles. By removing the trend it makes the typical peak-to-peak and trough-to-trough spacing of a market's short-term cycles visible, which helps you anticipate where the next cyclical low or high might fall. It's most useful for estimating cycle length (tune the period to isolate the cycle you care about) and for spotting overbought/oversold relative to the detrended mean. It's an analytical tool more than a live trigger — pair its cycle read with a conventional entry signal.
Example¶
Find the cycle: apply DPO to price and tune the Period until the oscillator's peaks and troughs line up with the market's visible short-term swings — that reveals the dominant cycle length. Use the timing of DPO troughs to anticipate cyclical lows, confirming entries with a separate trigger into a Buy Signal. Study it in the Tester.
Tips & gotchas¶
- Trend removed on purpose — it exposes cycles a trend would hide.
- Displaced by design — it's not a real-time, latest-bar signal; it's for cycle analysis.
- Tune the period to the cycle you want to isolate.
- Analytical, not a standalone trigger — combine its cycle read with a conventional entry.
Related blocks¶
Inputs¶
| Socket | Type | What to wire in |
|---|---|---|
| Source | bars / series |
Price bars or any indicator series |
Outputs¶
| Output | Type | Plots as | Description |
|---|---|---|---|
| DPO | series |
Line · sub-pane | Detrended price (oscillates around zero) |
| Bull ↑ | signal |
Signal arrows | DPO crosses above zero |
| Bear ↓ | signal |
Signal arrows | DPO crosses below zero |
Parameters¶
| Parameter | Type | Default | What it does |
|---|---|---|---|
| Period | number · 2–200 | 20 |
|
| Source | choice (close, open, high, low, hl2, hlc3, ohlc4) |
close |
|
| Line color | colour | #26a69a |
Reference auto-generated from the block catalog · category Indicators.