OPEN-SOURCE SCRIPT

Kinetic Ribbon Trail [JOAT]

2 294
Kinetic Ribbon Trail [JOAT]

Introduction

Kinetic Ribbon Trail is an open-source trend-following indicator built on two structural layers: a 20-line Hull Moving Average gradient ribbon that quantifies the spread and conviction of near-term versus long-term momentum, and a Fibonacci-anchored adaptive trailing stop that adjusts its sensitivity based on the current swing structure and volatility ratio. The two layers interact — the ribbon provides visual context for momentum strength while the trail provides the dynamic level that determines directional bias.

The unique analytical contribution is the ribbon normalization. Most HMA ribbon indicators simply plot multiple lines and fill between them. Kinetic Ribbon Trail computes the signed spread between the fastest and slowest ribbon line, normalizes it by the 200-bar exponential average of that spread, clamps it to a -1 to +1 range, and uses the result to drive a continuous color gradient between the bear and bull theme colors. This means the ribbon's color intensity directly reflects how unusual the current momentum spread is relative to its historical average — not just whether the ribbon is bullish or bearish.

لقطة

Core Concepts

1. 20-Line HMA Ribbon with rFactor Normalization

Twenty Hull Moving Average lines are computed from a base period, incrementing by a configurable step. The spread between the fastest and slowest line is the primary signal variable:

Pine Script®


When the fastest line is far above the slowest relative to its recent average, rFactor approaches +1 and the ribbon glows in full bull theme color. The gradient reflects spread magnitude — a bullish spread twice as wide as normal appears more saturated than one just barely positive.

2. Fibonacci Adaptive Trailing Stop

The trailing stop anchors to swing structure rather than to fixed ATR multiples. Confirmed swing highs and lows define a Fibonacci range. Three trail levels are computed from this range at the 0.382, 0.5, and 0.618 Fibonacci retracement. One is selected based on the trail mode: Aggressive, Balanced, or Conservative. A volatility adjustment scales the selected level by the inverse of the current volatility ratio.

The trail ratchets: for longs, it can only move up. For shorts, it can only move down. A flip occurs when price closes through the trail level with body ratio and penetration confirmation.

3. Four-State Regime Detection

A four-state regime classification determines which visual treatments are active: Trend Bull, Trend Bear, Range High-Vol, Range Low-Vol. The classification uses ADX relative to a threshold and the ATR-to-SMA(ATR) ratio. When a regime transition occurs, the chart background is tinted for 10 bars in the corresponding theme color before clearing.

4. Six-Factor Confidence Score

Each signal is assigned a confidence grade (D through A+) based on six weighted factors: swing structure alignment (20%), regime alignment (20%), ADX strength (15%), volume participation (15%), volatility favorability (15%), and SMA50 proximity to trail level (15%). Signals below a user-set minimum grade are suppressed.

لقطة

Features

  • 20-line HMA gradient ribbon: rFactor-normalized color gradient reflecting momentum spread intensity vs. its 200-bar historical average
  • 19 ribbon fill layers: Adjacent HMA lines filled with gradient opacity layers for depth visualization
  • Fibonacci adaptive trailing stop: Trail anchored to swing structure at 0.382 / 0.5 / 0.618 Fibonacci levels with volatility adjustment
  • Trail ratchet with flip confirmation: Trail advances in one direction only; flips require body ratio and penetration confirmation
  • Gradient trail fill: Fill between trail and close — top color opaque, bottom color transparent
  • Four-state regime detection: Trend Bull, Trend Bear, Range High-Vol, Range Low-Vol with background tint on transition
  • Six-factor confidence scoring: A+ / A / B / C / D grading system applied to each signal
  • Confidence filter: Signals below the minimum confidence grade are suppressed
  • Trade block on trail flip: Entry, stop, TP1/TP2/TP3 rendered as gradient boxes on confirmed flip signals
  • Backtest tracker: Win rate and expected value
  • Four color themes: Phantom, Neon, Classic, Solar
  • Non-repainting: All signals gated by barstate.isconfirmed
  • Institutional dashboard: 13-row table with regime, trail level, confidence grade, signal, TP/SL levels, and performance stats


Input Parameters

Ribbon:
  • Base Length: Fastest HMA period (default: 10)
  • Step: Increment between each ribbon line (default: 14)


Fibonacci Trail:
  • Trail Mode: Aggressive (0.618) / Balanced (0.5) / Conservative (0.382) / Auto (regime-adaptive)
  • Pivot Lookback: Bars required to confirm a swing pivot


Confidence:
  • Enable Confidence Filter toggle
  • Min Signal Grade: D / C / B / A / A+


Trade Levels:
  • Show Trade Block toggle
  • Risk Preset: Conservative / Balanced / Aggressive / Scalping
  • Extend Bars: How far lines project right


How to Use This Indicator

Step 1: Read the Ribbon Color
A deeply saturated bull color means the ribbon spread is unusually wide — momentum is strong. A muted or transitional color means the spread is near its historical average — momentum is uncertain.

Step 2: Watch for Trail Flips
A signal fires when the Fibonacci trail flips direction and confidence meets the minimum grade. The trade block appears immediately with entry, stop, and three TP levels.

Step 3: Use Regime Context
The four-state regime in the dashboard tells you whether you are in a trending or ranging environment. High-confidence signals in trending regimes carry more structural weight than the same grade in a ranging regime.

Indicator Limitations

  • Swing detection uses ta.pivothigh() and ta.pivotlow() with a lookback offset. The Fibonacci levels are computed from swings confirmed bars after they occurred
  • In markets with very shallow swing structures, the Fibonacci range can be small relative to ATR, causing the trail to cluster near the current price and produce excessive flips
  • The 20-line ribbon increases visual complexity. Reducing the base length and step can make the ribbon more compact on busy charts
  • The confidence score uses volume as one factor. On timeframes or instruments where volume is not meaningful, this factor should carry less weight
  • Regime detection uses ADX, which lags price. A trend that begins explosively may be classified as ranging for several bars before ADX responds


Originality Statement

  • The rFactor normalization — dividing ribbon spread by a 200-bar EMA of absolute ribbon spread, clamped to -1/+1, driving a continuous color.from_gradient() — is an original approach to HMA ribbon coloring that reflects relative momentum intensity rather than absolute direction
  • Anchoring a trailing stop to Fibonacci retracements of the current confirmed swing structure, with volatility-ratio adjustment and body/penetration confirmation on flips, is distinct from standard ATR-multiplier trailing stops
  • The six-factor confidence scoring system applied per signal, producing an A+ to D grade that gates signal output, provides per-trade quality assessment within the indicator itself


Disclaimer

This indicator is provided for educational and informational purposes only. It is not financial advice. Trading involves substantial risk of loss. Past confidence grades and win rates do not predict future performance. The author accepts no responsibility for trading losses resulting from use of this indicator.

Made with passion by jackofalltrades

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.