StratBase.aiStratBase.ai
DashboardCreate BacktestMy BacktestsCatalogBlogNewsToolsHelp

Products

  • Researcher Dashboard
  • Create Backtest
  • My Backtests
  • Catalog
  • Blog
  • News

Alerts

  • Calendar
  • OI Screener
  • Funding Rate
  • REKT
  • Pump/Dump

Company

  • About Us
  • Pricing
  • Affiliate
  • AI Widget
  • Contact

Legal

  • Privacy
  • Terms
  • Refund Policy

Support

  • Help Center
  • Reviews
StratBase.aiStratBase.ai

Think it. Test it.

StratBase.ai does not provide financial advice or trading recommendations. AI only formalizes user ideas into testable strategy configurations for research purposes. Past backtesting performance does not guarantee future results. All trading decisions and associated risks are the sole responsibility of the user. This platform is not a broker and does not facilitate real trading.

© 2026 StratBase.ai · AI-powered strategy research and backtesting platform

support@stratbase.ai
Help Center/Indicators/DPO (Detrended Price Oscillator)

DPO (Detrended Price Oscillator)

📈Indicators
📌

DPO (Detrended Price Oscillator)

📋

What is DPO?

The Detrended Price Oscillator (DPO) removes the trend from price data to help identify cycles. Unlike most oscillators that use the latest price, DPO is displaced backward to align with the cycle pattern. It oscillates around zero and is useful for identifying cycle highs and lows.

DPO is particularly effective for traders who want to step back from trend analysis and focus on the underlying cyclical patterns that drive price movement. By isolating these cycles, you can identify potential turning points before they happen and time entries and exits more precisely.

⚙️

How it works

DPO subtracts a displaced moving average from the price:

DPO = Close[N/2 + 1] - SMA(Close, N)

The displacement (N/2 + 1) shifts the moving average backward in time, which centers the oscillator on the price action rather than lagging behind it. This backward displacement is what makes DPO unique among oscillators. By using a displaced reference, DPO isolates the cyclical component of price movement while removing the directional trend.

The result is an oscillator that swings around a zero line, with peaks representing cycle tops and troughs representing cycle bottoms. The zero line itself acts as a neutral reference point—above zero indicates an upswing in the cycle, while below zero indicates a downswing.

⭐

Key features

  • Above 0 — Price is above the detrended average (cycle upswing)
  • Below 0 — Price is below the detrended average (cycle downswing)
  • Peaks — Indicate cycle tops and potential reversal points
  • Troughs — Indicate cycle bottoms and potential entry opportunities
  • Not a trend indicator — Specifically designed to remove trend influence
  • Zero-line crossovers — Signal changes in cycle direction
  • Displacement effect — Aligns oscillator with actual price cycles rather than lagging
📌

Trading signals

Buy signals

  • DPO crosses above 0 from below (cycle turning up)
  • DPO reaches a typical cycle low depth based on historical comparison
  • DPO begins rising from a trough with increasing momentum
  • Price bounces off support while DPO is in positive territory

Sell signals

  • DPO crosses below 0 from above (cycle turning down)
  • DPO reaches a typical cycle high based on historical comparison
  • DPO begins falling from a peak with increasing momentum
  • Price touches resistance while DPO is in negative territory
📌

Parameters

| Parameter | Default | Description | |-----------|---------|-------------| | Period | 20 | SMA period (determines cycle length detected) |

The period parameter is the most critical setting for DPO. It determines which cycle length the oscillator will emphasize. A period of 20 works well for identifying medium-term cycles (roughly 2-4 weeks on daily charts). Shorter periods (10-15) capture faster cycles, while longer periods (40-60) reveal slower, broader cycles.

📌

How DPO works in StratBase.ai

In StratBase.ai, DPO is implemented as a built-in indicator available in the backtesting engine and strategy builder. The indicator calculates automatically based on historical price data and the specified period parameter. You can add DPO to your chart, use it in conditions, and combine it with other indicators for multi-factor strategies.

StratBase.ai processes DPO values in real-time during backtesting, allowing you to test strategies based on DPO crossovers, level comparisons, and divergences. The platform displays DPO as a separate oscillator panel below the main price chart, with a zero line clearly marked for reference.

📌

Step-by-step usage instructions

Adding DPO to your strategy

  1. Open your strategy builder in StratBase.ai
  2. Navigate to the Indicators section
  3. Search for "DPO" or locate it under Oscillators
  4. Click to add DPO to your workspace
  5. Set the Period parameter (default 20, adjust based on your target cycle length)
  6. Configure the indicator panel position and color preferences

Building conditions with DPO

  1. In the Conditions section, click "Add Condition"
  2. Select DPO from the indicator dropdown
  3. Choose your condition type:
    • Cross Over 0 — Buy when DPO crosses above zero
    • Cross Under 0 — Sell when DPO crosses below zero
    • Greater Than 0 — Filter for upswing conditions
    • Less Than 0 — Filter for downswing conditions
    • Comparison — Compare current DPO value to previous values
  4. Apply any additional filters (e.g., combine with volume or price action)
  5. Save and test your conditions

Identifying cycles in your chart

  1. Add DPO to your chart with your chosen period
  2. Observe the peak-to-peak distance or trough-to-trough distance
  3. Count bars between similar DPO levels to estimate cycle length
  4. Adjust the period parameter if needed to better align peaks and troughs
  5. Mark significant highs and lows to validate the cycle pattern
💡

Practical example with real indicator values

Scenario: You're analyzing a daily chart of a stock with an approximate 30-day cycle. You decide to use DPO with a period of 30 to capture this cycle.

Setup:

  • Indicator: DPO(30)
  • Timeframe: Daily
  • Asset: Stock (e.g., SPY)

Values observed over 5 days:

  • Day 1: DPO = -1.5 (below zero, downswing)
  • Day 2: DPO = -0.8 (still below, but rising)
  • Day 3: DPO = 0.2 (crosses above zero - BUY SIGNAL)
  • Day 4: DPO = 1.2 (peaks, in upswing)
  • Day 5: DPO = 0.9 (still positive but falling)

Action: On Day 3, DPO crosses above zero, signaling the cycle is turning upward. This is a potential buy point. You confirm with price action (support hold, volume increase) before entering a long position.

Follow-up: You monitor DPO for the next 10-15 days, watching for a peak formation. When DPO reaches 2.1 and begins declining sharply, you prepare to exit. When DPO crosses below zero on Day 18, you close the position—the cycle has turned downward.

Outcome: DPO helped you identify the cycle turning point (Day 3) and the exit point (Day 18), capturing the majority of the upswing without holding into the downswing.

💡

Tips

  • Match period to your timeframe — On daily charts, a period of 20-30 captures typical swing cycles. On hourly charts, use 10-20. On weekly charts, use 40-60.
  • DPO is best for identifying repeating cycles in price data, especially in stocks or commodities with natural supply-demand cycles
  • Not suitable for trend-following strategies — Use DPO for mean-reversion and cycle-based approaches instead
  • Compare DPO across different periods to find dominant cycles in your asset
  • Works well on higher timeframes (daily, weekly) for swing and position trading
  • Combine with price support/resistance — Use DPO to identify timing within key levels
  • Watch for divergences — When price makes a new high but DPO doesn't, the cycle may be weakening
  • Use alongside volume — Confirm DPO signals with volume spikes at turning points
  • Test period extensively — Your optimal period depends on the specific asset and market conditions
📌

Common mistakes to avoid

Using DPO on intraday charts exclusively

DPO works best on daily and higher timeframes where cycles are more pronounced and repeatable. On 5-minute or 15-minute charts, false signals increase significantly because shorter cycles are noisier and less reliable.

Ignoring the displacement effect

Remember that DPO values are delayed in display. The current DPO value reflects price action from N/2 + 1 periods ago. Don't expect DPO to react instantly to new price movements—this is by design, not a flaw.

Setting the period incorrectly

If your period is too short, DPO will be too sensitive and generate false crossovers. If it's too long, you'll miss cycles entirely. Always test multiple periods and observe the peak-to-peak distance to validate your choice.

Using DPO as a standalone signal

DPO works best as a confirmation tool, not a primary entry signal. Always combine it with price action, support/resistance levels, or volume to reduce false signals.

Trading every crossover without context

Not every zero-line crossover leads to a significant move. Filter crossovers by:

  • Distance from support/resistance levels
  • Current volatility conditions
  • Volume confirmation
  • Position in the broader trend (even though DPO removes trend, the macro trend still matters for risk/reward)

Forgetting to adjust period for different assets

A period of 20 works for one stock but may be completely wrong for another. Always analyze your specific asset's cycle characteristics before deploying a DPO strategy.

💡

Example conditions for StratBase.ai

| Condition | Meaning | |-----------|---------| | DPO(20) > 0 | Price above detrended average (upswing active) | | DPO(20) < 0 | Price below detrended average (downswing active) | | DPO(20) cross_over 0 | Cycle turning upward (potential buy) | | DPO(20) cross_under 0 | Cycle turning downward (potential sell) | | DPO(20) > DPO(20)[1] | DPO rising on current bar (momentum up) | | DPO(20) < DPO(20)[1] | DPO falling on current bar (momentum down) | | DPO(30) > DPO(30)[5] | DPO higher than 5 bars ago (in an upswing) |

📌

Summary

DPO is a specialized tool for cycle-based trading. It excels at identifying when a cycle is beginning and ending, making it invaluable for mean-reversion strategies and swing trading. By removing trend noise and focusing on cyclical patterns, DPO helps you find high-probability turning points. In StratBase.ai, use DPO in combination with price levels and volume to build robust strategies that capture repeating market cycles. Test your period settings thoroughly, avoid common pitfalls like overusing intraday data, and always confirm DPO signals with additional confluence factors.

Related Resources|Fibonacci CalculatorPivot Points CalculatorTrading Blog