Detrended Price Oscillator (DPO)
Unlike other oscillators, such as the stochastic or moving average convergence divergence (MACD), the DPO is not a momentum indicator. It instead highlights peaks and troughs in price, which are used to estimate buy and sell points in line with the historical cycle.The detrended price oscillator seeks to help a trader identify an asset’s price cycle. It does this by comparing an SMA to a historical price that is near the middle of the look-back period.
How to Calculate the Detrended Price Oscillator (DPO)
- Determine a lookback period, such as 20 periods.
- Find the closing price from x/2 +1 periods ago. If using 20 periods, this is the price from 11 periods ago.
- Calculate the SMA for the last x periods. In this case, 20.
- Subtract the SMA value (step 3) from the closing price x/2 +1 periods ago (step 2) to get the DPO value.
We have added these conditions:
- DPO is above/below level
- DPO crosses above/below level
You can easily do your conditions in Custom blocks. More informations you can find here:
- https://strategyquant.com/doc/strategyquant/custom-blocks/
- https://strategyquant.com/doc-category/strategy-templates-custom-blocks/
- https://www.youtube.com/watch?v=CGkn5kh_etc
How to import custom indicators to SQX: https://strategyquant.com/doc/programming-for-sq/import-export-custom-indicators-and-other-snippets/
Excellent !!!!!! This will help a lot !!!!! Thank you ??
One of the Long awaited indicators!
i believe its faulty. I double checked with debug console and calculation starts from bar 0 which is 1st on the chart (the oldest time stamp) to last bar so lookbacks must use i– not i++. See also this https://strategyquant.com/forum/topic/are-dpo-and-tdi-indicators-faulty/