OPEN-SOURCE SCRIPT
Fibonacci Retracement levels Automatically D/W/M

Indicator Description: Fibonacci Retracement levels Automatically
Fibonacci retracement levels based on the day, week, month High Low range and Fibonacci retracement levels draws automatically .This Pine Script indicator is designed to plot Fibonacci retracement levels based on the high and low prices of a user-selected timeframe (Daily, Weekly, or Monthly). It identifies bullish or bearish candles in the chosen timeframe, draws key price levels, and overlays Fibonacci retracement lines and semi-transparent colored boxes to highlight potential support and resistance zones. The indicator dynamically updates with each new period and extends lines, labels, and boxes to the current bar for real-time visualization. Key Features
1. Timeframe Selection: Users can choose the timeframe for analysis: Daily, Weekly, or Monthly via an input dropdown. The indicator retrieves the open, high, low, and close prices for the selected timeframe using `request.security`.
2. High and Low Tracking : Tracks the highest high and lowest low within the selected timeframe. Stores these values and their corresponding bar indices in arrays (`whigh`, `wlow`, `whighIdx`,`wlowIdx`). Limits the array size to the most recent period to optimize performance.
3. Bullish and Bearish Candle Detection : Identifies whether the previous period’s candle is bullish (`close > open`) or bearish (`close < open`). Uses this to determine the direction for Fibonacci retracement calculations. Bullish candle: Fibonacci levels are drawn from low to high
Bearish candle: Fibonacci levels are drawn from high to low
4. Fibonacci Retracement Levels : Plots Fibonacci levels at 0.236, 0.382, 0.5, 0.618, and 0.786 between the high and low of the period. For bullish candles, levels are calculated from the low (support) to the high (resistance). For bearish candles, levels are calculated from the high (resistance) to the low (support). Each Fibonacci level is drawn as a horizontal line with a unique color:
- 0.236: Blue
- 0.382: Purple
- 0.5: Yellow
- 0.618: Teal
- 0.786: Fuchsia
5. Visual Elements: - High/Low Lines and Labels: Draws a red line and label for the previous period’s high. Draws a green line and label for the previous period’s low. Fibonacci Lines and Labels: Each Fibonacci level has a horizontal line and a label displaying the ratio.
Colored Boxes: Semi-transparent boxes are drawn between consecutive Fibonacci levels (including high and low) to highlight zones.
6. Dynamic Updates:
- At the start of a new period (e.g., new week for Weekly timeframe), the indicator:
- Clears previous Fibonacci lines, labels, and boxes.
- Recalculates the high and low for the new period.
- Redraws lines, labels, and boxes based on the new data.
- Extends all lines, labels, and boxes to the current bar index for real-time tracking.
7. Performance Optimization:
- Deletes old lines, labels, and boxes to prevent clutter.
- Limits the storage of highs and lows to the most recent period.
How It Works
1. Initialization: Defines variables for tracking bullish/bearish candles, lines, labels, and arrays for Fibonacci levels and boxes. Sets up color arrays for Fibonacci lines and boxes with distinct, semi-transparent colors.
2. Data Collection: Fetches the previous period’s OHLC (open, high, low, close) using `request.security`. Detects new periods (e.g., new week or month) using `ta.change(time(tf))`.
3. Fibonacci Calculation: On a new period, stores the high and low prices and their bar indices.
- Identifies the maximum high and minimum low from the stored data. - Calculates Fibonacci levels based on the range (`maxHigh - minLow`) and the direction (bullish or bearish).
4. Drawing:
- Draws high/low lines and labels at the identified price levels. Plots Fibonacci retracement lines and labels for each ratio. Creates semi-transparent boxes between Fibonacci levels to visually distinguish zones.
5. Updates:
- Extends all lines, labels, and boxes to the current bar index when a new period is detected. Clears old Fibonacci elements to avoid overlap and ensure clarity.
Usage
- Purpose: This indicator is useful for traders who use Fibonacci retracement levels to identify potential support and resistance zones in financial markets.
- Application:
- Select the desired timeframe (Daily, Weekly, Monthly) via the input settings.
- The indicator automatically plots the previous period’s high/low and Fibonacci levels on the chart.
- Use the labeled Fibonacci levels and colored boxes to identify key price zones for trading decisions.
- Customization:
- Modify the `timeframe` input to switch between Daily, Weekly, or Monthly analysis.
- Adjust the `fibLineColors` and `fibFillColors` arrays to change the visual appearance of lines and boxes.
- The indicator is designed for use on TradingView with Pine Script.
- The maximum array size for highs/lows is limited to 1 period in this version (can be adjusted by modifying the `array.shift` logic).
- The indicator dynamically updates with each new period, ensuring real-time relevance.
This indicator make educational purpose use only
Fibonacci retracement levels based on the day, week, month High Low range and Fibonacci retracement levels draws automatically .This Pine Script indicator is designed to plot Fibonacci retracement levels based on the high and low prices of a user-selected timeframe (Daily, Weekly, or Monthly). It identifies bullish or bearish candles in the chosen timeframe, draws key price levels, and overlays Fibonacci retracement lines and semi-transparent colored boxes to highlight potential support and resistance zones. The indicator dynamically updates with each new period and extends lines, labels, and boxes to the current bar for real-time visualization. Key Features
1. Timeframe Selection: Users can choose the timeframe for analysis: Daily, Weekly, or Monthly via an input dropdown. The indicator retrieves the open, high, low, and close prices for the selected timeframe using `request.security`.
2. High and Low Tracking : Tracks the highest high and lowest low within the selected timeframe. Stores these values and their corresponding bar indices in arrays (`whigh`, `wlow`, `whighIdx`,`wlowIdx`). Limits the array size to the most recent period to optimize performance.
3. Bullish and Bearish Candle Detection : Identifies whether the previous period’s candle is bullish (`close > open`) or bearish (`close < open`). Uses this to determine the direction for Fibonacci retracement calculations. Bullish candle: Fibonacci levels are drawn from low to high
Bearish candle: Fibonacci levels are drawn from high to low
4. Fibonacci Retracement Levels : Plots Fibonacci levels at 0.236, 0.382, 0.5, 0.618, and 0.786 between the high and low of the period. For bullish candles, levels are calculated from the low (support) to the high (resistance). For bearish candles, levels are calculated from the high (resistance) to the low (support). Each Fibonacci level is drawn as a horizontal line with a unique color:
- 0.236: Blue
- 0.382: Purple
- 0.5: Yellow
- 0.618: Teal
- 0.786: Fuchsia
5. Visual Elements: - High/Low Lines and Labels: Draws a red line and label for the previous period’s high. Draws a green line and label for the previous period’s low. Fibonacci Lines and Labels: Each Fibonacci level has a horizontal line and a label displaying the ratio.
Colored Boxes: Semi-transparent boxes are drawn between consecutive Fibonacci levels (including high and low) to highlight zones.
6. Dynamic Updates:
- At the start of a new period (e.g., new week for Weekly timeframe), the indicator:
- Clears previous Fibonacci lines, labels, and boxes.
- Recalculates the high and low for the new period.
- Redraws lines, labels, and boxes based on the new data.
- Extends all lines, labels, and boxes to the current bar index for real-time tracking.
7. Performance Optimization:
- Deletes old lines, labels, and boxes to prevent clutter.
- Limits the storage of highs and lows to the most recent period.
How It Works
1. Initialization: Defines variables for tracking bullish/bearish candles, lines, labels, and arrays for Fibonacci levels and boxes. Sets up color arrays for Fibonacci lines and boxes with distinct, semi-transparent colors.
2. Data Collection: Fetches the previous period’s OHLC (open, high, low, close) using `request.security`. Detects new periods (e.g., new week or month) using `ta.change(time(tf))`.
3. Fibonacci Calculation: On a new period, stores the high and low prices and their bar indices.
- Identifies the maximum high and minimum low from the stored data. - Calculates Fibonacci levels based on the range (`maxHigh - minLow`) and the direction (bullish or bearish).
4. Drawing:
- Draws high/low lines and labels at the identified price levels. Plots Fibonacci retracement lines and labels for each ratio. Creates semi-transparent boxes between Fibonacci levels to visually distinguish zones.
5. Updates:
- Extends all lines, labels, and boxes to the current bar index when a new period is detected. Clears old Fibonacci elements to avoid overlap and ensure clarity.
Usage
- Purpose: This indicator is useful for traders who use Fibonacci retracement levels to identify potential support and resistance zones in financial markets.
- Application:
- Select the desired timeframe (Daily, Weekly, Monthly) via the input settings.
- The indicator automatically plots the previous period’s high/low and Fibonacci levels on the chart.
- Use the labeled Fibonacci levels and colored boxes to identify key price zones for trading decisions.
- Customization:
- Modify the `timeframe` input to switch between Daily, Weekly, or Monthly analysis.
- Adjust the `fibLineColors` and `fibFillColors` arrays to change the visual appearance of lines and boxes.
- The indicator is designed for use on TradingView with Pine Script.
- The maximum array size for highs/lows is limited to 1 period in this version (can be adjusted by modifying the `array.shift` logic).
- The indicator dynamically updates with each new period, ensuring real-time relevance.
This indicator make educational purpose use only
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
mail Id : satyambeed@gmail.com
WhatsApp +919270007010
Telegram : @AI_Trend_My_Friend forms.gle/H5FUra2tFHn3WR8u6
WhatsApp +919270007010
Telegram : @AI_Trend_My_Friend forms.gle/H5FUra2tFHn3WR8u6
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
mail Id : satyambeed@gmail.com
WhatsApp +919270007010
Telegram : @AI_Trend_My_Friend forms.gle/H5FUra2tFHn3WR8u6
WhatsApp +919270007010
Telegram : @AI_Trend_My_Friend forms.gle/H5FUra2tFHn3WR8u6
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。