OPEN-SOURCE SCRIPT

Gradient Ribbon | EMA Ribbon Slope-Acceleration System

7 262
Most EMA ribbon strategies only check if the moving averages are stacked in order — but a ribbon can stay stacked long after the actual trend has run out of steam. Gradient Ribbon looks past the stacking and measures the slope of each EMA directly, only signaling when the ribbon is actively accelerating apart. It catches trend ignition early and flags deceleration before the EMAs ever cross.

Features
  • 5-EMA ribbon (8/13/21/34/55) with per-line slope calculated as % change over a configurable lookback
  • Fan-open detection: all slopes must be same-direction and increasing in magnitude from slowest to fastest EMA — true acceleration, not just alignment
  • Long and short logic, fully symmetrical
  • RSI confirmation filter tuned to each direction, avoiding both weak momentum and overbought/oversold extremes
  • Volume filter requiring above-average participation, so fans opening on thin volume get filtered out
  • ATR-based stop loss with equity-percentage position sizing — size automatically adapts to current volatility
  • Fixed R-multiple take profit
  • Compression-based exit: closes the trade when the fan starts flattening back toward parallel, ahead of an actual EMA cross
  • Gradient-intensity fill between the fastest and slowest EMA — barely tinted when flat, vivid teal (bullish) or fuchsia (bearish) when fanning hard, so acceleration is visible at a glance
  • Entry/exit background highlights for quick visual confirmation on the chart


Explanation
The core idea is that trend strength isn't binary — it has an angle. A ribbon that's flat-stacked from an old move looks the same as one that just started accelerating, if all you check is order. By measuring each EMA's slope and requiring the spread between fastest and slowest slope to be expanding, the script isolates the moments where a trend is genuinely gaining momentum, not just persisting. Exits work the same way in reverse — instead of waiting for a lagging crossover, the script reads the fan closing back up as an early deceleration signal.

Tips
  • The fanEnterThresh value is highly instrument- and timeframe-dependent. Start with the default and walk it up/down while backtesting rather than trusting it blindly.
  • Shorter slopeLookback reacts faster to fresh acceleration but is noisier on choppy instruments; lengthen it for smoother, higher-timeframe use.
  • On low-liquidity instruments, consider loosening or disabling the volume filter — thin markets can have naturally erratic volume that isn't meaningful.
  • Watch the gradient fill even without a signal — a fan that's steadily brightening (even pre-threshold) is often a useful early heads-up.
  • Pair with a higher-timeframe trend filter if you want to trade only in the direction of the larger structure; this script is direction-agnostic by design.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。