Pullbacks are always the hardest part of the trade and when it happens, we struggle to make a decision on whether to continue the trade and wait for recovery or cut losses. Similarly, when an instrument is trending well, it is often a difficult decision to make if we want to take some profit off the table. This indicator is aimed to make these decisions easier by providing a combined opinion of sentiment based on trend and possible divergence.
Link to the Indicator: Zigzag Trend Divergence Detector
Process of Deriving the Divergence
- Use any indicator to find trend bias. Here we are using simple supertrend
- Use any oscillator. I have added a few inbuilt oscillators as an option. The default used is RSI.
- Find divergence by using a zigzag to detect the pivot high/low of a price and observe indicator movement difference between subsequent pivots in the same direction.
- Combine divergence type, divergence bias and trend bias to derive overall sentiment.
Complete details of all the possible combinations are present here along with the table legend
- C - Continuation
- D - Divergence
- H - Hidden Divergence
- I - Indeterminate
These let you choose zigzag properties. If you check "Use confirmed pivots", then unconfirmed pivots will be ignored in the table and in the chart
Let you select different oscillators and settings. Available oscillators involve
- CCI - Commodity Channel Index
- CMO - Chande Momentum Oscillator
- COG - Center Of Gravity
- DMI - Directional Movement Index (Only ADX is used here)
- MACD - Moving average convergence divergence (Can choose either histogram or MACD line)
- MFI - Money Flow Index
- MOM - Momentum oscillator
- ROC - Rate Of Change
- RSI - Relative Strength Index
- TSI - Total Strength Index
- WPR - William Percent R
- BB - Bollinger Percent B
- KC - Keltner Channel Percent K
- DC - Donchian Channel Percent D
- ADC - Adoptive Donchian Channel Percent D (Adoptive-Donchian-Channel)
Supertrend is used for trend bias. Colouring option colour candles in the direction of supertrend. More options for trend bias can be added in future.
Enables you to display history in tabular format.
Built-in alerts are provided using the alert function. Options available to disable or enable individual types of divergence status are provided via input.
Overview of settings present here:
- Trend detection is done only with respect to the previous pivot in the same direction. Hence, if the chart has too many zigzags in a short period, try increasing the zigzag length or chart timeframe. Similarly, if there is a steep trend, use lower timeframe charts to dig further.
- Oscillators do not always make pivots at the same bar as the price. Due to this, some of the divergence calculations may not be correct. Hence visual inspection is always recommended.