OPEN-SOURCE SCRIPT

Divergence Indicator [Trendoscope®]

已更新
🎲 New Divergence Indicator by Trendoscope

Our latest Divergence Indicator revolutionizes the way traders identify market trends and potential reversals. Built upon the robust foundation of the Zigzag Trend Divergence Detector and inline with our recent implementation of the Divergence Goggles indicator, this tool is designed to be intuitive yet powerful, making it an essential addition to any trader's toolkit.

We received several queries on extending the Divergence Goggles to last N bars instead of using an interactive widget. Though it is possible, we thought the better approach is to enable the indicator to use any oscillator and trend indicator in order to define the divergence.

🎯 Key Features
  1. Flexible Oscillator Integration: Choose from a wide range of built-in oscillators or import your own, including options like the innovative Multiband Oscillator. This versatility extends to using volume indicators like OBV for divergence calculations, broadening the scope of analysis.
  2. Trend Identification Versatility: Utilize built-in methods like Zigzag and MA Difference, or integrate external trend indicators. Our system adapts to various methods, ensuring you have the right tools for precise trend identification.
  3. Customizable Zigzag Sensitivity: Adjust the Zigzag based on your chosen oscillator's sensitivity to ensure divergence lines are accurate and visually coherent.
  4. Repainting vs. Delayed Signals: Tailor the indicator to your strategy by choosing between immediate repainting signals and slightly delayed but more stable signals.


🎯 Understanding Divergence: Key Rules

Bullish Divergence
  • Happens only in downtrend
  • Observed on Pivot Lows
  • Price makes lower low whereas oscillator makes higher low, indicating weakness and possible reversal


Bearish Divergence
  • Happens only in uptrend
  • Observed on Pivot Highs
  • Price makes higher high whereas oscillator makes lower high, indicating weakness and possible reversal


Bullish Hidden Divergence
  • Happens only in uptrend
  • Observed on Pivot Lows
  • Price makes higher low, whereas indicator makes lower low due to price consolidation. In bullish trend, this is considered as bullish as the price gets a breather and get ready to surge further.


Bearish Hidden Divergence
  • Happens only in downtrend
  • Observed on Pivot Highs
  • Price makes lower high whereas oscillator makes higher high due to price consolidation. In bearish trend, this is considered as bearish as the price gets a breather and get ready to fall further.


🎯 Visual Insights: Divergence and Hidden Divergence
For a clearer understanding, refer to our visual guides:
Quick Look - Bullish Divergence vs Bearish Divergence

Bullish Hidden Divergence vs Bearish Hidden Divergence


🎲 Using the Divergence Indicator: A Step-by-Step Guide

🎯 Step 1 - Selecting the Oscillator

Customize your analysis by choosing from a variety of oscillators or importing your preferred one. Options are available to select a range of built-in oscillators and the loopback length. However, if the oscillator that user want to use is not in the list, they can simply load the oscillator from the indicator library and use it as an external signal.

快照

In our current example, we are using a custom oscillator called - Multiband Oscillator
快照

This also means, the indicator option is not limited to oscillators. Users can even make use of volume indicators such as OBV for the calculation of divergence.

快照

🎯 Step 2 - Choosing the Trend Identification Method

Select from our built-in methods or integrate an external indicator to accurately identify market trends. Trend is one of the key parameters of divergence type identification. Trend can be identified mathematically by various methods. Some of them are as simple as above or below 200 moving average and some can follow trend based indicators such as supertrend and others can be very complex.

To cater for a wider audience, here too we have provided the option to use an external trend indicator. The simple condition for the external trend indicator is that it should return positive value for uptrend and negative value for downtrend.

Other than that, we also have 2 built in trend identification methods.
  1. Zigzag - The trend is defined by the starting pivot of divergence line. If the starting pivot is Higher High or Higher Low, then it is considered uptrend. And if the starting pivot is either Lower Low or Lower High, then we consider it as downtrend.
  2. MA Difference - In this case, the difference between the moving average of pivots joining the divergence line will determine the trend. It is considered uptrend if the moving average increased from starting pivot to ending pivot of the divergence line, and it is considered downtrend if the moving average decreased from starting pivot to the ending pivot of the divergence line.


快照

🎯 Step 3 - Adjusting Zigzag Sensitivity

Fine-tune the Zigzag to match the oscillator's sensitivity, ensuring divergence lines are accurate and visually coherent.

🎯 Step 4 - Managing Repainting

Understand the implications of repainting in the last pivot of the Zigzag and choose between immediate or delayed signals based on your trading strategy. The last pivot of the zigzag repaint by design. This is not necessarily a bad thing. Users can just choose not to use the last pivot, but instead use the last but one for all the calculations. But, this also means, the signals will be delayed.

Indicator provides option to use repainting signal vs delayed signal. If you select the repaint option, the signals are shown immediately as and when they occur. But, there is a possibility that these signals change when the new price candles change zigzag pivot.

If you chose not to select the repaint option, then the divergence signals may lag by a few bars.
發布通知
Updates

  1. Add calculation bars to limit the number of bars for which the indicator is calculated. This is helpful in reducing the load time.
  2. Added alerts and settings to enable/disable each divergence type in alerts.
Chart patternsDivergenceHarmonic PatternshewhomustnotbenamedtrendoscopeZig Zag Indicator

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?

免責聲明