Detrended Oscillator Pass Node

Detrended Price Oscillator — Series Input

MomentumCyclePass

Overview

The Detrended Oscillator Pass Node computes the Detrended Price Oscillator (DPO) on a series input. DPO removes the long-term trend from a series by subtracting a displaced SMA — isolating shorter-term cyclical swings.

Unlike momentum oscillators that track price velocity, DPO focuses purely on cyclical fluctuations. It is particularly useful for identifying cycle length and for detecting price peaks and troughs within a cycle that are otherwise obscured by the trend.

Formula

displacement = floor(period / 2) + 1
SMA_displaced[i] = SMA(period) calculated at bar i − displacement
DPO[i] = close[i − displacement] − SMA_displaced[i]
Comparing price from the past to a past SMA eliminates the long-term trend component.
Warm-up: period + displacement bars.

Parameters

ParameterDefaultDescription
period20SMA period and cycle detection lookback

Inputs & Outputs

SlotDirectionTypeDescription
inputInput{ values, timestamps }Price or any numeric series
valuesOutput(number | null)[]DPO values centered around zero; nulls during warm-up
timestampsOutputnumber[]Unix timestamps aligned to input

Use Cases

Cycle Length Measurement

Measure the distance between consecutive DPO peaks or troughs to estimate the dominant price cycle length — then tune other oscillator periods accordingly.

Trend-Independent Turning Points

DPO peaks and troughs identify cyclical turning points without trend interference — useful for timing entries within a confirmed trend direction.

Multi-Cycle Analysis

Run DPO with multiple period values simultaneously to identify nested short, medium, and long cycles operating at different timescales.

Tips & Best Practices

DPO Is Not a Trend Indicator

DPO deliberately removes trend — do not use its zero-line crossings for trend-following. Pair it with a trend indicator (MA, ADX) to filter trade direction.

Period Matches Cycle

The period should ideally match the dominant cycle length. If the market has a 20-bar cycle, a period=20 DPO will resonate with it and produce the clearest peaks and troughs.

Lag Note

DPO is calculated at a displaced bar (period/2 + 1 bars back), so it is not a real-time indicator — it shows the detrended level from mid-cycle ago, not the current bar.

Related Indicators