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.
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.