OPEN-SOURCE SCRIPT
Support & Resistance + Fibonacci Retracement

📌 Support & Resistance + Fibonacci Retracement
Overview
This indicator automatically detects the highest high and lowest low within a user-defined lookback period and draws clean support and resistance levels directly on your chart. Between these two key levels, it plots the five most widely followed Fibonacci retracement ratios — giving you a complete price structure map at a glance.
No manual drawing needed. Every time a new bar closes, the levels update automatically.
How It Works
The indicator scans back a configurable number of bars (default: 21) to find:
🔴 Resistance — the highest high of the period
🟢 Support — the lowest low of the period
It then divides that range into Fibonacci levels, calculated upward from support to resistance:
LevelDescription
0.236First minor retracement
0.382Common pullback zone
0.500Midpoint equilibrium
0.618Golden ratio — strongest retracement
0.786Deep retracement, last defense
Settings
General Settings
Lookback Period — How many bars back to scan for highs and lows. Higher values = broader structure, lower values = tighter, more reactive levels.
Show Lines — Toggle all drawn lines on or off.
Timeframe — Pull support/resistance data from a higher (or different) timeframe. Leave blank to use the current chart timeframe. Useful for multi-timeframe analysis without switching charts.
Fibonacci Levels
Each of the 5 levels can be individually toggled on/off and colored to match your chart theme.
Label & Appearance
Show or hide level names and price values next to each line.
Fully customizable text color and font size (Tiny → Huge).
Alerts
Two built-in alerts fire automatically:
🔔 Bullish crossover — Price crosses above the 0.236 level
🔔 Bearish crossunder — Price crosses below the 0.618 level
To activate: open the Alerts panel → select this indicator → set your preferred notification method.
How to Use
Trend Analysis
The 0.382 and 0.618 levels are commonly watched by technical analysts as potential reaction zones. How price behaves around these areas — whether it stalls, reverses, or breaks through — may provide context for your own analysis. Always combine with other tools and your personal trading plan.
Multi-Timeframe Analysis
Set the Timeframe input to a higher period (e.g., 1D or 1W) while viewing a lower timeframe chart. This lets you observe where broader structural levels are located without switching views.
Dynamic Lookback
Adjusting the lookback period changes how wide or narrow the detected range is. Shorter periods capture more recent price action; longer periods reflect a broader historical range. Choose a value that fits your analytical approach and the instrument you are studying.
Notes
⚠️ This indicator is for informational and educational purposes only. It does not constitute financial or investment advice. All trading decisions are solely your own responsibility.
Overview
This indicator automatically detects the highest high and lowest low within a user-defined lookback period and draws clean support and resistance levels directly on your chart. Between these two key levels, it plots the five most widely followed Fibonacci retracement ratios — giving you a complete price structure map at a glance.
No manual drawing needed. Every time a new bar closes, the levels update automatically.
How It Works
The indicator scans back a configurable number of bars (default: 21) to find:
🔴 Resistance — the highest high of the period
🟢 Support — the lowest low of the period
It then divides that range into Fibonacci levels, calculated upward from support to resistance:
LevelDescription
0.236First minor retracement
0.382Common pullback zone
0.500Midpoint equilibrium
0.618Golden ratio — strongest retracement
0.786Deep retracement, last defense
Settings
General Settings
Lookback Period — How many bars back to scan for highs and lows. Higher values = broader structure, lower values = tighter, more reactive levels.
Show Lines — Toggle all drawn lines on or off.
Timeframe — Pull support/resistance data from a higher (or different) timeframe. Leave blank to use the current chart timeframe. Useful for multi-timeframe analysis without switching charts.
Fibonacci Levels
Each of the 5 levels can be individually toggled on/off and colored to match your chart theme.
Label & Appearance
Show or hide level names and price values next to each line.
Fully customizable text color and font size (Tiny → Huge).
Alerts
Two built-in alerts fire automatically:
🔔 Bullish crossover — Price crosses above the 0.236 level
🔔 Bearish crossunder — Price crosses below the 0.618 level
To activate: open the Alerts panel → select this indicator → set your preferred notification method.
How to Use
Trend Analysis
The 0.382 and 0.618 levels are commonly watched by technical analysts as potential reaction zones. How price behaves around these areas — whether it stalls, reverses, or breaks through — may provide context for your own analysis. Always combine with other tools and your personal trading plan.
Multi-Timeframe Analysis
Set the Timeframe input to a higher period (e.g., 1D or 1W) while viewing a lower timeframe chart. This lets you observe where broader structural levels are located without switching views.
Dynamic Lookback
Adjusting the lookback period changes how wide or narrow the detected range is. Shorter periods capture more recent price action; longer periods reflect a broader historical range. Choose a value that fits your analytical approach and the instrument you are studying.
Notes
⚠️ This indicator is for informational and educational purposes only. It does not constitute financial or investment advice. All trading decisions are solely your own responsibility.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.