OPEN-SOURCE SCRIPT
MTF Pivot Fib Speed Resistance Fans

Overview
This Pine Script indicator, titled "MTF Pivot Fib Speed Resistance Fans", is a multi-timeframe tool that automatically plots Fib Speed Resistance Fan lines based on pivot structures derived from higher timeframes. It mirrors the functionality of TradingView’s built-in “Fib Speed Resistance Fan” drawing tool, but in a dynamic, programmatic way. It uses pivot highs and lows to anchor fan projections, drawing forward-facing trend lines that align with well-known Fibonacci ratios and their extensions.
Pivot Detection Logic
The script identifies pivots by comparing the current bar’s high and low against the highest and lowest prices over a user-defined pivot period. This pivot detection occurs on a higher timeframe of your choice, giving a broader and more strategic view of price structure. The script tracks direction changes in the pivot trend and stores only the most recent few pivots to maintain clean and meaningful fan drawings.
Fan Direction Control
The user can select whether to draw fans for "Buys", "Sells", or "Both". The script only draws fan lines when a new directional move is detected based on the pivot structure and the selected bias. For example, in “Buys” mode, a rising pivot followed by another higher low will trigger upward fan projections.
Fib Speed Resistance Levels
Once two pivots are identified, the script draws multiple fan lines from the first pivot outward, at angles defined by a preset list of Fibonacci levels. These fan lines help visualize speed and strength of a price move.
The script also draws a horizontal line from the pivot for additional confluence at the base level (1.0).
Price Level Plotting
In addition to drawing fan lines, the indicator also plots their price levels on the right-hand price scale. This makes it easier for users to visually reference the projected support and resistance levels without needing to trace the lines manually across the chart.
Mapping to TradingView’s "Fib Speed Resistance Fan"
The expanded set of values used in this script is not arbitrary—they closely align with the default and extended levels available in TradingView's built-in "Fib Speed Resistance Fan" tool.
TradingView’s Fib Fan tool offers several levels by default, including traditional Fibonacci ratios like 0.382, 0.5, 0.618, and 1. However, if you right-click the tool and open its settings, you’ll find additional toggles for levels like 1.618, 2.000, 2.618, and even 4.000. These deeper levels are used to project stronger trend continuations beyond the standard retracement zones.
The inclusion of levels such as 0.25, 0.75, and 1.34 reflects configurations that are available when you manually add or customize levels in TradingView’s fan tool. While 1.34 is not a canonical Fibonacci ratio, it is often found in hybrid Gann/Fib methods and is included in some preset templates in TradingView’s drawing tool for advanced users.
By incorporating these levels directly into the Pine Script, the indicator faithfully reproduces the fan structure users would manually draw using TradingView’s graphical Fib Fan tool—but does so programmatically, dynamically, and with multi-timeframe control. This eliminates manual errors, allows for responsive updating, and adds custom visual tracking via the price scale.
These values are standardized within the context of TradingView's Fib Fan tool and not made up. This script automates what the manual drawing tool achieves, with added precision and flexibility.
This Pine Script indicator, titled "MTF Pivot Fib Speed Resistance Fans", is a multi-timeframe tool that automatically plots Fib Speed Resistance Fan lines based on pivot structures derived from higher timeframes. It mirrors the functionality of TradingView’s built-in “Fib Speed Resistance Fan” drawing tool, but in a dynamic, programmatic way. It uses pivot highs and lows to anchor fan projections, drawing forward-facing trend lines that align with well-known Fibonacci ratios and their extensions.
Pivot Detection Logic
The script identifies pivots by comparing the current bar’s high and low against the highest and lowest prices over a user-defined pivot period. This pivot detection occurs on a higher timeframe of your choice, giving a broader and more strategic view of price structure. The script tracks direction changes in the pivot trend and stores only the most recent few pivots to maintain clean and meaningful fan drawings.
Fan Direction Control
The user can select whether to draw fans for "Buys", "Sells", or "Both". The script only draws fan lines when a new directional move is detected based on the pivot structure and the selected bias. For example, in “Buys” mode, a rising pivot followed by another higher low will trigger upward fan projections.
Fib Speed Resistance Levels
Once two pivots are identified, the script draws multiple fan lines from the first pivot outward, at angles defined by a preset list of Fibonacci levels. These fan lines help visualize speed and strength of a price move.
The script also draws a horizontal line from the pivot for additional confluence at the base level (1.0).
Price Level Plotting
In addition to drawing fan lines, the indicator also plots their price levels on the right-hand price scale. This makes it easier for users to visually reference the projected support and resistance levels without needing to trace the lines manually across the chart.
Mapping to TradingView’s "Fib Speed Resistance Fan"
The expanded set of values used in this script is not arbitrary—they closely align with the default and extended levels available in TradingView's built-in "Fib Speed Resistance Fan" tool.
TradingView’s Fib Fan tool offers several levels by default, including traditional Fibonacci ratios like 0.382, 0.5, 0.618, and 1. However, if you right-click the tool and open its settings, you’ll find additional toggles for levels like 1.618, 2.000, 2.618, and even 4.000. These deeper levels are used to project stronger trend continuations beyond the standard retracement zones.
The inclusion of levels such as 0.25, 0.75, and 1.34 reflects configurations that are available when you manually add or customize levels in TradingView’s fan tool. While 1.34 is not a canonical Fibonacci ratio, it is often found in hybrid Gann/Fib methods and is included in some preset templates in TradingView’s drawing tool for advanced users.
By incorporating these levels directly into the Pine Script, the indicator faithfully reproduces the fan structure users would manually draw using TradingView’s graphical Fib Fan tool—but does so programmatically, dynamically, and with multi-timeframe control. This eliminates manual errors, allows for responsive updating, and adds custom visual tracking via the price scale.
These values are standardized within the context of TradingView's Fib Fan tool and not made up. This script automates what the manual drawing tool achieves, with added precision and flexibility.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.