Detrended Price Oscillator (DPO): Complete Guide for Algorithmic Trading

The Detrended Price Oscillator (DPO) is a cycle-focused technical indicator that strips the long-term trend from price, leaving a clear picture of short-term market cycles. Unlike most oscillators, the detrended price oscillator does not measure momentum or trend strength. It removes directional bias entirely. That makes it one of the most effective tools for identifying repeating price cycles and timing entries within those cycles.

What Is the Detrended Price Oscillator?

The Detrended Price Oscillator is a momentum tool that compares a past price to a shifted moving average, eliminating the dominant trend to isolate cyclical price movements. The goal is not to predict direction. The goal is to reveal how far price deviated from its historical midpoint at a specific point in the past.

When DPO rises above zero, price traded above its average at the reference point. When DPO falls below zero, price sat below its average. This makes the detrended price oscillator particularly useful for cycle timing — identifying when a market is near a cyclical high or low based on patterns that have repeated historically.

DPO focuses specifically on removing trend to expose the underlying cycle rhythm. Compare it with other structure-based tools such as the Vortex Indicator, which analyses directional movement rather than cycle position.

How Is the Detrended Price Oscillator Calculated?

DPO compares a past closing price to a simple moving average (SMA). Most traders use a 20-period setting. The calculation takes three steps.

First, calculate a 20-period SMA of closing prices. Second, identify the price that occurred (period ÷ 2 + 1) bars ago. For a 20-period DPO, that is 11 bars back. Third, subtract the SMA from that historical price.

The result oscillates around zero. It shows how far price deviated from its average at a specific moment in the past — with the trend removed. Because DPO uses a shifted price rather than the current bar, it avoids the lag problem common in trend-following indicators.

You can read the full methodology on Investopedia’s DPO guide.

How to Read Detrended Price Oscillator Signals?

The detrended price oscillator oscillates above and below a zero line. Three readings drive most of the analytical value.

Above zero: price was running above its average at the reference point. Markets were extended to the upside. Below zero: price was below its average. Markets were depressed relative to trend. Zero crossings: DPO crosses zero when past price aligned exactly with its moving average. These crossings often mark turning points in the current cycle.

Recurring peaks and troughs carry the most value. If DPO peaks repeat every 15–20 bars, that cycle length guides timing decisions across your other indicators. The detrended price oscillator does not generate buy and sell signals directly. It tells you where you sit within a price cycle — which informs entry timing when you combine it with a directional indicator.

What Are the Best Detrended Price Oscillator Trading Strategies?

Cycle timing with a trend filter
Use DPO to identify when price hits a cyclical low. Combine it with a trend indicator such as a 50-period EMA. Require both conditions before entry: DPO at a recurring low AND price above the EMA. Enter long when both align. Exit when DPO reaches a recurring high. This approach uses the detrended price oscillator for timing and the EMA for direction.

Mean reversion entries
When DPO falls to extreme negative values — below the lowest levels seen in recent history — price has moved too far below trend. Use this as a mean reversion signal. Add volume confirmation: require volume to rise on the signal bar. That combination reduces false signals in choppy conditions.

Cycle length estimation
Count the distance between consecutive DPO troughs. This gives an estimate of the current market cycle length. Use that estimate to set hold periods for other strategies. Exit before the next expected cyclical top rather than waiting for a lagging reversal signal to fire.

What Are Common Detrended Price Oscillator Mistakes to Avoid?

Trading DPO without a trend filter: The detrended price oscillator shows no trend direction. Every cyclical signal without a directional filter is a coin flip. Always combine DPO with a trend-following indicator before acting on signals.

Ignoring cycle length consistency: Not all markets produce stable cycles. DPO works best in range-bound or gently trending conditions. In strongly trending markets, cycle patterns break down. Cycles that ran 15 bars can compress or extend dramatically. Verify that cycle patterns are consistent before relying on them.

Using too short a period: Short DPO periods produce noise. A 5-period setting reacts to every minor wiggle. Start with a period between 14 and 20. Only adjust after reviewing cycle patterns across a meaningful backtest period.

Treating zero crossings as entry signals alone: A DPO zero crossing tells you something about the past, not the future. Require confirmation from a current indicator — such as a volume spike or a momentum turning point — before entering a trade on a zero cross alone.

How to Build Detrended Price Oscillator Strategies in Arrow Algo?

Arrow Algo includes the DPO as a built-in indicator block. Add it to your strategy canvas using the drag-and-drop visual builder. No code required. Set the period in the block’s properties panel. Connect the DPO output to a condition block that checks whether the value has crossed zero or reached a defined threshold.

Chain that condition to an entry block to trigger a trade automatically. For a cycle-timing strategy, place a DPO block alongside an EMA block on the canvas. Use a logic block to require both conditions before a long entry fires: DPO at a cyclical low AND price above the EMA.

Arrow Algo’s backtesting engine lets you test your DPO strategy across multiple date ranges directly from the builder. Evaluate cycle consistency and adjust the period setting as needed. See our guide on entry and exit strategies for algo traders for ideas on combining DPO with other timing methods.

What Are the Key Takeaways?

  • The Detrended Price Oscillator removes the dominant trend from price, exposing short-term market cycles.
  • DPO does not predict direction. It reveals where price sits within a historical cycle.
  • Readings above zero mean past price exceeded its moving average. Below zero means price sat below average.
  • Count DPO peaks and troughs to estimate cycle length and plan hold periods for other strategies.
  • DPO works best as a timing tool alongside a directional indicator such as an EMA or trend filter.
  • Avoid using DPO in strongly trending markets. Cycle patterns break down when directional momentum dominates.
  • Arrow Algo lets you build and backtest DPO strategies using the no-code visual block builder — no programming required.
Educational disclaimer: This content is for educational purposes only and does not constitute financial advice. Trading involves significant risk and you should only trade with capital you can afford to lose. Past performance is not indicative of future results.

Disclaimer: The information provided in this article is for educational purposes only and does not constitute financial advice. Trading involves significant risk and you should only trade with capital you can afford to lose. Past performance is not indicative of future results. Always conduct your own research before making any trading decisions.

Ready to build your own automated trading strategies without writing a single line of code? Start for free at Arrow Algo and join thousands of traders who’ve made the switch to systematic trading.

About the Author

Author Bio