OPEN-SOURCE SCRIPT
Filter Ribbon

1. Indicator Name
Filter Ribbon
2. One-line Introduction
A trend visualization ribbon that uses linear regression and directional scoring to highlight bullish and bearish strength with intuitive color gradients.
3. General Overview
Filter Ribbon is a minimalistic yet powerful trend visualization tool that leverages linear regression slope ordering to determine directional momentum. It analyzes the ordering of regression values over a defined lookback period and quantifies how consistently the price has been trending upward or downward.
Using a pairwise comparison system, it calculates a trend "score" and compares this to a configurable threshold to determine if a bullish, bearish, or neutral condition exists.
The result is a color-coded ribbon that sits over the chart, changing hue and opacity based on both the direction and strength of the trend. The stronger the directional alignment, the more opaque the ribbon becomes, offering traders a fast, intuitive way to assess market sentiment at a glance.
It also includes an optional linear regression line to further help visualize the central trend.
This indicator is best used in trend-following systems or as a dynamic background layer when combined with signal-based strategies.
Thanks to its efficient design and protected logic, Filter Ribbon offers high-performance visualization without compromising strategy integrity.
4. Key Advantages
🌈 Visual Trend Heatmap
Dynamic color ribbon gives real-time visual feedback on both trend direction and strength.
🔢 Quantified Trend Scoring
Calculates a mathematically sound trend score using pairwise linear regression comparisons.
⚖️ Adjustable Sensitivity
Users can tune lookback and threshold parameters to fit different asset classes and timeframes.
📉 Smooth Ribbon Effect
Plots upper/lower bands around regression line with smooth filling for a professional chart look.
🎯 Precise Trend Confirmation
Acts as a confidence layer for other entry/exit signals by confirming broader trend bias.
🔒 Secure and Minimal Codebase
Core logic is embedded securely with minimal exposure, reducing risk of replication or misuse.
📘 Indicator User Guide
📌 Basic Concept
Filter Ribbon determines trend direction and intensity by comparing the order of linear regression values over time.
It forms a ribbon on the chart that changes color based on trend direction and opacity based on trend strength.
This makes it ideal for identifying clear trending periods vs. uncertain consolidations.
⚙️ Settings Explained
Lookback Period: Number of bars for scoring the trend direction (higher = smoother trend)
Range Tolerance (%): Determines how aggressive the trend classification is (lower = stricter)
Regression Length: Period for calculating the base linear regression line
Ribbon Colors: Customize colors for bullish and bearish conditions
📈 Bullish Timing Example
Ribbon color is green and becomes increasingly opaque
Regression line slopes upward and price remains above it
Can be used as trend confirmation for long trades
📉 Bearish Timing Example
Ribbon color is red with higher opacity
Price consistently below the regression line
Useful for confirming short trade setups or avoiding long entries
🧪 Recommended Use Cases
Combine with breakout indicators to validate if the breakout aligns with broader trend
Use in swing or trend-following strategies as a background filter
Helps filter out trades during unclear, sideways market conditions
🔒 Precautions
Not a signal generator on its own — meant for trend context only
Ribbon may lag slightly during sudden trend reversals; best used with reactive entry tools
Always test ribbon parameters on your specific market/timeframe before applying live
Avoid using solely in low-volatility or flat markets — sensitivity may require tuning
+++
Filter Ribbon
2. One-line Introduction
A trend visualization ribbon that uses linear regression and directional scoring to highlight bullish and bearish strength with intuitive color gradients.
3. General Overview
Filter Ribbon is a minimalistic yet powerful trend visualization tool that leverages linear regression slope ordering to determine directional momentum. It analyzes the ordering of regression values over a defined lookback period and quantifies how consistently the price has been trending upward or downward.
Using a pairwise comparison system, it calculates a trend "score" and compares this to a configurable threshold to determine if a bullish, bearish, or neutral condition exists.
The result is a color-coded ribbon that sits over the chart, changing hue and opacity based on both the direction and strength of the trend. The stronger the directional alignment, the more opaque the ribbon becomes, offering traders a fast, intuitive way to assess market sentiment at a glance.
It also includes an optional linear regression line to further help visualize the central trend.
This indicator is best used in trend-following systems or as a dynamic background layer when combined with signal-based strategies.
Thanks to its efficient design and protected logic, Filter Ribbon offers high-performance visualization without compromising strategy integrity.
4. Key Advantages
🌈 Visual Trend Heatmap
Dynamic color ribbon gives real-time visual feedback on both trend direction and strength.
🔢 Quantified Trend Scoring
Calculates a mathematically sound trend score using pairwise linear regression comparisons.
⚖️ Adjustable Sensitivity
Users can tune lookback and threshold parameters to fit different asset classes and timeframes.
📉 Smooth Ribbon Effect
Plots upper/lower bands around regression line with smooth filling for a professional chart look.
🎯 Precise Trend Confirmation
Acts as a confidence layer for other entry/exit signals by confirming broader trend bias.
🔒 Secure and Minimal Codebase
Core logic is embedded securely with minimal exposure, reducing risk of replication or misuse.
📘 Indicator User Guide
📌 Basic Concept
Filter Ribbon determines trend direction and intensity by comparing the order of linear regression values over time.
It forms a ribbon on the chart that changes color based on trend direction and opacity based on trend strength.
This makes it ideal for identifying clear trending periods vs. uncertain consolidations.
⚙️ Settings Explained
Lookback Period: Number of bars for scoring the trend direction (higher = smoother trend)
Range Tolerance (%): Determines how aggressive the trend classification is (lower = stricter)
Regression Length: Period for calculating the base linear regression line
Ribbon Colors: Customize colors for bullish and bearish conditions
📈 Bullish Timing Example
Ribbon color is green and becomes increasingly opaque
Regression line slopes upward and price remains above it
Can be used as trend confirmation for long trades
📉 Bearish Timing Example
Ribbon color is red with higher opacity
Price consistently below the regression line
Useful for confirming short trade setups or avoiding long entries
🧪 Recommended Use Cases
Combine with breakout indicators to validate if the breakout aligns with broader trend
Use in swing or trend-following strategies as a background filter
Helps filter out trades during unclear, sideways market conditions
🔒 Precautions
Not a signal generator on its own — meant for trend context only
Ribbon may lag slightly during sudden trend reversals; best used with reactive entry tools
Always test ribbon parameters on your specific market/timeframe before applying live
Avoid using solely in low-volatility or flat markets — sensitivity may require tuning
+++
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội Quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội Quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.