Definition of DPO
DPO stands for Detrended Price Oscillator. The idea is to remove (or “detrend”) part of the longer-term movement so you can focus on shorter-term deviations in price.
A common way to define DPO is:
- Compute a moving average of the price over a window of length N.
- Choose a shift of (N/2 + 1) periods.
- Plot the difference between the price at the current time and the moving average shifted back by that amount.
Because different sources may use slightly different shifting conventions, a “worked example” should always state the exact formula used.
Mechanism: how the worked calculation is constructed
Let price be a time series indexed by integers. Assume we work with the following stable, explicit definitions:
- Price series (close): P[t]
- Window length: N = 5 (periods)
- Moving average type: simple moving average (SMA)
- Shift: s = floor(N/2) + 1 = floor(2.5) + 1 = 3
- DPO at time t: DPO[t] = P[t] − SMA[t − s]
- SMA[x]: average of the 5 closes ending at time x: SMA[x] = (P[x] + P[x−1] + P[x−2] + P[x−3] + P[x−4]) / 5
Stable mechanics here are the arithmetic and indexing rules. Anything about market behavior, provider data, or interpretation is not built into the math.
Worked numerical example (with stated assumptions)
Assume the following 10 consecutive close values (no live data):
- P[1]=100, P[2]=102, P[3]=101, P[4]=103, P[5]=104,
- P[6]=105, P[7]=103, P[8]=102, P[9]=104, P[10]=106
Use the mechanism above (N=5, s=3).
Compute DPO[8]
- We need SMA[8−3] = SMA[5].
- Compute SMA[5] using P[5] down to P[1]:
- SMA[5] = (P[5]+P[4]+P[3]+P[2]+P[1]) / 5
- SMA[5] = (104 + 103 + 101 + 102 + 100) / 5
- SMA[5] = 510 / 5 = 102.0
- Now compute DPO[8]:
- DPO[8] = P[8] − SMA[5]
- DPO[8] = 102 − 102.0 = 0.0
Compute DPO[9] to show the effect of time
- Need SMA[9−3] = SMA[6].
- SMA[6] uses P[6]..P[2]:
- SMA[6] = (105 + 104 + 103 + 101 + 102) / 5 = 515 / 5 = 103.0
- DPO[9] = P[9] − SMA[6] = 104 − 103.0 = +1.0
What these numbers mean (as a neutral statement): DPO[8]=0 indicates the current price (at t=8) equals the shifted moving average under this exact definition. DPO[9]=+1 means the current price at t=9 is 1 unit above that shifted reference.
Limitations and risks (what can fail)
- Indexing and convention risk: If a platform uses a different shift, window definition, or moving average type, your DPO values will differ. In other words, the numeric result is not universal without matching the exact formula.
- Data and preprocessing risk: Missing bars, different session definitions, corporate actions, or whether you use close vs. another price can change P[t] and therefore DPO.
- Non-stationary reality: Even if DPO “looks like” a deviation from a moving average, historical patterns do not guarantee future behavior. Market regimes can change.
- Scale and units: DPO is in the same units as price (not automatically standardized). Large-priced instruments can produce larger absolute DPO values than small-priced ones under the same formula.
How to verify and what question to answer next
To independently verify DPO calculations, recompute the same time-indexed steps:
- Confirm N and the moving average type.
- Confirm the shift s used by your formula or platform.
- Recalculate the shifted SMA and subtract it from the current price.
A useful next question for research is: How does the specific DPO definition (shift and SMA convention) used by your charting source match the formula you can reproduce on paper?