declare lower; # Triple AO Wave Rider - Unified Momentum System # Logic: Combines 3 AO timeframes into single wave strength score # Helps ride trends and warns of exhaustion/reversals # Inputs input fastShort = 3; input fastLong = 21; input medShort = 5; input medLong = 34; input slowShort = 8; input slowLong = 55; input waveExhaustionLevel = 80; input showWaveStructure = yes; # Calculate three Awesome Oscillators def fastAO = Average(hl2, fastShort) - Average(hl2, fastLong); def medAO = Average(hl2, medShort) - Average(hl2, medLong); def slowAO = Average(hl2, slowShort) - Average(hl2, slowLong); # Normalize each AO to comparable scale (-100 to +100) def fastRange = Highest(AbsValue(fastAO), 50); def medRange = Highest(AbsValue(medAO), 50); def slowRange = Highest(AbsValue(slowAO), 50); def fastNorm = if fastRange > 0 then (fastAO / fastRange) * 100 else 0; def medNorm = if medRange > 0 then (medAO / medRange) * 100 else 0; def slowNorm = if slowRange > 0 then (slowAO / slowRange) * 100 else 0; # Color momentum (is each AO accelerating or decelerating) def fastGreen = fastAO > fastAO[1]; def medGreen = medAO > medAO[1]; def slowGreen = slowAO > slowAO[1]; # Wave strength calculation with dynamic weighting # Fast gets more weight when starting moves, slow gets more weight in trends def trendStrength = AbsValue(slowNorm); def fastWeight = if trendStrength < 30 then 0.5 else 0.3; def medWeight = 0.3; def slowWeight = if trendStrength < 30 then 0.2 else 0.4; # Combined wave score def waveScore = (fastNorm * fastWeight + medNorm * medWeight + slowNorm * slowWeight); # Wave momentum (how fast the wave is building/falling) def waveMomentum = waveScore - waveScore[3]; def waveAccelerating = waveMomentum > 5; def waveDecelerating = waveMomentum < -5; # Wave structure analysis def alignedGreen = fastGreen and medGreen and slowGreen; def alignedRed = !fastGreen and !medGreen and !slowGreen; def mixedStructure = !alignedGreen and !alignedRed; # Divergence between timeframes (reversal warning) def fastSlowDivergence = (fastNorm > 0 and slowNorm < 0) or (fastNorm < 0 and slowNorm > 0); def extremeDivergence = AbsValue(fastNorm - slowNorm) > 100; # Wave exhaustion detection def waveExtended = AbsValue(waveScore) > waveExhaustionLevel; def exhaustionWarning = waveExtended and waveDecelerating; # Reversal patterns def bullishReversal = waveScore < -40 and waveMomentum > 10 and fastGreen; def bearishReversal = waveScore > 40 and waveMomentum < -10 and !fastGreen; # Define wave states def strongUpWave = waveScore > 50 and alignedGreen and !exhaustionWarning; def upWave = waveScore > 20 and !exhaustionWarning; def strongDownWave = waveScore < -50 and alignedRed and !exhaustionWarning; def downWave = waveScore < -20 and !exhaustionWarning; def neutral = AbsValue(waveScore) <= 20; # Plot unified wave indicator plot WaveRider = waveScore; WaveRider.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); WaveRider.SetLineWeight(4); WaveRider.AssignValueColor( if exhaustionWarning then Color.YELLOW else if strongUpWave then Color.GREEN else if upWave then Color.DARK_GREEN else if strongDownWave then Color.RED else if downWave then Color.DARK_RED else if mixedStructure then Color.GRAY else Color.LIGHT_GRAY ); # Plot wave momentum line plot MomentumLine = waveMomentum; MomentumLine.SetDefaultColor(Color.CYAN); MomentumLine.SetLineWeight(2); # Plot structure indicator plot StructureDots = if showWaveStructure then if alignedGreen then 90 else if alignedRed then -90 else if fastSlowDivergence then 0 else Double.NaN else Double.NaN; StructureDots.SetPaintingStrategy(PaintingStrategy.POINTS); StructureDots.AssignValueColor( if alignedGreen then Color.GREEN else if alignedRed then Color.RED else Color.YELLOW ); StructureDots.SetLineWeight(3); # Reference lines plot ExhaustionHigh = waveExhaustionLevel; ExhaustionHigh.SetDefaultColor(Color.ORANGE); ExhaustionHigh.SetStyle(Curve.SHORT_DASH); plot StrongHigh = 50; StrongHigh.SetDefaultColor(Color.DARK_GREEN); StrongHigh.SetStyle(Curve.SHORT_DASH); plot WeakHigh = 20; WeakHigh.SetDefaultColor(Color.GRAY); WeakHigh.SetStyle(Curve.SHORT_DASH); plot ZeroLine = 0; ZeroLine.SetDefaultColor(Color.WHITE); ZeroLine.SetStyle(Curve.FIRM); plot WeakLow = -20; WeakLow.SetDefaultColor(Color.GRAY); WeakLow.SetStyle(Curve.SHORT_DASH); plot StrongLow = -50; StrongLow.SetDefaultColor(Color.DARK_RED); StrongLow.SetStyle(Curve.SHORT_DASH); plot ExhaustionLow = -waveExhaustionLevel; ExhaustionLow.SetDefaultColor(Color.ORANGE); ExhaustionLow.SetStyle(Curve.SHORT_DASH); # Reversal signals plot BullReversalSignal = if bullishReversal then -70 else Double.NaN; BullReversalSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP); BullReversalSignal.SetDefaultColor(Color.GREEN); BullReversalSignal.SetLineWeight(3); plot BearReversalSignal = if bearishReversal then 70 else Double.NaN; BearReversalSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); BearReversalSignal.SetDefaultColor(Color.RED); BearReversalSignal.SetLineWeight(3); # Main action label AddLabel(yes, if exhaustionWarning and waveScore > 0 then "⚠ WAVE EXHAUSTION - Consider Exit Long" else if exhaustionWarning and waveScore < 0 then "⚠ WAVE EXHAUSTION - Consider Exit Short" else if strongUpWave and waveAccelerating then "STRONG UP WAVE - Ride It! 🌊" else if strongUpWave then "Strong Up Wave - Stay Long" else if upWave and alignedGreen then "Up Wave Building - Buy Dips" else if strongDownWave and waveAccelerating then "STRONG DOWN WAVE - Ride It! 🌊" else if strongDownWave then "Strong Down Wave - Stay Short" else if downWave and alignedRed then "Down Wave Building - Sell Rips" else if bullishReversal then "🔄 BULLISH REVERSAL SIGNAL" else if bearishReversal then "🔄 BEARISH REVERSAL SIGNAL" else if extremeDivergence then "⚠ EXTREME DIVERGENCE - Caution!" else if neutral and mixedStructure then "Choppy Waters - No Clear Wave" else if neutral then "Calm Waters - Wait for Wave" else "Wave Transitioning", if exhaustionWarning then Color.YELLOW else if strongUpWave and waveAccelerating then Color.UPTICK else if strongDownWave and waveAccelerating then Color.DOWNTICK else if bullishReversal or bearishReversal then Color.MAGENTA else if strongUpWave or strongDownWave then Color.LIGHT_GREEN else if extremeDivergence then Color.LIGHT_ORANGE else Color.WHITE ); # Wave statistics AddLabel(yes, "Wave: " + Round(waveScore, 0) + " | " + "Momentum: " + Round(waveMomentum, 0) + " | " + "Structure: " + (if alignedGreen then "↑↑↑" else if alignedRed then "↓↓↓" else "Mixed") + " | " + (if waveAccelerating then "Accelerating" else if waveDecelerating then "Decelerating" else "Steady"), if AbsValue(waveScore) > 50 then Color.LIGHT_GREEN else if AbsValue(waveScore) > 20 then Color.LIGHT_GRAY else Color.WHITE ); # Divergence warning AddLabel(extremeDivergence, "DIVERGENCE: Fast (" + Round(fastNorm, 0) + ") vs Slow (" + Round(slowNorm, 0) + ")", Color.YELLOW );