Detrended Price Oscillator (DPO) is a handy technical indicator that helps traders identify when a market is overbought or oversold. It’s also great for generating buy and sell signals.
The XXDPO focuses on the fundamental cycles of price movement by filtering out trends. Essentially, it smooths out the moving average into a line, allowing price changes above and below it to act as a trend oscillator.
This indicator is particularly useful for pinpointing short-term cycles. By analyzing these short-term elements within longer-term cycles, traders can identify potential reversal points. The DPO doesn’t take long-term price cycles into account, making those short-term fluctuations stand out.
Calculation:
Here’s how to calculate the XXDPO:
Where:
- XMA - the smoothing algorithm;
- Price[] - the current price of the asset;
- SMOOTH_Period - the period for smoothing the indicator;
- DPO_Period - the period for DPO smoothing;
- bar - the index of the bar.
Understanding Trading Signals:
When the DPO is above the zero line (meaning the price is above its moving average), it indicates a bullish signal. Conversely, if the DPO is below the zero line (the price is below its moving average), it signals a bearish trend.
For spotting long-term cycle reversal points (divergences):
- If the chart forms a higher peak or a deeper trough, be on the lookout for a price reversal;
- If a peak or bottom is lower/higher than the last one, expect the price to drop.
There are two interpretations for buy/sell signals:
You should consider buying when:
- The DPO crosses the zero line upwards;
- The DPO is in the oversold area, confirmed by previous lows, and the upper channel line is being broken by both the DPO and the price, limiting any downward movement.
You should think about selling when:
- The DPO crosses the zero line downwards;
- The DPO is in the overbought zone, confirmed by previous highs, and both the DPO and the price are breaking through the support line of an upward trend.
Keep in mind that this indicator isn’t the go-to for trading signals on its own. It shines when used in conjunction with other indicators. Still, it’s a valuable tool for revealing cycles and determining the optimal width for other indicator windows.
This indicator allows you to choose from ten different smoothing and averaging algorithms:
- SMA - simple moving average;
- EMA - exponential moving average;
- SMMA - smoothed moving average;
- LWMA - linear weighted moving average;
- JJMA - JMA adaptive average;
- JurX - ultralinear smoothing;
- ParMA - parabolic smoothing;
- T3 - Tillson's multiple exponential smoothing;
- VIDYA - smoothing using Tushar Chande's algorithm;
- AMA - smoothing with Perry Kaufman's algorithm.
Note that the Phase1 and Phase2 parameters vary in meaning depending on the smoothing algorithm. For JMA, it’s an external Phase variable ranging from -100 to +100. For T3, it’s a smoothing ratio multiplied by 100 for better visualization. For VIDYA, it’s the CMO oscillator period, and for AMA, it’s a slow EMA period. In other algorithms, these parameters don’t affect smoothing. For AMA, the fast EMA period is a fixed value set at 2 by default, and the raising power ratio is also 2.
The indicator uses classes from the SmoothAlgorithms.mqh library (which must be copied to the terminal_data_folder\MQL5\Include). You can find a detailed explanation of these classes in the article "Averaging Price Series for Intermediate Calculations Without Using Additional Buffers".


Comments 0