# AutoFib Extensions -by Stocksight

1489 views
Autofib Extensions will automatically appear instantly when the candle breaks the high based on the period selected. Updates itself instantly, will show you the price of each level at the moment. Default uses a 3 period offset but can be modified.
```//Auto Fib Extentions created by Stocksight January 1, 2016 Version 1.0

study("AFEXT", overlay=true, max_bars_back= 89)
z = input (50)
p_offset=input(3)

a=(lowest(z)+highest(z))/2
b=lowest(z)
c=highest(z)

//fib extension Calcs
fib1 = (((c-b)*1.13)+b)
fib2 = (((c-b)*1.272)+b)
fib3 = (((c-b)*1.41)+b)
fib4 = (((c-b)*1.500)+b)
fib5 = (((c-b)*1.618)+b)
//Calcs for a total of 7 fib extensions available, only four will plot.
fib6 = (((c-b)*1.764)+b)
fib7 = (((c-b)*2.00)+b)

fib8 = (((c-b)*-.13)+b)
fib9 = (((c-b)*-.272)+b)
fib10 = (((c-b)*-.41)+b)
fib11 = (((c-b)*-.500)+b)
fib12 = (((c-b)*-.618)+b)
fib13 = (((c-b)*-.764)+b)
fib14 = (((c-b)*-1.00)+b)

p1 = close > c[p_offset] ? fib1[p_offset] :na
p2 = close > c[p_offset] ? fib2[p_offset] :na
p3 = close > c[p_offset] ? fib3[p_offset] :na
p4 = close > c[p_offset] ? fib4[p_offset] :na
p5 = close > c[p_offset] ? fib5[p_offset] :na

p8 = close < b[p_offset] ? fib8[p_offset] :na
p9 = close < b[p_offset] ? fib9[p_offset] :na
p10 = close < b[p_offset] ? fib10[p_offset] :na
p11 = close < b[p_offset] ? fib11[p_offset] :na
p12 = close < b[p_offset] ? fib12[p_offset] :na

plot(p1, color =yellow, style=linebr,join = true)
plot(p2, color = gray, style = linebr, join = true)
plot(p3, color = gray, style = linebr, join = true)
plot(p4, color = red, style = linebr,join = true)
//plot(p5, color = black, style = linebr,join = true)

plot(p8, color =yellow, style=linebr, join = true)
plot(p9, color = gray, style = linebr,join = true)
plot(p10, color = gray, style = linebr,join = true)
plot(p11, color = red, style = linebr,join = true)
//plot(p12, color = black, style = linebr, join = true)

```