type
status
date
slug
summary
AI summary
AI translation
tags
category
password
icon
💡
By registering an account on OKX Crypto Exchange using the invitation link from blackcat1402, you can enjoy several benefits. These include a 10% rebate on spot contract trades, a 20% discount on fees, permanent access to blackcat1402 Membership and Advanced Indicators, free internal testing of the Advanced Trading System, and exclusive services such as member technical indicator customization and development.
💡
OKX Crypto Exchange blackcat1402 invitation registration link:
Today, this cat is going to introduce a technical indicator that is like a magical time machine, capable of helping us remove trends from prices and identify short-term cycles. This indicator is called the "Detrended Price Oscillator" (DPO) for short.
notion image
DPO does not align perfectly with the current price, but instead it is shifted to the left (in the past) by a certain distance, which helps eliminate the current trend. Because of this, DPO is not considered a momentum oscillator. It only measures the range and typical duration of cycles by comparing past prices with a simple moving average.
The calculation method is simple: Past price (N/2 + 1) periods ago - N-period simple moving average = DPO, where N represents the user-defined lookback period.
DPO compares past prices with a simple moving average that is shifted (in the past direction). On the chart, we can see the SMA displayed as the zero line, while DPO fluctuates between positive values (above the zero line) and negative values (below the zero line). In other words, positive values indicate prices above the SMA, while negative values indicate prices below the SMA.
notion image
Therefore, the main purpose of DPO is to analyze historical data to observe cycles in market movements. Through DPO, technical analysts can better understand the typical range and duration of a cycle's highs and lows.
However, DPO does not necessarily mean that it can generate signals. Instead, it is more suitable for identifying typical cycle characteristics of trading instruments when identifying market conditions. Therefore, it is best to combine DPO with other indicators that are designed to measure trends or momentum.
For the Detrended Price Oscillator indicator itself, we have some adjustable options:
  • You can toggle the display of DPO and the price line it represents.
  • You can choose the color, thickness, and visual style (default is solid line) of the DPO line.
  • The zero line can also be adjusted to show or hide, and you can choose the line value, thickness, and visual type (default is dashed line).
  • The precision setting determines the number of decimal places to keep before rounding. The larger this number, the more decimal places there will be in the indicator value.
notion image
In short, the Detrended Price Oscillator (DPO) explores market cycles in historical data and helps us understand the characteristics of typical cycles. Remember, when using DPO, it is best to combine it with other indicators for a more comprehensive market analysis. Next, let's explore the TradingView code implementation of this technical indicator.
This code is an indicator for calculating the Detrended Price Oscillator (DPO). It uses the Pine Script language, which is a scripting language specifically developed for the TradingView platform and does not support other platforms directly.
First, the script version is specified as 5 in the first line //@version=5.
Next, an indicator is defined using the indicator() function, and some parameters are set. These include the title, short title, price format, precision, and timeframe.
Then, an integer input variable period_ is defined using the input.int() function, representing the length. It can be set with a minimum value of 1.
After that, a boolean input variable isCentered is defined using the input() function, representing whether to display centered.
Next, the number of periods to look back is calculated based on the input variables and assigned to the variable barsback = period_/2 + 1.
Then, the simple moving average (SMA) of the closing price is calculated using the talib.sma() function, and the result is assigned to the variable ma.
After that, the value of the Detrended Price Oscillator (DPO) is calculated based on whether it should be centered or not. If centered, it takes close[barsback] - ma, otherwise it takes close - ma[barsback].
Finally, the DPO line is plotted using the plot() function, with specified offset and color. Additionally, a zero line is plotted using the hline() function.
去趋势价格震荡指标(DPO):一种神奇的时间机器再聊改进的神奇九转,揭秘TDS升级的奥秘
blackcat1402
blackcat1402
This cat is an esteemed coding influencer on TradingView, commanding an audience of over 8,000 followers. This cat is proficient in developing quantitative trading algorithms across a diverse range of programming languages, a skill that has garnered widespread acclaim. Consistently, this cat shares invaluable trading strategies and coding insights. Regardless of whether you are a novice or a veteran in the field, you can derive an abundance of valuable information and inspiration from this blog.
Announcement
type
status
date
slug
summary
AI summary
AI translation
tags
category
password
icon
🎉Webhook Signal Bots for Crypto are Coming!🎉
--- Stay Tuned ---
👏From TradingView to OKX, Binance and Bybit Exchange Directly!👏