PROTECTED SOURCE SCRIPT
Aggiornato NQ vs ES-RTY-YM Divergence

NQ vs ES-RTY-YM Divergence Indicator: Complete Guide
What This Indicator Does
This indicator measures the relative performance of Nasdaq futures (NQ) compared to a composite average of other major US index futures (ES/S&P 500, RTY/Russell 2000, and YM/Dow Jones). It normalizes price data to create a clear comparison between tech-heavy Nasdaq and the broader market, helping identify sector rotation, relative strength, and potential trading opportunities.
How It Works
The indicator performs these calculations:
Data Collection: Retrieves closing prices for NQ, ES, RTY, and YM futures
Composite Creation: Averages ES, RTY, and YM to create a "broader market" composite
Normalization: Applies min-max scaling to both NQ and the composite over a lookback period (default: 20 bars)
This transforms values to a range between 0 and 1
Formula: normalized_value = (current_price - lowest_low) / (highest_high - lowest_low)
Divergence Calculation: Subtracts the normalized composite from normalized NQ
Formula: divergence = nq_normalized - composite_normalized
Result ranges from -1.0 (extreme NQ underperformance) to +1.0 (extreme NQ outperformance)
Visual Elements
The indicator displays:
Blue line: Normalized NQ performance (0-1 range)
Orange line: Normalized composite performance (0-1 range)
Histogram:
Green bars: Positive divergence (NQ outperforming composite)
Red bars: Negative divergence (NQ underperforming composite)
Zero line: Neutral reference point
Overbought/oversold lines: Customizable thresholds (default ±0.1)
Information table: Current divergence value (only in non-MTF version)
Interpreting the Indicator
Divergence Values
Positive values (0 to +1): NQ outperforming the composite
The higher the value, the stronger the relative outperformance
Negative values (0 to -1): NQ underperforming the composite
The lower the value, the stronger the relative underperformance
Zero: Equal normalized performance between NQ and composite
Significant Levels
Crossing above bullish threshold (default +0.1): Significant tech sector strength
Crossing below bearish threshold (default -0.1): Significant tech sector weakness
Extreme readings (near ±0.3 or beyond): Potentially overextended moves that might reverse
Practical Applications
Market Analysis
Sector rotation identification: Detect shifts between tech and other sectors
Market regime analysis: Tech leadership often indicates risk-on conditions
Divergence warnings: When price trends differ from relative strength trends
Trading Approaches
Momentum trading: Enter NQ positions when divergence shows increasing strength
Mean reversion: Consider counter-trend positions at extreme readings
Confirmation tool: Use alongside price patterns and other indicators
Relative performance trading: Guide allocation between tech and broader market exposure
Customization Options
The indicator offers several parameters:
Normalization Window: Controls the lookback period for min-max calculations
Shorter (5-10): More responsive, noisier
Longer (20-50): Smoother, slower to respond
Overbought/Oversold Levels: Customize based on your threshold preferences
Tighter levels (±0.05): More frequent signals
Wider levels (±0.2): Only the most extreme divergences
Alert Thresholds: Set when you want to be notified of significant changes
These determine when alert conditions trigger
Display Options: Customize colors and visual elements
Key Considerations
The indicator normalizes data within a rolling window, so extreme readings are relative to recent history, not absolute
Works best on futures markets with liquid contracts to ensure accurate relative performance measurement
Most effective when used to complement price action analysis rather than in isolation
The zero line represents equal normalized performance, not equal price performance (due to the normalization process)
By tracking this specialized form of relative performance, the indicator provides insights into market dynamics that aren't obvious from price action alone, helping traders identify potential shifts in market leadership between technology and other sectors.
What This Indicator Does
This indicator measures the relative performance of Nasdaq futures (NQ) compared to a composite average of other major US index futures (ES/S&P 500, RTY/Russell 2000, and YM/Dow Jones). It normalizes price data to create a clear comparison between tech-heavy Nasdaq and the broader market, helping identify sector rotation, relative strength, and potential trading opportunities.
How It Works
The indicator performs these calculations:
Data Collection: Retrieves closing prices for NQ, ES, RTY, and YM futures
Composite Creation: Averages ES, RTY, and YM to create a "broader market" composite
Normalization: Applies min-max scaling to both NQ and the composite over a lookback period (default: 20 bars)
This transforms values to a range between 0 and 1
Formula: normalized_value = (current_price - lowest_low) / (highest_high - lowest_low)
Divergence Calculation: Subtracts the normalized composite from normalized NQ
Formula: divergence = nq_normalized - composite_normalized
Result ranges from -1.0 (extreme NQ underperformance) to +1.0 (extreme NQ outperformance)
Visual Elements
The indicator displays:
Blue line: Normalized NQ performance (0-1 range)
Orange line: Normalized composite performance (0-1 range)
Histogram:
Green bars: Positive divergence (NQ outperforming composite)
Red bars: Negative divergence (NQ underperforming composite)
Zero line: Neutral reference point
Overbought/oversold lines: Customizable thresholds (default ±0.1)
Information table: Current divergence value (only in non-MTF version)
Interpreting the Indicator
Divergence Values
Positive values (0 to +1): NQ outperforming the composite
The higher the value, the stronger the relative outperformance
Negative values (0 to -1): NQ underperforming the composite
The lower the value, the stronger the relative underperformance
Zero: Equal normalized performance between NQ and composite
Significant Levels
Crossing above bullish threshold (default +0.1): Significant tech sector strength
Crossing below bearish threshold (default -0.1): Significant tech sector weakness
Extreme readings (near ±0.3 or beyond): Potentially overextended moves that might reverse
Practical Applications
Market Analysis
Sector rotation identification: Detect shifts between tech and other sectors
Market regime analysis: Tech leadership often indicates risk-on conditions
Divergence warnings: When price trends differ from relative strength trends
Trading Approaches
Momentum trading: Enter NQ positions when divergence shows increasing strength
Mean reversion: Consider counter-trend positions at extreme readings
Confirmation tool: Use alongside price patterns and other indicators
Relative performance trading: Guide allocation between tech and broader market exposure
Customization Options
The indicator offers several parameters:
Normalization Window: Controls the lookback period for min-max calculations
Shorter (5-10): More responsive, noisier
Longer (20-50): Smoother, slower to respond
Overbought/Oversold Levels: Customize based on your threshold preferences
Tighter levels (±0.05): More frequent signals
Wider levels (±0.2): Only the most extreme divergences
Alert Thresholds: Set when you want to be notified of significant changes
These determine when alert conditions trigger
Display Options: Customize colors and visual elements
Key Considerations
The indicator normalizes data within a rolling window, so extreme readings are relative to recent history, not absolute
Works best on futures markets with liquid contracts to ensure accurate relative performance measurement
Most effective when used to complement price action analysis rather than in isolation
The zero line represents equal normalized performance, not equal price performance (due to the normalization process)
By tracking this specialized form of relative performance, the indicator provides insights into market dynamics that aren't obvious from price action alone, helping traders identify potential shifts in market leadership between technology and other sectors.
Note di rilascio
Added multi timeframe analysis capabilityScript protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarle liberamente e senza alcuna limitazione – ulteriori informazioni qui.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarle liberamente e senza alcuna limitazione – ulteriori informazioni qui.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.