OPEN-SOURCE SCRIPT

Velocity Spectrum Analyzer [JOAT]

899
Velocity Spectrum Analyzer [JOAT]

Introduction

The Velocity Spectrum Analyzer is an advanced open-source momentum wave system that combines Munich Wave methodology with ALMA enhancement and multi-basis momentum tracking. This indicator analyzes momentum across five distinct velocity layers, creating a spectrum of momentum waves that reveal trend strength, regime shifts, and momentum alignment across multiple timeframes.

Unlike single-line momentum indicators, the Velocity Spectrum Analyzer provides multi-dimensional momentum analysis through layered EMA calculations, ALMA enhancement, regime classification, and spread analysis. The indicator is designed for traders who understand that momentum flows in waves and that multi-layer alignment signals institutional conviction.

snapshot

Why This Indicator Exists

This indicator addresses the need for multi-dimensional momentum analysis. By combining five momentum layers with ALMA enhancement and regime detection, it reveals:

  • Five Velocity Layers: Fast (9), Medium (21), Slow (55), Very Slow (100), and Ultra Slow (200) EMAs create a momentum spectrum
  • ALMA Enhancement: Arnaud Legoux Moving Average provides adaptive smoothing with reduced lag
  • Basis Calculations: Averages between EMA layers create intermediate momentum levels
  • Regime Classification: Extreme Bull/Bear detection using Bollinger-style bands
  • Spread Analysis: Distance between fast and slow layers measures momentum strength
  • Wave State Detection: All layers bullish or bearish signals strong directional momentum
  • Background Coloring: Visual regime indication shows extreme conditions


Core Components Explained

1. Core Momentum Calculation

The indicator starts with basic momentum (current close minus close N bars ago), then applies ALMA for adaptive smoothing:

The ALMA offset (default 0.85) and sigma (default 6) parameters control the balance between responsiveness and smoothness. Higher offset values shift the average toward recent prices, while higher sigma values increase smoothness.

2. Five EMA Layers

Five EMAs are calculated on the momentum values:
  • Fast EMA (9): Captures short-term momentum shifts
  • Medium EMA (21): Tracks intermediate momentum trends
  • Slow EMA (55): Identifies primary momentum direction
  • Very Slow EMA (100): Reveals long-term momentum bias
  • Ultra Slow EMA (200): Shows institutional momentum positioning


Each layer responds at different speeds, creating a spectrum of momentum perspectives.

3. Basis Calculations

Five basis levels are calculated as averages between EMA layers:
  • Basis 1: Average of Fast and Medium EMAs
  • Basis 2: Average of Medium and Slow EMAs
  • Basis 3: Average of Slow and Very Slow EMAs
  • Basis 4: Average of Very Slow and Ultra Slow EMAs
  • Basis 5: Average of Ultra Slow and Fast EMAs (wraps around)


These basis levels create intermediate momentum zones that smooth transitions between layers.

4. Trend Classification Functions

Two functions classify momentum direction:
  • Growing: Momentum > basis (bullish momentum)
  • Falling: Momentum <= basis AND momentum <= ALMA (bearish momentum)


Each basis is classified independently, creating five separate momentum assessments.

5. Regime Detection with Bollinger-Style Bands

The indicator calculates bands around the average of all five basis levels:
  • Origin: SMA of basis average (default 25 periods)
  • Deviation: Standard deviation multiplied by factor (default 6.0)
  • Top Band: Origin + deviation (extreme bullish threshold)
  • Bottom Band: Origin - deviation (extreme bearish threshold)


When basis 1 and ALMA both exceed the top band with rising momentum, the indicator signals extreme bullish conditions. When both fall below the bottom band with falling momentum, it signals extreme bearish conditions.

6. Mean Range Calculation

A long-term mean range (default 415 bars) tracks the highest and lowest basis average values. The center of this range serves as a reference point for ALMA positioning. When ALMA is above the center mean with all layers bullish, strong upward momentum is confirmed.

7. Wave State Analysis

The indicator tracks when all five basis levels are simultaneously bullish or bearish:
  • All Bullish: All five basis levels show growing momentum - strong uptrend
  • All Bearish: All five basis levels show falling momentum - strong downtrend
  • Mixed: Some layers bullish, some bearish - transitional or choppy conditions


Wave state alignment indicates institutional conviction across all momentum timeframes.

8. Spread Calculation

The spread between Basis 1 (fastest) and Basis 5 (slowest) measures momentum divergence:
  • Positive Spread (> 10): Fast momentum exceeds slow momentum - bullish acceleration
  • Negative Spread (< -10): Fast momentum below slow momentum - bearish acceleration
  • Extreme Spread (> 20 or < -20): Very strong momentum divergence - potential exhaustion


Large spreads indicate strong directional momentum, while narrowing spreads warn of momentum loss.

Visual Elements

  • Five Velocity Layer Lines: Thick colored lines showing each basis level with dynamic coloring (cyan = bullish, yellow = bearish, white = neutral)
  • ALMA Enhanced Line: Separate line showing ALMA-adjusted momentum with tri-color scheme
  • Wave State Line: Zero line colored based on overall wave state
  • Background Regime: Red background for extreme bull, green background for extreme bear
  • Information Dashboard: Displays wave state, regime, spread, ALMA position, momentum value, layer alignment, and signal status


snapshot

Signal Generation

The indicator generates four types of signals:

Lean Short: Bearish crossover with falling Basis 1 and 2, spread <= -10
Maybe Buy: Bearish crossover with falling Basis 1 and 2, extreme bear regime, spread <= -20 (oversold)
Lean Long: Bullish crossover with growing Basis 1 and 2, spread >= 10
Maybe Sell: Bullish crossover with growing Basis 1 and 2, extreme bull regime, spread >= 20 (overbought)

Additional signals:
All Aqua: All layers bullish for 4+ consecutive bars - strong uptrend confirmation
All Yellow: All layers bearish for 4+ consecutive bars - strong downtrend confirmation

How to Use This Indicator

Step 1: Check Wave State
Monitor the dashboard for wave state (All Bullish, All Bearish, or Mixed). Trade in the direction of wave state alignment.

Step 2: Analyze Regime
Watch for extreme bull/bear regimes (red/green backgrounds). These often precede reversals or strong continuation moves.

Step 3: Monitor Spread
Large spreads (> 20 or < -20) indicate strong momentum but potential exhaustion. Narrowing spreads warn of momentum loss.

Step 4: Check ALMA Position
ALMA above center mean with bullish layers confirms uptrend. ALMA below center mean with bearish layers confirms downtrend.

Step 5: Count Layer Alignment
The dashboard shows how many layers are bullish (X/5). 5/5 bullish = strongest uptrend, 0/5 bullish = strongest downtrend.

Step 6: Wait for Signal Confirmation
Lean Long/Short signals work best when wave state aligns. Maybe Buy/Sell signals at extremes offer reversal opportunities.

Best Practices

  • Trade with wave state alignment, not against it
  • Use extreme regimes as reversal warnings, not continuation signals
  • Monitor spread for momentum strength - large spreads indicate strong trends
  • Wait for all layers to align (5/5) before taking aggressive positions
  • Use Maybe Buy/Sell signals only at extreme regimes with high spread
  • Combine with price action - momentum shows intent, price shows result
  • Be cautious when layers are mixed (2/5 or 3/5) - indicates choppy conditions
  • Watch for spread narrowing as early warning of trend exhaustion


Input Parameters

Momentum Engine:
  • Source: Price input (default: close)
  • Momentum Length: Period for momentum calculation (default: 21)
  • ALMA Offset: Offset parameter for ALMA (default: 0.85)
  • ALMA Sigma: Sigma parameter for ALMA (default: 6)


Momentum Layers:
  • Fast EMA: Short-term momentum (default: 9)
  • Medium EMA: Intermediate momentum (default: 21)
  • Slow EMA: Primary momentum (default: 55)
  • Very Slow EMA: Long-term momentum (default: 100)
  • Ultra Slow EMA: Institutional momentum (default: 200)


Regime Classification:
  • Mean Lookback: Period for mean range (default: 415)
  • StdDev Length: Period for standard deviation (default: 25)
  • StdDev Multiplier: Band width multiplier (default: 6.0)
  • Background Offset: Shift background display (default: 0)


Visual Configuration:
  • Bullish Color: Color for bullish momentum (default: cyan)
  • Bearish Color: Color for bearish momentum (default: yellow)
  • Neutral Color: Color for neutral momentum (default: white)
  • Enable Alerts: Toggle alert conditions (default: enabled)


Originality Statement

This indicator is original in its multi-layer momentum approach. While individual components (EMAs, ALMA, momentum) are established concepts, this indicator is justified because:

  • It combines five distinct momentum layers into a unified spectrum analysis
  • The basis calculation system creates intermediate momentum zones between layers
  • ALMA enhancement provides adaptive smoothing with reduced lag
  • Regime detection using Bollinger-style bands on basis average identifies extremes
  • Wave state analysis tracks alignment across all five layers simultaneously
  • Spread calculation measures momentum divergence between fast and slow layers
  • The comprehensive dashboard presents all momentum dimensions simultaneously


Disclaimer

This indicator is provided for educational and informational purposes only. It is not financial advice. Trading involves substantial risk of loss. Momentum analysis does not guarantee profitable trades. Past momentum patterns 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

Disclaimer

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.