OPEN-SOURCE SCRIPT

RSI Divergence (Regular + Hidden + Live) - StableLogic

2 703
Take your momentum trading to the next level with the RSI Divergence (Regular + Hidden + Live) indicator. This tool doesn't just look at the past; it actively tracks developing price action to spot potential reversals and trend continuations before they fully form.

Packed with a clean, gradient-based UI, this indicator automatically scans for four specific types of divergences and visually plots them directly on your oscillator panel.

🌟 Key Features
Complete Divergence Detection: Automatically identifies and plots all four major types of divergence:

Regular Bullish: Price makes a Lower Low, but RSI makes a Higher Low (Trend Reversal).

Regular Bearish: Price makes a Higher High, but RSI makes a Lower High (Trend Reversal).

Hidden Bullish: Price makes a Higher Low, but RSI makes a Lower Low (Trend Continuation).

Hidden Bearish: Price makes a Lower High, but RSI makes a Higher High (Trend Continuation).

Live "Pending" Divergences: Unlike traditional indicators that only plot after a pivot is fully confirmed (which inherently causes lag), this script features a Live Tracking engine. It compares the current real-time candle to the last confirmed pivot, drawing a dashed line to warn you of a developing divergence.

Smart Invalidation Logic: The live tracking feature includes a mathematical crossover check. If the RSI line breaks the divergence trendline prematurely, the pending signal is automatically invalidated, keeping your chart free of false signals.

Modern Visuals: Features sleek gradient fills for the Overbought (>70) and Oversold (<30) zones, making momentum extremes easy to spot at a glance.

⚙️ Settings & Customization
RSI Length: Standard RSI lookback period (Default: 14).

Pivot Lookback (Delay): Determines how many bars are required to confirm a swing high or low. A lower number (e.g., 3) makes the indicator faster but slightly riskier/noisier. The default of 5 is a balanced standard.

History Depth: Controls how far back the indicator searches for past pivots to compare against (Default: 20).

Show Live (Pending)?: Toggle the real-time dashed tracking lines on or off.

Custom Colors: Fully customize the line and label colors for every single type of divergence to match your personal chart theme.

Pro Tips for Trading Divergence
Pending = Prepare: When you see a dashed orange "Live Pending" line, do not enter immediately. Use it as a warning to get your trigger ready. Wait for the candle to close or look for a confirmation signal (like a bullish engulfing or pin bar) on the price chart.

Context is King: Regular divergences work best at major support/resistance levels. Hidden divergences work best when trading with the higher timeframe trend.

Combine Tools: RSI divergence is a powerful tool, but it shouldn't be used in isolation. Combine it with Volume, Moving Averages, or Market Structure breaks for high-probability setups.

*** Disclaimer: This script is for educational and analytical purposes only and does not constitute financial advice.

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.