OPEN-SOURCE SCRIPT

Hann Window FIR Filter Ribbon [BigBeluga]

6 572
🔵 OVERVIEW
The Hann Window FIR Filter Ribbon [BigBeluga] is a trend-following visualization tool based on a family of FIR filters using the Hann window function. It plots a smooth and dynamic ribbon formed by six Hann filters of progressively increasing length. Gradient coloring and filled bands reveal trend direction and compression/expansion behavior. When short-term trend shifts occur (via filter crossover), it automatically anchors visual support/resistance zones at the nearest swing highs or lows.

🔵 CONCEPTS
  • Hann FIR Filter: A finite impulse response filter that uses a Hann (cosine-based) window for weighting past price values, resulting in a non-lag, ultra-smooth output.
    Pine Script®
    hannFilter(length)=> var float hann = na // Final filter output float filt = 0 float coef = 0 for i = 1 to length weight = 1 - math.cos(2 * math.pi * i / (length + 1)) filt += price[i - 1] * weight coef += weight hann := coef != 0 ? filt / coef : na
  • Ribbon Stack: The indicator plots 6 Hann FIR filters with increasing lengths, creating a smooth "ribbon" that adapts to price shifts and visually encodes volatility.
  • Gradient Coloring: Line colors and fill opacity between layers are dynamically adjusted based on the distance between the filters, showing momentum expansion or contraction.
    snapshot
  • Dynamic Swing Zones: When the shortest filter crosses its nearest neighbor, a swing high/low is located, and a triangle-style level is anchored and projected to the right.
  • Self-Extending Levels: These dynamic levels persist and extend until invalidated or replaced by a new opposite trend break.
    snapshot


🔵 FEATURES
  • Plots 6 Hann FIR filters with increasing lengths (controlled by Ribbon Size input).
  • Automatically colors each filter and the fill between them with smooth gradient transitions.
  • Detects trend shifts via filter crossover and anchors visual resistance (red) or support (green) zones.
    snapshot
  • Support/resistance zones are triangle-style bands built around recent swing highs/lows.
  • Levels auto-extend right and adapt in real time until invalidated by price action.
    snapshot
  • Ribbon responds smoothly to price and shows contraction or expansion behavior clearly.
  • No lag in crossover detection thanks to FIR architecture.
  • Adjustable sensitivity via Length and Ribbon Size inputs.


🔵 HOW TO USE
  • Use the ribbon gradient as a visual trend strength and smooth direction cue.
  • Watch for crossover of shortest filters as early trend change signals.
  • Monitor support/resistance zones as potential high-probability reaction points.
  • Combine with other tools like momentum or volume to confirm trend breaks.
  • Adjust ribbon thickness and length to suit your trading timeframe and volatility preference.


🔵 CONCLUSION
Hann Window FIR Filter Ribbon [BigBeluga] blends digital signal processing with trading logic to deliver a visually refined, non-lagging trend tool. The adaptive ribbon offers insight into momentum compression and release, while swing-based levels give structure to potential reversals. Ideal for traders who seek smooth trend detection with intelligent, auto-adaptive zone plotting.

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.