Divergence Constellation [JOAT]Divergence Constellation
Introduction
The Divergence Constellation is an advanced open-source multi-oscillator divergence detection system that combines RSI, MACD, TSI, and Stochastic analysis with sophisticated pivot detection and confluence scoring. This indicator identifies both regular and hidden divergences across multiple oscillators simultaneously, creating a constellation of divergence signals that reveal potential reversals and trend continuations with high probability.
Unlike single-oscillator divergence tools, the Divergence Constellation provides multi-dimensional divergence analysis through composite oscillator calculation, four-oscillator confluence scoring, regular and hidden divergence detection, and chart projection. The indicator is designed for traders who understand that divergences confirmed across multiple oscillators provide significantly higher probability setups than single-oscillator divergences.
Why This Indicator Exists
This indicator addresses the need for systematic multi-oscillator divergence analysis. By combining four distinct oscillators with confluence scoring, it reveals:
Regular Bullish Divergence: Price makes lower low, oscillators make higher low (reversal up signal)
Regular Bearish Divergence: Price makes higher high, oscillators make lower high (reversal down signal)
Hidden Bullish Divergence: Price makes higher low, oscillators make lower low (trend continuation up)
Hidden Bearish Divergence: Price makes lower high, oscillators make higher high (trend continuation down)
Confluence Scoring: Counts how many oscillators confirm the divergence (1-4 score)
Composite Oscillator: Unified oscillator combining all four components
Chart Projection: Divergence lines drawn on both oscillator pane and main chart
Core Components Explained
1. Four-Oscillator System
The indicator calculates four distinct oscillators, each providing unique momentum perspective:
RSI (Relative Strength Index):
Measures momentum by comparing average gains to average losses
Zero-centered (subtracts 50) for composite integration
Sensitive to overbought/oversold conditions
Default period: 14
MACD (Moving Average Convergence Divergence):
Measures relationship between two exponential moving averages
Histogram shows momentum acceleration/deceleration
Responsive to trend changes
Default periods: 12, 26, 9
TSI (True Strength Index):
Double-smoothed momentum indicator
Filters noise while preserving trend direction
Excellent for divergence detection
Default periods: 25, 13
Stochastic:
Compares close to recent high-low range
Zero-centered (subtracts 50) for composite integration
Identifies overbought/oversold extremes
Default periods: 14, 3
2. Composite Oscillator Calculation
All four oscillators are combined into a unified composite:
Composite = (RSI + MACD + TSI + Stochastic) / 4
This composite oscillator provides a balanced view of momentum across all four methodologies. Divergences are detected on the composite, then confirmed by checking individual oscillators.
3. Pivot Detection System
The indicator uses sophisticated pivot detection to identify divergence points:
Pivot Left/Right: Number of bars on each side for pivot confirmation (default: 5)
Price Pivots: Identifies swing highs and lows in price
Oscillator Pivots: Identifies swing highs and lows in each oscillator
Lookback Range: Min (5) to Max (60) bars for comparing pivots
Pivots must be confirmed (bars on both sides) before divergence analysis begins.
4. Regular Divergence Detection
Regular divergences signal potential reversals:
Regular Bullish Divergence:
Price makes lower low (current pivot low < previous pivot low)
Composite oscillator makes higher low (current pivot low > previous pivot low)
Indicates weakening downward momentum - potential reversal up
Best at oversold levels (composite < -20)
Regular Bearish Divergence:
Price makes higher high (current pivot high > previous pivot high)
Composite oscillator makes lower high (current pivot high < previous pivot high)
Indicates weakening upward momentum - potential reversal down
Best at overbought levels (composite > 20)
5. Hidden Divergence Detection
Hidden divergences signal trend continuation:
Hidden Bullish Divergence:
Price makes higher low (current pivot low > previous pivot low)
Composite oscillator makes lower low (current pivot low < previous pivot low)
Indicates strong underlying bullish momentum - trend continuation up
Confirms uptrend strength
Hidden Bearish Divergence:
Price makes lower high (current pivot high < previous pivot high)
Composite oscillator makes higher high (current pivot high > previous pivot high)
Indicates strong underlying bearish momentum - trend continuation down
Confirms downtrend strength
6. Confluence Scoring System
When a divergence is detected on the composite, the indicator checks all four individual oscillators:
Score 1/4: Only one oscillator confirms - weak divergence
Score 2/4: Two oscillators confirm - moderate divergence (minimum for signals)
Score 3/4: Three oscillators confirm - strong divergence
Score 4/4: All four oscillators confirm - extreme divergence (highest probability)
The minimum confluence score (default 2) filters out weak divergences that lack multi-oscillator confirmation.
7. Signal Generation Logic
Signals are generated only at extreme oscillator levels with anti-overlap logic:
Bullish Signals:
Regular bullish divergence detected
Composite oscillator < -20 (oversold)
Confluence score >= minimum (default 2)
At least 20 bars since last bullish signal (anti-overlap)
Bearish Signals:
Regular bearish divergence detected
Composite oscillator > 20 (overbought)
Confluence score >= minimum (default 2)
At least 20 bars since last bearish signal (anti-overlap)
Extreme Signals:
Confluence score = 4/4 (all oscillators confirm)
Composite at extreme levels (< -30 or > 30)
Displayed as diamond shapes for emphasis
8. Visual Divergence Lines
Divergence lines are drawn connecting pivot points:
Regular Divergences: Solid lines (green = bullish, red = bearish)
Hidden Divergences: Dashed lines (cyan = bullish, orange = bearish)
Oscillator Pane: Lines drawn on composite oscillator
Chart Projection: Lines also drawn on main price chart (optional)
Lines provide visual confirmation of the divergence pattern and help identify the exact pivot points involved.
Visual Elements
Four Oscillator Lines: Thick colored lines showing RSI (cyan), MACD (magenta), TSI (yellow), and Stochastic (green)
Composite Line: White line showing unified oscillator
Zero Line: Gray horizontal line at zero
Overbought/Oversold Zones: Shaded areas at +30/-30 levels
Divergence Lines: Solid/dashed lines connecting pivot points
Signal Triangles: Small triangles at signal generation points
Extreme Diamonds: Larger diamonds for 4/4 confluence signals
Information Dashboard: Displays composite position, confluence score, RSI/MACD/TSI/Stochastic status, composite value, divergence types, signal strength, extreme events, and overall verdict
How to Use This Indicator
Step 1: Monitor Composite Position
Check if composite oscillator is at extreme levels (> 30 overbought, < -30 oversold). Divergences at extremes have highest probability.
Step 2: Check Confluence Score
Look for confluence scores of 3/4 or 4/4. Higher scores indicate stronger divergence confirmation across multiple oscillators.
Step 3: Identify Divergence Type
Regular divergences signal reversals, hidden divergences signal trend continuation. Trade accordingly.
Step 4: Wait for Signal Confirmation
Don't trade divergence lines alone. Wait for signal triangles that confirm divergence meets all criteria (extreme level, confluence, anti-overlap).
Step 5: Look for Extreme Events
Diamond shapes indicate 4/4 confluence at extreme levels - highest probability setups.
Step 6: Confirm with Price Action
Use divergence signals as alerts, then confirm with price action, support/resistance, or other indicators before entering.
Step 7: Check Individual Oscillators
Dashboard shows status of each oscillator. All four overbought/oversold provides additional confirmation.
Best Practices
Trade only divergences with confluence score >= 2 (default minimum)
Focus on regular divergences at extreme levels (< -30 or > 30) for reversals
Use hidden divergences to confirm trend continuation, not as standalone entries
Wait for signal triangles - don't front-run divergence lines
4/4 confluence signals (diamonds) offer highest probability setups
Combine with support/resistance levels for additional confirmation
Avoid divergences in middle range (-20 to +20) - wait for extremes
Use higher timeframe divergences for stronger significance
Input Parameters
Pivot Detection:
Pivot Left: Bars to left of pivot (default: 5)
Pivot Right: Bars to right of pivot (default: 5)
Max Lookback: Maximum bars to compare pivots (default: 60)
Min Lookback: Minimum bars to compare pivots (default: 5)
Oscillator Configuration:
RSI Length: Period for RSI (default: 14)
MACD Fast: Fast EMA period (default: 12)
MACD Slow: Slow EMA period (default: 26)
MACD Signal: Signal line period (default: 9)
TSI Long: Long smoothing period (default: 25)
TSI Short: Short smoothing period (default: 13)
Stochastic K: K period (default: 14)
Stochastic D: D smoothing (default: 3)
Divergence Rules:
Show Regular Divergence: Toggle regular divergence detection (default: enabled)
Show Hidden Divergence: Toggle hidden divergence detection (default: enabled)
Min Confluence Score: Minimum oscillators that must confirm (default: 2)
Project on Chart: Draw divergence lines on main chart (default: enabled)
Visual Configuration:
Bullish/Bearish Divergence Colors: Colors for regular divergences
Hidden Bullish/Bearish Colors: Colors for hidden divergences
Originality Statement
This indicator is original in its multi-oscillator confluence approach. While individual oscillators and divergence concepts are established, this indicator is justified because:
It combines four distinct oscillators into a unified composite system
The confluence scoring system measures divergence strength across multiple oscillators
Automatic detection of both regular and hidden divergences with pivot analysis
Signal generation includes extreme level filtering and anti-overlap logic
Chart projection allows divergence visualization on both oscillator and price chart
The comprehensive dashboard presents all oscillator states and divergence metrics simultaneously
Integration of multiple oscillator perspectives creates higher probability divergence signals
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice. Trading involves substantial risk of loss. Divergence analysis does not guarantee profitable trades or reversals. Past divergences do not guarantee future results. Always use proper risk management and never risk more than you can afford to lose.
-Made with passion by officialjackofalltrades
Indicador Pine Script®


















