OPEN-SOURCE SCRIPT
Fibonacci Touch Heatmap

Fibonacci Touch Heatmap
Fibonacci Touch Heatmap is an advanced Fibonacci channel indicator that dynamically builds a full upper and lower Fibonacci structure over a user-defined lookback window, then scores each level by how many times price has genuinely touched or respected it. The result is a ranked, color-coded map of the most statistically significant support and resistance zones on your chart — updated automatically on every bar.
What Problem This Solves
Standard Fibonacci tools require manual swing selection and draw static levels with no feedback on whether price actually reacted to them. This indicator eliminates both limitations: it auto-detects the range, draws all 14 Fibonacci levels (7 upper + 7 lower), and continuously counts how many times each level has been touched — giving traders an objective, data-driven view of which levels the market genuinely respects.
How It Works — Technical Details
Range Detection:
The indicator uses ta.highest(high, lookback) and ta.lowest(low, lookback) to identify the high and low of the most recent N bars (default: 300). The midpoint is calculated as the arithmetic average of these two values.
Fibonacci Level Construction:
Seven standard Fibonacci ratios (0.0, 0.236, 0.382, 0.500, 0.618, 0.786, 1.0) are applied symmetrically from the midpoint — upward toward the range high (upper channel) and downward toward the range low (lower channel) — producing 14 distinct price levels in total.
Touch Counting Algorithm:
On the final bar (barstate.islast), the script iterates backward through every bar in the lookback window. For each bar, it checks whether the high or low came within a user-defined sensitivity threshold of any Fibonacci level. The threshold is calculated as a percentage of the level price (default: 0.2%), making it adaptive across different asset classes and price scales. Each qualifying bar increments that level's touch counter.
Gradient Coloring:
A custom gradColor() function interpolates RGB values across three anchor colors — bottom (green), mid (yellow), top (red) — based on the level's vertical position within the channel. This creates a smooth visual gradient that immediately communicates zone type: green = support territory, red = resistance territory.
Touch Heatmap:
Line opacity and the color in the top-right table are determined by each level's touch count relative to the maximum touch count across all 14 levels, using the touchColor() function. Levels with more touches render with warmer, more opaque colors.
Background Zones:
The channel is divided into 9 equal vertical slices, each rendered as a semi-transparent colored box, creating a heat gradient background that visually reinforces price zone significance.
Multi-Timeframe Panel
Two additional timeframes (default: 1H and 4H, fully customizable) are analyzed via request.security(). For each external timeframe, the script independently fetches the 500-bar high/low range, builds the complete Fibonacci channel, runs the touch-counting algorithm, and identifies the top 2 most-touched levels. These are displayed in the bottom-right table, color-coded by timeframe (blue = TF1, purple = TF2), allowing traders to instantly identify cross-timeframe Fibonacci confluences.
Top-Right Table — Most Touched Fib Levels
Displays the top 4 most-touched Fibonacci levels from the current chart timeframe, ranked using a bubble sort across all 14 levels. Each row shows:
Fib ratio with direction arrow (↑ upper channel / ↓ lower channel)
Exact price of the level
Touch count (colored from blue → red based on relative touch frequency)
Zone — Upper (resistance side) or Lower (support side)
How To Use
Set Lookback Bars to define the range of history to analyze. Higher values (500+) reveal macro structure; lower values (50–150) focus on recent structure.
Identify high-touch levels from the top-right table — these are the levels price has tested most frequently and are the strongest candidate zones for future reactions.
Use the multi-TF table to find confluences: when the same Fibonacci level appears as most-touched on both TF1 and TF2 simultaneously, it indicates a high-probability reaction zone.
Adjust Touch Sensitivity (%) based on asset volatility:
Crypto: 0.2–0.5% recommended
Forex: 0.05–0.15% recommended
Equities: 0.1–0.3% recommended
Color gradient gives immediate visual context — price trading near red zones suggests resistance pressure; near green zones suggests support.
Inputs Summary
InputDefaultDescriptionLookback Bars300Number of bars used for range and touch detectionTouch Sensitivity (%)0.002Tolerance for a bar high/low to qualify as a touchFib Line Width1Visual thickness of dashed level linesTop / Mid / Bottom ColorRed / Yellow / GreenGradient anchor colorsTimeframe 160 (1H)First external TF for multi-TF panelTimeframe 2240 (4H)Second external TF for multi-TF panel
Originality
This script is an original work combining automatic range-based Fibonacci channel construction with a bar-by-bar touch counting algorithm and multi-timeframe confluence detection. While Fibonacci retracement is a widely used concept, the specific implementation — symmetric dual-channel construction from a dynamic midpoint, percentage-adaptive touch sensitivity, RGB gradient heatmap coloring, bubble-sort level ranking, and simultaneous multi-timeframe touch analysis via request.security() — represents the author's own methodology for transforming static Fibonacci levels into a dynamic, data-scored support/resistance framework.
Disclaimer
This indicator is intended for educational and analytical purposes only. No indicator can predict future price movements with certainty. Always combine multiple forms of analysis and apply proper risk management before making any trading decisions.
Short Description:
Automatically builds a dual Fibonacci channel from the N-bar range high/low, counts how many times price has touched each of the 14 levels, and ranks them by touch frequency. Includes a multi-timeframe panel showing the most-respected Fibonacci levels across two additional timeframes for confluence analysis.
Fibonacci Touch Heatmap is an advanced Fibonacci channel indicator that dynamically builds a full upper and lower Fibonacci structure over a user-defined lookback window, then scores each level by how many times price has genuinely touched or respected it. The result is a ranked, color-coded map of the most statistically significant support and resistance zones on your chart — updated automatically on every bar.
What Problem This Solves
Standard Fibonacci tools require manual swing selection and draw static levels with no feedback on whether price actually reacted to them. This indicator eliminates both limitations: it auto-detects the range, draws all 14 Fibonacci levels (7 upper + 7 lower), and continuously counts how many times each level has been touched — giving traders an objective, data-driven view of which levels the market genuinely respects.
How It Works — Technical Details
Range Detection:
The indicator uses ta.highest(high, lookback) and ta.lowest(low, lookback) to identify the high and low of the most recent N bars (default: 300). The midpoint is calculated as the arithmetic average of these two values.
Fibonacci Level Construction:
Seven standard Fibonacci ratios (0.0, 0.236, 0.382, 0.500, 0.618, 0.786, 1.0) are applied symmetrically from the midpoint — upward toward the range high (upper channel) and downward toward the range low (lower channel) — producing 14 distinct price levels in total.
Touch Counting Algorithm:
On the final bar (barstate.islast), the script iterates backward through every bar in the lookback window. For each bar, it checks whether the high or low came within a user-defined sensitivity threshold of any Fibonacci level. The threshold is calculated as a percentage of the level price (default: 0.2%), making it adaptive across different asset classes and price scales. Each qualifying bar increments that level's touch counter.
Gradient Coloring:
A custom gradColor() function interpolates RGB values across three anchor colors — bottom (green), mid (yellow), top (red) — based on the level's vertical position within the channel. This creates a smooth visual gradient that immediately communicates zone type: green = support territory, red = resistance territory.
Touch Heatmap:
Line opacity and the color in the top-right table are determined by each level's touch count relative to the maximum touch count across all 14 levels, using the touchColor() function. Levels with more touches render with warmer, more opaque colors.
Background Zones:
The channel is divided into 9 equal vertical slices, each rendered as a semi-transparent colored box, creating a heat gradient background that visually reinforces price zone significance.
Multi-Timeframe Panel
Two additional timeframes (default: 1H and 4H, fully customizable) are analyzed via request.security(). For each external timeframe, the script independently fetches the 500-bar high/low range, builds the complete Fibonacci channel, runs the touch-counting algorithm, and identifies the top 2 most-touched levels. These are displayed in the bottom-right table, color-coded by timeframe (blue = TF1, purple = TF2), allowing traders to instantly identify cross-timeframe Fibonacci confluences.
Top-Right Table — Most Touched Fib Levels
Displays the top 4 most-touched Fibonacci levels from the current chart timeframe, ranked using a bubble sort across all 14 levels. Each row shows:
Fib ratio with direction arrow (↑ upper channel / ↓ lower channel)
Exact price of the level
Touch count (colored from blue → red based on relative touch frequency)
Zone — Upper (resistance side) or Lower (support side)
How To Use
Set Lookback Bars to define the range of history to analyze. Higher values (500+) reveal macro structure; lower values (50–150) focus on recent structure.
Identify high-touch levels from the top-right table — these are the levels price has tested most frequently and are the strongest candidate zones for future reactions.
Use the multi-TF table to find confluences: when the same Fibonacci level appears as most-touched on both TF1 and TF2 simultaneously, it indicates a high-probability reaction zone.
Adjust Touch Sensitivity (%) based on asset volatility:
Crypto: 0.2–0.5% recommended
Forex: 0.05–0.15% recommended
Equities: 0.1–0.3% recommended
Color gradient gives immediate visual context — price trading near red zones suggests resistance pressure; near green zones suggests support.
Inputs Summary
InputDefaultDescriptionLookback Bars300Number of bars used for range and touch detectionTouch Sensitivity (%)0.002Tolerance for a bar high/low to qualify as a touchFib Line Width1Visual thickness of dashed level linesTop / Mid / Bottom ColorRed / Yellow / GreenGradient anchor colorsTimeframe 160 (1H)First external TF for multi-TF panelTimeframe 2240 (4H)Second external TF for multi-TF panel
Originality
This script is an original work combining automatic range-based Fibonacci channel construction with a bar-by-bar touch counting algorithm and multi-timeframe confluence detection. While Fibonacci retracement is a widely used concept, the specific implementation — symmetric dual-channel construction from a dynamic midpoint, percentage-adaptive touch sensitivity, RGB gradient heatmap coloring, bubble-sort level ranking, and simultaneous multi-timeframe touch analysis via request.security() — represents the author's own methodology for transforming static Fibonacci levels into a dynamic, data-scored support/resistance framework.
Disclaimer
This indicator is intended for educational and analytical purposes only. No indicator can predict future price movements with certainty. Always combine multiple forms of analysis and apply proper risk management before making any trading decisions.
Short Description:
Automatically builds a dual Fibonacci channel from the N-bar range high/low, counts how many times price has touched each of the 14 levels, and ranks them by touch frequency. Includes a multi-timeframe panel showing the most-respected Fibonacci levels across two additional timeframes for confluence analysis.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.