RSI-Divergence Goggles [Trendoscope®]

🎲 Introducing the RSI-Divergence Goggle

🎯 Revolutionizing Divergence Analysis in Trading
While the concept of divergence plays a crucial role in technical analysis, existing indicators in the community library have faced limitations, particularly in simultaneously displaying divergence lines on both price and oscillator graphs. This challenge stems from the fact that RSI and other oscillators are typically plotted in a separate pane from the price chart. Traditional Pine Script® indicators are confined to a single pane, thus restricting comprehensive divergence analysis.

🎯 Our Innovative Solution: RSI on the Price Pane
The RSI-Divergence Goggle breaks through these limitations. Our innovative approach involves plotting the RSI directly onto the price pane within a movable and resizable widget. This groundbreaking feature allows for the simultaneous drawing of zigzag patterns on both price and the oscillator, enabling the effective calculation and visualization of divergence lines on both.

🎯 The Foundation: Our Divergence Research and Rules
Our journey into divergence research began three years ago with the launch of the "Zigzag Trend Divergence Detector." The foundational rules established with this script remain pertinent and form the basis of all our subsequent divergence-based indicators.

🎯 Understanding Divergence: Key Concepts
  • Divergence Varieties: We identify two main types - Bullish Divergence (and its hidden counterpart) occurs at pivot lows, while Bearish Divergence (and its hidden version) appears at pivot highs.
  • Contextual Occurrence: Bullish divergence is a phenomenon of downtrends, whereas bearish divergence is unique to uptrend. Conversely, hidden bullish divergence arises in uptrends, and hidden bearish divergence in downtrends.
  • Oscillator Behavior: In standard divergence scenarios, the oscillator lags behind price, signaling potential reversals. In hidden divergence cases, the oscillator leads, suggesting trend continuation.

🎯 Visual Insights: Divergence and Hidden Divergence
For a clearer understanding, refer to our visual guides:

🎯 A Word of Caution
While divergence is a powerful tool, it's not a standalone guarantee of trend reversals or continuations. We recommend using these patterns in conjunction with support and resistance levels, as demonstrated in our "Divergence Based Support Resistance" implementation.

🎯 Using the RSI-Divergence Goggles

Upon applying the indicator to your chart, you'll be prompted to select two corner points, defining the widget's placement and size. This widget is the stage for your RSI plotting and divergence calculations. Choose these points carefully to ensure they encompass your area of interest without overlapping important price bars.

An example as below.

🎯 Innovative Features:
  1. Plotting RSI: RSI values are scaled from 0 to 100 within the widget. This unique plotting may not align with individual bar values, but pivot labels and tooltips provide detailed RSI and retracement ratio information.
  2. Zigzag and Pivots: Our adjusted RSI plots determine the zigzag pivot highs and lows, which may not always correspond with visible price pivots. However, calculations based on close prices ensure minimal deviation.
  3. Divergence Display: Divergence types are identified following our established rules, with a simple moving average employed to discern the prevailing trend.

🎯 Trend Detection Mechanism
A simple moving average is used as base for determining the trend. If the difference between moving averages of the alternate pivots is positive, then the sentiment is considered to be uptrend. Else, we consider the sentiment to be in downtrend.

This is a simple method to identify trend, implemented via this indicator. The indicator does not provide alternative methods to identify trend. This is something that we can explore in the future.

🎯 Interactive and Customizable
The RSI-Divergence Goggle isn't just a static tool; it's an interactive feature on your chart. You can move or resize the widget, allowing for dynamic analysis and focused study on different chart segments.

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?