This script creates an "Auto Fibonacci" indicator that automatically plots selected Fibonacci retracement levels on a chart, based on a defined lookback period. Users can choose from various Fibonacci levels (0.236, 0.382, 0.5, 0.618, or 0.786) via a dropdown input, allowing for quick adjustments to analysis.
**Key Features:** 1. **Fibonacci Level Selection:** Users can select from multiple Fibonacci levels (0.236, 0.382, 0.5, 0.618, and 0.786) for analysis.
2. **Lookback Period:** The script allows users to define a lookback period to determine the highest high and the lowest low for plotting Fibonacci levels.
3. **Fibonacci Level Calculation:** The Fibonacci levels are calculated using two functions: - `fib_level`: Calculates the Fibonacci level based on the highest high and lowest low of the lookback period. - `fib_level_from_current`: Calculates the Fibonacci level from the current candle’s high.
4. **Plotting:** The script plots the selected Fibonacci level on the chart, using a red line for the general Fibonacci level and a blue line for the level calculated from the current high.
5. **Dynamic Visualization:** The Fibonacci levels are drawn as step lines to clearly visualize price levels based on historical data and current price action.
This tool is ideal for traders who wish to quickly assess key Fibonacci levels for potential support or resistance within a customizable lookback period.