indicator · on price · open source
Fibonacci Retracement indicator
Fibonacci Retracement is a free open-source indicator. Auto Fibonacci retracement drawn from the last confirmed swing high to the last confirmed… Deepwick Script runs a subset of Pine Script.
Running…
Loading chart…
What Fibonacci Retracement does
Auto Fibonacci retracement drawn from the last confirmed swing high to the last confirmed swing low, with the 0.236, 0.382, 0.5, 0.618 and 0.786 levels plotted as horizontal lines.
- Updates only when a new swing prints (no repaint).
- The 0.618 and 0.786 levels are the highest-probability reversal zones for trend retracements.
Source code
Deepwick Script, a subset of Pine Script · read-only
//@version=6
indicator("Fibonacci Retracement", overlay=true)
swing = input.int(10, "Swing length", minval=2, maxval=50)
colorMid = input.color("color.orange", "Color Mid")
colorFill = input.color("color.yellow", "Color Fill")
high1 = ta.valuewhen(not na(ta.pivothigh(high, swing, swing)), high[swing], 0)
low1 = ta.valuewhen(not na(ta.pivotlow(low, swing, swing)), low[swing], 0)
range_ = high1 - low1
f236 = low1 + range_ * 0.236
f382 = low1 + range_ * 0.382
f500 = low1 + range_ * 0.5
f618 = low1 + range_ * 0.618
f786 = low1 + range_ * 0.786
p_0_236 = plot(f236, "0.236", color=colorMid, style=plot.style_linebr)
p_0_382 = plot(f382, "0.382", color=colorMid, style=plot.style_linebr)
p_0_5 = plot(f500, "0.5", color=colorFill, style=plot.style_linebr)
p_0_618 = plot(f618, "0.618", color=colorMid, style=plot.style_linebr)
p_0_786 = plot(f786, "0.786", color=colorMid, style=plot.style_linebr)
alertcondition(ta.crossover(close, f618), "Above 0.618", "Close crossed above the 0.618 fib")
alertcondition(ta.crossunder(close, f382), "Below 0.382", "Close crossed below the 0.382 fib")
No comments yet.
Sign in to comment.