OPEN-SOURCE SCRIPT
Atualizado

BullDozz Fibo ZigZag

Fibo ZigZag - Advanced Fibonacci Retracement Tool 🔥
📌 Overview
The Fibo ZigZag indicator is a powerful tool for trend structure analysis using the ZigZag pattern and Fibonacci retracement levels. It automatically identifies swing highs & lows, draws ZigZag lines, and overlays Fibonacci levels with price labels at the right end for better readability.

This indicator is designed for traders who use price action, trend reversal strategies, and support/resistance analysis.

🛠 Features
✅ Automatic ZigZag detection with customizable depth, deviation, and backstep
✅ Fibonacci retracement levels (0%, 23.6%, 38.2%, 50%, 61.8%, 100%, 161.8%, 261.8%, 423.6%)
✅ Price labels at Fibonacci levels (placed at the right end of the levels)
✅ Alerts for new swing highs & lows
✅ Customizable line colors, text colors, and label sizes
✅ Lightweight and optimized for fast performance

📊 How It Works
1️⃣ The script detects ZigZag structure points based on price swings
2️⃣ It connects recent highs & lows with a ZigZag line
3️⃣ Fibonacci retracement levels are calculated and drawn between the last two significant swing points
4️⃣ Each Fibo level is labeled with its percentage & exact price, placed at the right end for clarity
5️⃣ Alerts trigger automatically when a new swing high or low is detected

⚙ Customization Options
🔹 ZigZag Settings: Adjust Depth, Deviation, BackStep, and Leg length
🔹 Fibonacci Levels: Modify line colors, label text colors, and visibility
🔹 Alerts: Enable/disable trend change alerts

📈 Best Use Cases
🚀 Identifying Trend Reversals – Detect key turning points using Fibonacci levels
📉 Support & Resistance Trading – Use retracement levels as entry/exit points
📊 Swing Trading & Scalping – Combine ZigZag with price action for effective strategies
🔔 Alert-Based Trading – Get notified when new swing highs/lows form

🚀 How to Use
📌 Add the indicator to your chart
📌 Adjust the settings to match your trading strategy
📌 Use the Fibonacci levels & ZigZag lines to analyze trend direction & key price zones
📌 Wait for alerts or manually enter trades based on price reaction to Fibo levels

📢 Final Thoughts
The Fibo ZigZag is an essential tool for traders who rely on price action, trend reversals, and Fibonacci levels. Whether you're a beginner or a pro, this indicator helps you spot high-probability trading opportunities with ease.

⚡ Try it now & enhance your trading strategy! 🚀

💬 Let us know your feedback & suggestions in the comments! Happy trading! 📊🔥
Notas de Lançamento
//version=5
indicator("BullDozz Fibo ZigZag", overlay=true)

// === Inputs ===
inpDepth = input(34, title="ZigZag Depth")
inpDeviation = input(15, title="ZigZag Deviation")
inpBackStep = input(8, title="ZigZag BackStep")
inpLeg = input(1, title="ZigZag Leg")
inpRay = input(false, title="Ray")
inpLineColor = input.color(color.red, title="ZigZag Line Color")
inpTextColor = input.color(color.white, title="Text Color")
inpMaxBars = input(1000, title="Max Bars")

// Fibonacci Level Toggles & Colors
showFibo0 = input(true, title="Show 0.0% Level")
colorFibo0 = input.color(color.gray, title="0.0% Level Color")

showFibo23 = input(true, title="Show 23.6% Level")
colorFibo23 = input.color(color.orange, title="23.6% Level Color")

showFibo38 = input(true, title="Show 38.2% Level")
colorFibo38 = input.color(color.blue, title="38.2% Level Color")

showFibo50 = input(true, title="Show 50.0% Level")
colorFibo50 = input.color(color.green, title="50.0% Level Color")

showFibo61 = input(true, title="Show 61.8% Level")
colorFibo61 = input.color(color.purple, title="61.8% Level Color")

showFibo78 = input(true, title="Show 78.6% Level")
colorFibo78 = input.color(color.yellow, title="78.6% Level Color")

showFibo100 = input(true, title="Show 100.0% Level")
colorFibo100 = input.color(color.red, title="100.0% Level Color")

// ZigZag Variables
var float lastHigh = na
var float lastLow = na
var int lastHighIndex = na
var int lastLowIndex = na

zigzagHigh = ta.highestbars(high, inpDepth) == 0
zigzagLow = ta.lowestbars(low, inpDepth) == 0

if zigzagHigh
lastHigh := high
lastHighIndex := bar_index

if zigzagLow
lastLow := low
lastLowIndex := bar_index

// Draw ZigZag Line
if not na(lastHigh) and not na(lastLow)
line.new(lastHighIndex, lastHigh, lastLowIndex, lastLow, width=2, color=inpLineColor, style=line.style_solid)

// Fibonacci Levels Data
fiboLevels = array.from(0.0, 23.6, 38.2, 50.0, 61.8, 78.6, 100.0)
fiboToggles = array.from(showFibo0, showFibo23, showFibo38, showFibo50, showFibo61, showFibo78, showFibo100)
fiboColors = array.from(colorFibo0, colorFibo23, colorFibo38, colorFibo50, colorFibo61, colorFibo78, colorFibo100)

// Draw Fibonacci Levels if enabled
for i = 0 to array.size(fiboLevels) - 1
if array.get(fiboToggles, i) // Check if the level is enabled
level = array.get(fiboLevels, i) / 100.0
fiboPrice = lastLow + (level * (lastHigh - lastLow))
fiboColor = array.get(fiboColors, i)

// Draw Fibonacci level lines
line.new(lastLowIndex, fiboPrice, lastHighIndex, fiboPrice, width=1, color=fiboColor, style=line.style_dotted)

// Add text labels at Fibonacci levels
labelText = str.tostring(array.get(fiboLevels, i)) + "%\n" + str.tostring(fiboPrice, format.mintick)
label.new(lastHighIndex + 50, fiboPrice, text=labelText, color=fiboColor, textcolor=inpTextColor, size=size.small, style=label.style_label_left)

// Alert for ZigZag Formation
alertcondition(zigzagHigh or zigzagLow, title="New ZigZag Detected", message="A new ZigZag structure has formed!")

Aviso legal