OPEN-SOURCE SCRIPT
Sri_Auto Fibonacci

Sri_Auto Fibonacci is an advanced and original implementation of an automatic Fibonacci retracement plotting tool that uses price action pivots and volatility to dynamically draw key Fibonacci levels. Unlike static manual fib drawing, this tool automates the process by reacting to market structure using pivot detection logic and ATR-based deviation confirmation.
📐 What It Does
Detects major high/low pivot swings on a user-selected higher timeframe (default: Daily).
Uses ATR-based deviation threshold to avoid minor or noisy swings.
Automatically plots Fibonacci retracement levels (0, 0.236, 0.382, 0.5, 0.618, 0.786, 1.0).
Displays a dashed line connecting the two pivot points.
Draws horizontal lines and labels at each selected level.
Shows a status label if valid pivots are not yet found.
⚙️ User Inputs
Deviation % Multiplier: Adjusts the sensitivity based on ATR% to ignore small fluctuations.
Pivot Depth: Controls how many bars before/after a point are used to confirm a pivot.
Extend Lines Left/Right: Allows you to keep the levels visible into past/future bars.
Color Customization: Choose custom colors for each level.
Select Which Levels to Show: Toggle levels like 0.382 or 0.786 on/off based on preference.
🧠 How It Works
Pivot Detection
A price is considered a valid high/low pivot if it is the highest/lowest point within a lookback window (depth).
Deviation Filter
To avoid false pivots, the script calculates the % deviation between the new pivot and the last one using ATR/Close. Only when this exceeds a user-defined threshold, the new pivot is accepted.
Fibonacci Calculation
Once a valid new pivot is confirmed, the script draws levels between the latest two swings using the standard Fibonacci ratios.
✅ Key Features
Non-repainting logic for confirmed pivots
Works across all symbols and asset classes
Fully customizable and extendable
Clean, lightweight, and script-efficient
Built with Pine Script v5 standards
Uses request.security() to ensure pivot detection from the selected HTF
No proprietary or obfuscated code
📊 Best Use Cases
Identifying key retracement zones during pullbacks
Confirming support/resistance with fib confluence
Planning entries/exits around dynamic fib areas
Works well in swing trading setups
📌 Important Notes
This tool does not repaint once pivot structure is confirmed.
Designed as a support tool, not a signal generator.
Can be combined with RSI, MACD, volume, or price action for better confirmation.
📜 Disclaimer
This script is developed independently and shared publicly for educational and analytical use only. It is not intended to copy or infringe upon any commercial tool or proprietary indicator. Use at your own discretion. No investment advice is implied.
📧 For feedback or suggestions, feel free to connect through TradingView profile messages.
💡 Happy Trading!
📐 What It Does
Detects major high/low pivot swings on a user-selected higher timeframe (default: Daily).
Uses ATR-based deviation threshold to avoid minor or noisy swings.
Automatically plots Fibonacci retracement levels (0, 0.236, 0.382, 0.5, 0.618, 0.786, 1.0).
Displays a dashed line connecting the two pivot points.
Draws horizontal lines and labels at each selected level.
Shows a status label if valid pivots are not yet found.
⚙️ User Inputs
Deviation % Multiplier: Adjusts the sensitivity based on ATR% to ignore small fluctuations.
Pivot Depth: Controls how many bars before/after a point are used to confirm a pivot.
Extend Lines Left/Right: Allows you to keep the levels visible into past/future bars.
Color Customization: Choose custom colors for each level.
Select Which Levels to Show: Toggle levels like 0.382 or 0.786 on/off based on preference.
🧠 How It Works
Pivot Detection
A price is considered a valid high/low pivot if it is the highest/lowest point within a lookback window (depth).
Deviation Filter
To avoid false pivots, the script calculates the % deviation between the new pivot and the last one using ATR/Close. Only when this exceeds a user-defined threshold, the new pivot is accepted.
Fibonacci Calculation
Once a valid new pivot is confirmed, the script draws levels between the latest two swings using the standard Fibonacci ratios.
✅ Key Features
Non-repainting logic for confirmed pivots
Works across all symbols and asset classes
Fully customizable and extendable
Clean, lightweight, and script-efficient
Built with Pine Script v5 standards
Uses request.security() to ensure pivot detection from the selected HTF
No proprietary or obfuscated code
📊 Best Use Cases
Identifying key retracement zones during pullbacks
Confirming support/resistance with fib confluence
Planning entries/exits around dynamic fib areas
Works well in swing trading setups
📌 Important Notes
This tool does not repaint once pivot structure is confirmed.
Designed as a support tool, not a signal generator.
Can be combined with RSI, MACD, volume, or price action for better confirmation.
📜 Disclaimer
This script is developed independently and shared publicly for educational and analytical use only. It is not intended to copy or infringe upon any commercial tool or proprietary indicator. Use at your own discretion. No investment advice is implied.
📧 For feedback or suggestions, feel free to connect through TradingView profile messages.
💡 Happy Trading!
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.