Detrended Price Oscillator Trading Strategy (DPO) – Rules, Setup, Backtest, Returns Analysis
Detrended Price Oscillator (DPO) is a technical analysis indicator. According to the author’s idea, the indicator is built without considering trend movements on the chart, which allows a more accurate determination of overbought and oversold levels.
Similar to a moving average, it also filters out directionality (trend) in price values, making it easier to spot cyclicality.
The indicator determines cyclicality by plotting the moving average as a horizontal straight line and then placing price values along this line according to their relation to the moving average.
In this article, we make specific trading rules and backtest the Detrended price oscillator.
Related reading: – Are you searching for other indicator trading strategies? (We have plenty more)
Detrended Price Oscillator (DPO) example
Visual representation of the Detrended Price Oscillator with a 20-month period applied on the SPY (S&P 500) price chart:
Detrended Price Oscillator Formula
Let’s look in more detail at the formula:
DPO = [Close Price from 2/N+1 periods ago] – [N period SMA]
where
N = Number of periods used for the look-back period
SMA = Simple Moving Average
How to Calculate The Detrended Price Oscillator
Here’s an example of how you can use the indicator:
- Determine a lookback period, such as 20 periods;
- Find the closing price from n/2 +1 periods ago. If using 20 periods, this is the price from 11 periods ago;
- Calculate the SMA for the last N periods. In this case, 20;
- Subtract the SMA value (step 3) from the closing price N/2 +1 periods ago (step 2) to get the DPO value.
Detrended Price Oscillator Strategy Rules
Since Detrended Price Oscillator is an oscillator similar to oscillators like Stochastic, we will use a simple counter-trend strategy:
- We will buy if the DPO reaches oversold levels and crosses the -X% level from top to bottom;
- We will sell if the DPO reaches overbought levels and crosses the +X% level from the bottom up;
- We will use short-term DPO with an N-day period.
This is what the DPO strategy rules look visually with a 5-day period DPO, -1% oversold level and +1% overbought level:
Detrended Price Oscillator Strategy (DPO) Portfolio
Since we need to have a portfolio to backtest the Detrended Price Oscillator strategy, we will use the following five asset classes with equal portfolio weightings:
Asset Class | Portfolio Weight |
U.S. Stocks | 20% |
Foreign Stocks | 20% |
U.S. Bonds | 20% |
U.S. REITs | 20% |
World Commodities | 20% |
- U.S Stocks – U.S. large- and mid-cap growth and value stocks that virtually replicate the benchmark S&P 500 stock index;
- Foreign Stocks – non-U.S. large- and mid-cap stocks of different countries outside the US that have a low correlation with U.S. stocks;
- U.S Bonds – short-, medium- and long-term U.S. treasury, municipal, and investment-grade corporate bonds;
- REITs (real estate investment trusts) – they have the same rewards and risks as “traditional” stocks but also have a historically low correlation with “traditional” stocks and various types of bonds;
- Commodities – they are alternative types of investment and include metals, wood, oil, gas, grains, meat and many other tangible commodities. The advantage of commodities is that their market dynamics do not depend on each other and do not depend on the market dynamics of stocks, bonds, REITs, and other “traditional” assets.
We have picked these ETFs, which are well diversified, have high liquidity, and a long performance history:
Portfolio Sector | ETF Name | ETF Ticker |
U.S Stocks | SPDR S&P 500 ETF Trust | SPY |
Foreign (International) Stocks | iShares MSCI EAFE ETF | EFA |
U.S Bonds | Vanguard Total Bond Market Index Fund | BND |
U.S REITs | iShares U.S. Real Estate ETF | IYR |
World Commodities | Invesco DB Commodity Index Tracking Fund | DBC |
Backtesting Of The Detrended Price Oscillator Strategy
Backtesting conditions are the following:
• The simple mean-reverting strategy described above is used;
• The above-described ETFs with the appropriate weights are picked;
• Historical quotes are adjusted for dividends;
• Backtesting interval is from 2007 until today.
First, let’s run the backtester in optimization mode to choose the most optimal strategy parameters. Results are sorted by CAR/MDD column (the last two columns show the periods and thresholds):
Net % Profit | CAR | Max. Sys % Drawdown | CAR/MDD | Profit Factor | # Trades | Avg % Profit/Loss | Period | Threshold |
150.98 | 5.75 | -19.89 | 0.29 | 2.18 | 164 | 3.35 | 15 | 0.03 |
126.23 | 5.08 | -21.89 | 0.23 | 1.77 | 251 | 1.91 | 15 | 0.025 |
84.12 | 3.78 | -17.96 | 0.21 | 1.43 | 381 | 0.93 | 15 | 0.02 |
151.33 | 5.75 | -27.05 | 0.21 | 2.11 | 202 | 2.62 | 20 | 0.03 |
137.19 | 5.38 | -26.8 | 0.2 | 1.85 | 280 | 1.79 | 20 | 0.025 |
87.36 | 3.89 | -24.61 | 0.16 | 1.47 | 384 | 0.91 | 20 | 0.02 |
88.91 | 3.94 | -24.31 | 0.16 | 1.71 | 217 | 1.73 | 5 | 0.02 |
44.8 | 2.27 | -21.05 | 0.11 | 1.81 | 86 | 2.6 | 5 | 0.03 |
60.37 | 2.91 | -31.07 | 0.09 | 1.29 | 542 | 0.53 | 20 | 0.015 |
52.22 | 2.58 | -29.56 | 0.09 | 1.29 | 411 | 0.63 | 5 | 0.015 |
36.56 | 1.91 | -25.3 | 0.08 | 1.18 | 566 | 0.36 | 15 | 0.015 |
53.39 | 2.63 | -32.65 | 0.08 | 1.45 | 209 | 1.44 | 10 | 0.025 |
52.52 | 2.6 | -33.33 | 0.08 | 1.35 | 314 | 0.85 | 10 | 0.02 |
60.31 | 2.91 | -35.77 | 0.08 | 1.25 | 769 | 0.37 | 5 | 0.01 |
41.54 | 2.13 | -29.19 | 0.07 | 1.44 | 138 | 1.82 | 10 | 0.03 |
43.39 | 2.21 | -39.93 | 0.06 | 1.14 | 1580 | 0.13 | 5 | 0.005 |
25.4 | 1.38 | -39.42 | 0.04 | 1.12 | 778 | 0.2 | 20 | 0.01 |
32.4 | 1.72 | -43.68 | 0.04 | 1.18 | 510 | 0.39 | 10 | 0.015 |
17.69 | 0.99 | -25.74 | 0.04 | 1.2 | 137 | 0.81 | 5 | 0.025 |
15.22 | 0.86 | -32.84 | 0.03 | 1.07 | 876 | 0.12 | 15 | 0.01 |
19.58 | 1.09 | -40.21 | 0.03 | 1.07 | 1434 | 0.08 | 10 | 0.005 |
10.29 | 0.6 | -29.06 | 0.02 | 1.04 | 1397 | 0.06 | 15 | 0.005 |
13.43 | 0.77 | -40.58 | 0.02 | 1.06 | 1222 | 0.08 | 20 | 0.005 |
4.6 | 0.27 | -43.4 | 0.01 | 1.02 | 847 | 0.07 | 10 | 0.01 |
As we can see, the most optimal parameters are Period = 15 and Threshold = 2.5%. With these parameters, we get a statistically significant number of trades (251) and quite a high Avg P/L (1.91%).
Now let’s run the backtester and get the results for these particular settings.
This is what the portfolio equity curve looks like:
Portfolio underwater curve (drawdowns, i.e., decline in value from a relative peak value to a relative trough):
Portfolio monthly and annual returns:
Year | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec | Yr% |
2007 | 0.8% | -0.7% | 0.3% | 0.8% | 0.5% | -1.0% | -2.7% | -1.8% | 2.8% | 2.1% | -6.2% | -2.2% | -7.3% |
2008 | -1.8% | 1.7% | -1.5% | 3.5% | 2.0% | -3.7% | -0.2% | -1.1% | -5.6% | -0.4% | -3.7% | 7.5% | -4.0% |
2009 | -7.4% | -0.0% | -1.0% | 7.4% | 7.2% | -0.2% | 4.3% | 3.0% | 1.5% | 0.5% | 1.9% | 1.2% | 19.1% |
2010 | -1.0% | -0.0% | 3.1% | 1.7% | -5.5% | -4.6% | 2.7% | -1.8% | 4.1% | 2.5% | -1.4% | 4.5% | 3.9% |
2011 | 2.4% | 3.3% | -0.7% | 2.7% | 0.6% | -3.0% | -1.0% | -2.4% | -5.6% | 7.8% | -1.5% | 0.1% | 1.9% |
2012 | 4.2% | 2.7% | 1.2% | -0.5% | -5.4% | 3.4% | 1.4% | 2.6% | 0.4% | -0.3% | 0.6% | 1.6% | 12.1% |
2013 | 2.6% | 0.4% | 1.7% | 2.9% | -2.0% | -1.1% | 2.0% | -2.6% | 3.2% | 1.6% | -0.1% | 1.2% | 10.1% |
2014 | -1.1% | 3.4% | 0.1% | 1.3% | 1.6% | 0.9% | -1.0% | 1.9% | -2.5% | 2.4% | 1.4% | -0.7% | 7.9% |
2015 | 1.0% | 1.8% | -1.4% | 2.1% | -0.2% | -1.1% | 0.4% | -2.8% | -0.8% | 3.0% | -0.2% | -0.6% | 1.1% |
2016 | -3.1% | -3.8% | 4.9% | 1.7% | 0.8% | 1.0% | 3.0% | -1.4% | -0.7% | -2.0% | 0.2% | 2.0% | 2.1% |
2017 | 1.0% | 2.0% | -0.2% | 0.5% | 0.9% | 0.5% | 2.1% | 0.4% | 1.1% | 1.7% | 1.5% | 1.2% | 13.5% |
2018 | 2.3% | -5.3% | 0.6% | 1.0% | 1.4% | 0.3% | 0.9% | 1.0% | 0.3% | -4.7% | -0.9% | -2.9% | -6.2% |
2019 | 4.6% | 1.3% | 1.7% | 1.4% | -2.2% | 3.8% | 0.2% | -0.5% | 1.9% | 1.4% | 0.7% | 1.4% | 16.7% |
2020 | 0.0% | -4.0% | -7.3% | -1.7% | 4.1% | 2.3% | 3.7% | 3.2% | -2.7% | -3.6% | 9.0% | 3.4% | 5.5% |
2021 | 0.1% | 3.4% | 0.8% | 5.0% | 1.9% | 1.6% | 2.1% | 0.9% | -1.9% | 4.8% | -3.5% | 4.6% | 21.2% |
2022 | -2.3% | -0.3% | 1.7% | -4.2% | 1.2% | -6.4% | 5.2% | -2.7% | -3.0% | 0.4% | 2.4% | -1.3% | -9.3% |
2023 | 1.2% | -1.5% | 1.5% | 0.9% | -1.8% | 1.6% | N/A | N/A | N/A | N/A | N/A | N/A | 1.9% |
Portfolio performance statistics compared to benchmark S&P 500 Total Return index:
Statistical Metric | Portfolio | S&P 500 TR |
Annual Return % | 5.08% | 8.95% |
Exposure % | 75.25% | 100.00% |
Risk Adjusted Return % | 6.75% | 8.95% |
Max. drawdown | -21.89% | -55.19% |
CAR/MaxDD | 0.23 | 0.16 |
Standard Deviation | 10.99% | 22.64% |
Sharpe Ratio (3% risk-free) | 0.19 | 0.26 |
There are individual performance stats per asset class since inception:
Ticker | Exposure % | CAR | RAR | Max. Sys % Drawdown | CAR/MDD | Anual Standard Deviation (%) | Sharpe Ratio (3% Risk-Free Rate) |
IYR | 68.41 | 8.45 | 12.35 | -48.24 | 0.18 | 20.43 | 0.27 |
SPY | 75.22 | 6.84 | 9.09 | -48.08 | 0.14 | 15.71 | 0.25 |
BND | 90.4 | 2.24 | 2.48 | -19.58 | 0.11 | 4.64 | -0.16 |
EFA | 85.58 | 4.37 | 5.1 | -49.34 | 0.09 | 18.08 | 0.08 |
DBC | 52.15 | 3.69 | 7.07 | -43.19 | 0.09 | 15.2 | 0.05 |
Below is the equity curve of the best-performing asset class (IYR):
Conclusion On The Detrended Price Oscillator Strategy
The mean-reverting DPO strategy works, but it fails to beat buy and hold for most assets. However, volatility and risk are lower, and the Detrended Price Oscillator can thus be used as a drawdown-reduction filter for many timing models.
FAQ:
What is the Detrended Price Oscillator (DPO)?
The Detrended Price Oscillator is a technical analysis indicator designed to eliminate trend movements on the chart, providing a more accurate determination of overbought and oversold levels. Unlike traditional indicators, DPO filters out directionality (trend) in price values, focusing on cyclicality. It plots the moving average as a horizontal line and positions price values along this line based on their relation to the moving average.
How can the Detrended Price Oscillator be used to reduce drawdowns in a portfolio?
While the mean-reverting DPO strategy may not outperform buy and hold, it can serve as a drawdown-reduction filter for many timing models. By incorporating DPO into a portfolio strategy, volatility and risk can be lower, contributing to more stable performance.
What are the key statistics to consider when evaluating the performance of the Detrended Price Oscillator strategy?
Key statistics include Annual Return %, Exposure %, Risk-Adjusted Return %, Max. Drawdown, CAR/MaxDD ratio, Standard Deviation, and Sharpe Ratio. These metrics provide insights into the strategy’s profitability, risk management, and overall effectiveness.