OPEN-SOURCE SCRIPT

Lattice Trend Helix [JOAT]

1 039
Lattice Trend Helix [JOAT]

Introduction

The Lattice Trend Helix is an open-source trend analysis indicator built in Pine Script v6. It combines a GMMA-inspired multi-EMA fan system (19 exponential moving averages across fast and slow groups) with a pivot-center SuperTrend, RSI momentum confirmation, and a comprehensive trend strength scoring system. The indicator detects EMA fan alignment, measures trend strength on a 0-100 scale, identifies fan expansion/contraction dynamics, and generates priority-ranked signals including full confluence locks, fan crosses, SuperTrend flips, EMA 200 reclaims, fan burst breakouts, SuperTrend bounces, and displacement impulses.

The Guppy Multiple Moving Average (GMMA) concept, originally developed by Daryl Guppy, uses two groups of EMAs to visualize the behavior of short-term traders (fast group) and long-term investors (slow group). When both groups are aligned and separated, a strong trend is in place. When they converge and cross, a trend change is developing. This indicator extends the GMMA concept by adding a pivot-based SuperTrend for dynamic support/resistance, RSI filtering for momentum confirmation, and a quantified scoring system that turns visual alignment into a measurable number.

תמונת-בזק

Why This Indicator Exists

Single moving average crossover systems are prone to whipsaws. Even dual-MA systems produce frequent false signals in choppy markets. The GMMA approach solves this by requiring alignment across many EMAs simultaneously — a much higher bar than a simple crossover. This indicator takes that concept further:

  • 19-EMA Fan System: 11 fast EMAs (periods 3 through 23) capture short-term trader sentiment. 8 slow EMAs (periods 25 through 60) capture longer-term investor positioning. Full alignment of all 11 fast EMAs in order is a strong signal that short-term traders agree on direction. Full alignment of all 8 slow EMAs confirms institutional agreement.
  • Pivot-Center SuperTrend: Unlike standard SuperTrend which uses HL2 as the center, this implementation uses a weighted average of detected pivot points. Each new pivot high or low updates the center using the formula: center = (center * 2 + pivot) / 3. This creates a more responsive center line that adapts to actual market structure rather than simple bar midpoints. ATR-based bands around this center define the trend direction.
  • Trend Strength Score (0-100): Quantifies trend strength from three components — fast EMA alignment (50 points), slow EMA alignment (30 points), and price position relative to EMA 200 (20 points). A score of 100 means all 19 EMAs are perfectly aligned and price is on the correct side of the 200 EMA.
  • Fan Spread Dynamics: The distance between the fastest EMA (3) and slowest fast EMA (23), normalized by ATR, measures how "open" the fan is. An expanding fan indicates strengthening trend momentum. A contracting fan warns of potential trend exhaustion or reversal.
  • RSI Momentum Filter: RSI must agree with the fan direction for the highest-confidence signals. This prevents false confluence signals during momentum divergences.
  • EMA 200 Macro Filter: Price must be above the 200 EMA for confirmed bullish signals and below for confirmed bearish signals, ensuring alignment with the macro trend.


How the EMA Fan Alignment Works

The fast fan consists of 11 EMAs at periods 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, and 23. For bullish alignment, every EMA must be above the next longer one:

Pine Script®


This is an extremely high bar. In choppy markets, the fast EMAs will be tangled and neither fastBull nor fastBear will be true. Only in genuine trending conditions do all 11 EMAs sort into perfect order. The same logic applies to the 8 slow EMAs.

The indicator counts how many adjacent pairs are aligned (0-10 for fast, 0-7 for slow) to produce a granular alignment score even when full alignment is not achieved. This allows the trend strength score to reflect partial alignment — a market with 8/10 fast pairs aligned is stronger than one with 4/10, even though neither achieves full alignment.

Pivot-Center SuperTrend

The SuperTrend component uses a unique center calculation based on detected pivot points:

  • Pivot highs and lows are detected using ta.pivothigh() and ta.pivotlow() with a configurable period
  • Each new pivot updates the center line using an exponentially weighted formula that gives 2/3 weight to the existing center and 1/3 to the new pivot
  • Upper and lower bands are calculated as center +/- (ATR Factor * ATR)
  • Trend direction flips when price crosses the opposite band
  • The trailing stop ratchets in the trend direction — it can only move favorably, never against the trend


This pivot-based center produces a SuperTrend that is more responsive to actual market structure than the standard HL2-based version. It adapts to the rhythm of the market's swing points rather than just the midpoint of each bar.

Signal Priority System

The indicator generates 8 types of signals, ranked by priority with cooldown-based anti-overlap:

  • P1 — HELIX LOCK (highest): Full fan alignment (fast + slow) + RSI confirmation + price above/below EMA 200. This is the maximum confluence signal — every factor agrees. A highlight box is drawn around the signal candle.
  • P2 — LATTICE SYNC: Full fan alignment (fast + slow) without RSI/EMA200 confirmation. Strong but not maximum confluence.
  • P3 — TREND FLIP: SuperTrend direction change. The pivot-center SuperTrend has flipped from bearish to bullish or vice versa.
  • P4 — FAN CROSS: The fast fan median (EMA 13) crosses the slow fan median (EMA 40). This is the GMMA equivalent of a moving average crossover, but using the center of each fan group.
  • P5 — MACRO CROSS: Price crosses the EMA 200 — a major structural event that changes the macro trend context.
  • P6 — FAN BURST: The fan spread transitions from contracting to expanding while the trend score is above 50. This indicates a breakout from compression — similar to a Bollinger squeeze release but measured through EMA dynamics.
  • P7 — ST BOUNCE: Price touches the SuperTrend line and bounces in the trend direction. This is a pullback-to-support/resistance signal unique to this indicator. A separate 5-bar cooldown prevents repeated bounce signals during extended touches.
  • P8 — IMPULSE (lowest): Displacement candle detection — large body (>70% of range, >2x average body). These indicate aggressive institutional order flow.


Trend Strength Score Breakdown

The 0-100 score is computed from three weighted components:

  • Fast EMA Alignment (50 points): The number of aligned adjacent pairs (max 10) divided by 10, multiplied by 50. Full fast alignment = 50 points. Half alignment = 25 points.
  • Slow EMA Alignment (30 points): The number of aligned adjacent pairs (max 7) divided by 7, multiplied by 30. Full slow alignment = 30 points.
  • EMA 200 Filter (20 points): If price is above EMA 200 and the fast fan leans bullish, or below EMA 200 and the fast fan leans bearish, 20 points are added. This rewards macro-aligned trends.


The score is displayed in the HUD with both a number and a visual bar (||||......). Scores above 70 indicate strong, tradeable trends. Scores between 40-70 indicate developing or weakening trends. Below 40 indicates choppy or transitional conditions.

Visual Design

The indicator uses a "Cyberpunk" color theme — electric cyan, hot magenta, neon yellow, deep violet, and chrome accents:

  • Fast EMA Fan: All 11 lines in a single color that adapts to alignment — cyan for bullish, magenta for bearish, steel grey for neutral. Configurable opacity.
  • Slow EMA Fan: All 8 lines in deeper tones — teal for bullish, violet for bearish, steel grey for neutral.
  • EMA 200: Three-layer neon glow effect (outer glow, mid glow, core line) that shifts between cyan (above) and violet (below).
  • Holographic Ribbon: Fill between the fastest (EMA 3) and slowest (EMA 23) fast EMAs, creating a ribbon that expands with trend strength and contracts during consolidation.
  • SuperTrend: Four-layer neon glow step-line (88%, 72%, 50%, 10% transparency) in cyan (bullish) or magenta (bearish).
  • Regime Background: Subtle background tinting for confirmed bull (cyan) or confirmed bear (magenta) conditions.
  • Candle Coloring: Multi-tier coloring based on confirmation level — confirmed bull/bear, strong bull/bear, weak bull/bear, or neutral.


תמונת-בזק

HUD Dashboard

The HUD displays 14 metrics:

  • Trend direction (Bullish/Bearish/Neutral)
  • Strength score with visual bar (||||......)
  • Fan state (Strong Bull/Bear, Weak Bull/Bear, Converging)
  • SuperTrend direction
  • EMA 200 position (Above/Below)
  • Alignment counts (Fast: X/10, Slow: X/7)
  • Fan Spread value with state (Expanding/Contracting/Stable)
  • RSI value with bull/bear/neutral classification
  • Confluence count (0-5): fast alignment + slow alignment + SuperTrend agreement + RSI agreement + EMA 200 agreement
  • SuperTrend distance from price
  • Volume ratio (current vs 20-bar average)
  • Confirmed signal status (CONFIRMED BULL/BEAR or ---)


Input Parameters

EMA Fan:
  • Show Fast/Slow EMAs: Toggle each fan group
  • Show EMA 200: Toggle macro filter line
  • Fast/Slow EMA Opacity: Control transparency of each fan group


SuperTrend:
  • Show SuperTrend: Toggle the pivot-center SuperTrend
  • Pivot Period: Lookback for pivot detection (default: 3)
  • ATR Factor: Band width multiplier (default: 2.5)
  • ATR Length: Period for ATR calculation (default: 14)


Visual:
  • Show Trend Ribbon: Toggle holographic ribbon fill
  • Show Fan Crosses: Toggle fan cross signals
  • Show Regime Background: Toggle background tinting
  • SuperTrend Neon Glow: Toggle 4-layer glow effect
  • Color Candles: Toggle multi-tier candle coloring
  • HUD Panel: Toggle dashboard


Momentum Filter:
  • Show RSI Confirmation: Toggle RSI requirement for confirmed signals
  • RSI Length: Period (default: 14)
  • RSI Bull/Bear Threshold: Directional thresholds (default: 55/45)


How to Use This Indicator

Step 1: Check Fan Alignment
Look at the fan state in the HUD. "Strong Bull" or "Strong Bear" means both fast and slow fans are fully aligned — the strongest trend condition. "Weak" means only the fast fan is aligned — a developing or weakening trend.

Step 2: Verify with SuperTrend
The SuperTrend should agree with the fan direction. Fan bullish + SuperTrend bullish = high conviction. Disagreement suggests a transitional market.

Step 3: Check the Strength Score
Scores above 70 are strong trends. Use the visual bar for quick assessment. The confluence count (0-5) tells you how many independent factors agree.

Step 4: Trade the Signals
HELIX LOCK is the highest-conviction entry — all factors agree. LATTICE SYNC and TREND FLIP are strong. FAN CROSS and MACRO CROSS are structural. ST BOUNCE provides pullback entries within established trends.

Step 5: Monitor Fan Spread
Expanding fan = strengthening trend. Contracting fan = weakening trend or approaching reversal. FAN BURST signals mark the transition from contraction to expansion.

Best Practices

  • The 19-EMA fan is most effective on timeframes of 5 minutes and above. Very low timeframes produce too much noise for meaningful alignment.
  • Full fan alignment is rare and powerful. Do not expect it on every trade — it represents the highest-conviction conditions.
  • The SuperTrend bounce signal works best in established trends. In choppy markets, bounces may fail.
  • Fan crosses (fast median vs slow median) are the GMMA equivalent of MA crossovers — they confirm trend changes but lag the actual turn.
  • The EMA 200 filter is a macro-level gate. Ignoring it means trading against the larger trend, which reduces probability.
  • Use the fan spread dynamics to time entries — entering when the fan is expanding gives you momentum. Entering when it is contracting means you are fighting exhaustion.
  • The confluence count (0-5) is a quick decision filter. 4-5 = high conviction. 2-3 = moderate. 0-1 = low conviction.


Limitations

  • EMAs are lagging indicators. Full fan alignment is confirmed after the trend has already started, not at the exact turn.
  • The 19-EMA system uses significant computational resources. On very long charts with many bars, loading may be slower.
  • Pivot-center SuperTrend depends on pivot detection, which has an inherent delay equal to the pivot period.
  • Fan alignment can persist in overextended trends. Full alignment does not mean the trend will continue indefinitely.
  • The RSI filter can occasionally prevent valid signals during strong momentum divergences.
  • The indicator is optimized for trending markets. In range-bound conditions, the fan will be tangled and few signals will fire — which is by design.
  • EMA periods are fixed (3-23 fast, 25-60 slow). Different instruments or timeframes might benefit from different period sets, but the GMMA standard periods are well-tested across markets.


Technical Implementation

Built with Pine Script v6 using:
  • 19 EMA calculations at global scope (11 fast + 8 slow) for Pine v6 compliance
  • Pivot-based SuperTrend center with exponentially weighted pivot averaging
  • Granular alignment counting (0-10 fast, 0-7 slow) for trend strength scoring
  • Fan spread normalization by ATR for cross-instrument comparability
  • 8-tier priority signal system with cooldown-based anti-overlap
  • Separate cooldown tracking for SuperTrend bounce signals
  • 4-layer neon glow rendering for SuperTrend and EMA 200
  • Holographic ribbon fill between fan extremes
  • Multi-tier candle coloring based on confirmation level
  • barstate.isconfirmed gating on all signal generation
  • 9 alert conditions covering alignment changes, fan crosses, SuperTrend flips, confirmed signals, and fan expansion


Originality Statement

This indicator is original in its synthesis of the GMMA fan concept with pivot-center SuperTrend and quantified trend scoring. While GMMA and SuperTrend are established concepts, this indicator is justified because:

  • The pivot-center SuperTrend uses a weighted average of actual market pivots rather than simple HL2, creating a more structurally responsive trend line
  • The trend strength score (0-100) quantifies fan alignment into a single actionable metric with three weighted components
  • Fan spread dynamics (expansion/contraction tracking normalized by ATR) provide momentum acceleration/deceleration information not available in standard GMMA implementations
  • The 8-tier priority signal system with separate cooldown tracking for SuperTrend bounces prevents visual clutter while capturing all significant events
  • RSI momentum filtering and EMA 200 macro gating create a multi-layer confirmation framework that reduces false signals
  • The confluence count (0-5) provides an instant assessment of how many independent factors agree
  • The Cyberpunk theme with 4-layer neon glow and holographic ribbon creates a distinctive visual identity where trend strength is immediately apparent from the fan's visual character


Disclaimer

This indicator is provided for educational and informational purposes only. It is not financial advice or a recommendation to buy or sell any financial instrument. Moving average systems identify trends after they have started — they do not predict trend changes in advance. Full fan alignment can occur in overextended trends that are about to reverse. SuperTrend bounces can fail. Past alignment patterns do not guarantee future trend behavior. Always use proper risk management and never risk more than you can afford to lose. The author is not responsible for any losses incurred from using this indicator.

-Made with passion by officialjackofalltrades

כתב ויתור

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