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!
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.