PROTECTED SOURCE SCRIPT
zavaUnni-Auto Bull & Bear ZigZag Fib

This indicator combines RSI-based ZigZag swing detection with directional Fibonacci retracement levels. It separately tracks bullish and bearish swing structures, then draws Fibonacci levels based on the selected mode: Auto, Bullish Fib, Bearish Fib, or Off.
🔹 Key Features
1) Dual ZigZag (Bull & Bear)
Draws two independent ZigZag structures:
Bearish ZigZag (red/orange lines)
Bullish ZigZag (green/teal lines)
Swing points are detected using RSI thresholds and an offset-based swing confirmation logic.
2) RSI-Based Swing Logic
Uses RSI on low and high sources to identify swing turning points.
The script switches internal wave trend states when RSI moves between oversold/overbought zones and when the RSI “offset” condition confirms a completed swing.
3) Directional Fibonacci Modes
Auto: Automatically selects which Fibonacci set to display by comparing the latest swing range size (bull vs bear).
Bullish Fib: Uses the bearish swing range (high → low) to plot retracement levels upward.
Bearish Fib: Uses the bullish swing range (low → high) to plot retracement levels downward.
Off: Disables Fibonacci plotting.
4) Fibonacci Visualization
Plots common retracement levels: 23.6%, 38.2%, 50%, 61.8%, 78.6%
Uses shaded fills between levels to highlight retracement zones.
Adds labels and dotted horizontal lines that extend from the swing start time to the current bar.
5) Input Status Table
A built-in table shows whether Bearish ZigZag, Bullish ZigZag, and Fibonacci mode are enabled.
Uses checkbox-style icons for fast visual confirmation.
🔹 How to Use
Enable Bullish ZigZag and/or Bearish ZigZag to visualize swing structure.
Use Fibonacci = Auto to automatically switch levels depending on which side currently has the stronger (larger) swing range.
Use Bullish Fib or Bearish Fib to lock Fibonacci plotting to one direction for consistent analysis.
Combine with trend filters or price-action confirmations for entries around key retracement zones.
🔹 Best Use Cases
Identifying swing-based support/resistance levels using Fibonacci retracements.
Tracking bullish vs bearish structure separately on the same chart.
Spotting pullback zones and potential reaction areas after a completed swing.
🔹 Key Features
1) Dual ZigZag (Bull & Bear)
Draws two independent ZigZag structures:
Bearish ZigZag (red/orange lines)
Bullish ZigZag (green/teal lines)
Swing points are detected using RSI thresholds and an offset-based swing confirmation logic.
2) RSI-Based Swing Logic
Uses RSI on low and high sources to identify swing turning points.
The script switches internal wave trend states when RSI moves between oversold/overbought zones and when the RSI “offset” condition confirms a completed swing.
3) Directional Fibonacci Modes
Auto: Automatically selects which Fibonacci set to display by comparing the latest swing range size (bull vs bear).
Bullish Fib: Uses the bearish swing range (high → low) to plot retracement levels upward.
Bearish Fib: Uses the bullish swing range (low → high) to plot retracement levels downward.
Off: Disables Fibonacci plotting.
4) Fibonacci Visualization
Plots common retracement levels: 23.6%, 38.2%, 50%, 61.8%, 78.6%
Uses shaded fills between levels to highlight retracement zones.
Adds labels and dotted horizontal lines that extend from the swing start time to the current bar.
5) Input Status Table
A built-in table shows whether Bearish ZigZag, Bullish ZigZag, and Fibonacci mode are enabled.
Uses checkbox-style icons for fast visual confirmation.
🔹 How to Use
Enable Bullish ZigZag and/or Bearish ZigZag to visualize swing structure.
Use Fibonacci = Auto to automatically switch levels depending on which side currently has the stronger (larger) swing range.
Use Bullish Fib or Bearish Fib to lock Fibonacci plotting to one direction for consistent analysis.
Combine with trend filters or price-action confirmations for entries around key retracement zones.
🔹 Best Use Cases
Identifying swing-based support/resistance levels using Fibonacci retracements.
Tracking bullish vs bearish structure separately on the same chart.
Spotting pullback zones and potential reaction areas after a completed swing.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể sử dụng tự do và không giới hạn – tìm hiểu thêm tại đây.
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ã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể sử dụng tự do và không giới hạn – tìm hiểu thêm tại đây.
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.