What is DPO?
The Detrended Price Oscillator subtracts a past moving average from the current price. The average is the simple average of the last 21 bars, but taken as it stood 11 bars ago, which lines it up with the middle of its own window. Measuring price against that centred average removes most of the longer trend and leaves the shorter up-and-down cycles. Altrady Charts draws DPO in its own pane, in price units, around a dashed zero line.
DPO is for seeing the rhythm of swings, how far apart recent highs and lows are. It is not a trend indicator, and because it compares with an older average it is not built for timing the current bar.
How to use DPO
- Peaks and troughs. The distance between successive DPO peaks, or troughs, gives a rough idea of the length of the current price cycle.
- Above or below zero. Above zero, price is above the average as it stood 11 bars ago; below zero, below it.
- Size of swings. DPO is in price units, so the height of its swings shows how large the cycles are in the market's own terms.
- Period length. Shorter lengths isolate shorter cycles; longer lengths let more of the trend through.
These are ways to read the line, not entry signals on their own.
Settings
| Setting | Default | What it changes |
|---|---|---|
| Length | 21 | Bars in the simple average. It also sets how far back the average is taken, half the length rounded down plus one. Minimum 1. |
| Source | Close | Which price is compared and averaged. Open, high, low, hl2 and hlc3 are also available. |
Adjust the length and price source in the indicator settings.
Calculation
The current price minus the simple average as it stood a set number of bars ago:
back = floor(21 / 2) + 1 = 11
DPO = close - SMA(close, 21) from 11 bars ago
The shift is applied to the average, not to the price: today's close is compared with the 21-bar average as it was 11 bars earlier. The half-length is rounded down before adding one, so a length of 20 also gives a shift of 11.
The 21-bar average first exists on the 21st bar, and reading it 11 bars back puts the first DPO value on the 32nd bar of loaded history. Each value uses only bars that have already happened.
Limitations
- It is in price units. Readings cannot be compared across markets with different prices, and a fixed threshold stops fitting when price changes a lot.
- Cycles are not regular. Market swings rarely repeat at a fixed spacing, so a cycle length read from past peaks is only a rough guide.
- It is not a timing tool for the current bar. The average it compares with is 11 bars old, so DPO describes price relative to where the trend was, not where it is now.
- The live candle moves. The current bar's value changes until that bar closes.
- It depends on timeframe and length. The cycles it isolates change with both, and a length that suits one market may hide the cycles in another.
Frequently asked questions
The Detrended Price Oscillator compares price with a simple moving average taken from about half its length ago. That removes most of the longer-term trend and leaves shorter cycles, which makes the spacing of swing highs and lows easier to see.
Look at the peaks and troughs rather than at single readings. The spacing between them gives a rough idea of the current cycle length, and their height shows how large the swings are in price terms. Above zero means price is above the past average, below zero below it.
Yes. The indicator declares two inputs: Length, default 21 with a minimum of 1, and Source, default close. Open the indicator's settings on the chart to change them. The shift is always half the length, rounded down, plus one.
No look-ahead is used and values on bars that have already closed are not revised. Each bar compares its own price with an average that was already complete 11 bars earlier, and the line is drawn on the bar it belongs to rather than shifted. The current candle's value moves while it is still live and settles when it closes. Each value uses only a fixed window of past bars, so loading older history does not change it.
The 21-bar average needs 21 bars, and DPO reads it 11 bars back, so with the defaults the first value appears on the 32nd bar of loaded history.
Use the Add to chart button at the top of this page. It opens BTC/USDT on Binance in the Altrady Charts terminal with the built-in Detrended Price Oscillator already applied. On any other market, open the indicator picker on the chart and choose Detrended Price Oscillator from the Oscillator group.