Fibo son.txt

 avatar
unknown
plain_text
5 months ago
8.5 kB
31
Indexable
//@version=5
indicator("AutoFibb", shorttitle="AutoFibb", overlay=true, max_labels_count=500, max_lines_count=500, max_boxes_count=500, max_bars_back=500)

// Включение AutoFibo
AFBswitch = input.bool(true, "AutoFibo", group='***Switch panel (Overlay indicators)***', inline='S1')

// Группа настроек Auto Fibonacci
G_AutoFibo = '***Auto Fibonacci***'

// Входные параметры для уровней Fibonacci
FibHighLow = input(title='Higher High and Lower Low', defval=false, group=G_AutoFibo, inline='AFB')
AFB0 = input(title='Level %0', defval=true, group=G_AutoFibo, inline='AFB')
AFB1 = input(title='Level %0.236', defval=true, group=G_AutoFibo, inline='AFB1')
AFB2 = input(title='Level %0.382', defval=true, group=G_AutoFibo, inline='AFB1')
AFB3 = input(title='Level %0.5', defval=true, group=G_AutoFibo, inline='AFB1')
AFB4 = input(title='Level %0.618', defval=true, group=G_AutoFibo, inline='AFB2')
AFB5 = input(title='Level %0.786', defval=true, group=G_AutoFibo, inline='AFB2')
AFB6 = input(title='Level %1', defval=true, group=G_AutoFibo, inline='AFB2')
AFB7 = input(title='Level %1.618', defval=false, group=G_AutoFibo, inline='AFB3')
AFB8 = input(title='Level %2', defval=false, group=G_AutoFibo, inline='AFB3')
AFB9 = input(title='Level %2.618', defval=false, group=G_AutoFibo, inline='AFB3')
AFB10 = input(title='Level %-0.618', defval=false, group=G_AutoFibo, inline='AFB4')
AFB11 = input(title='Level %-161.8', defval=false, group=G_AutoFibo, inline='AFB4')
AFB12 = input(title='Level %-2', defval=false, group=G_AutoFibo, inline='AFB4')
AFB13 = input(title='Level %-261.8', defval=false, group=G_AutoFibo, inline='AFB4')
FPeriod = input(500, title='Fibo Period', group=G_AutoFibo)

// Расчет высшего и низшего значений за период
Fhigh = ta.highest(FPeriod)
Flow = ta.lowest(FPeriod)
FH = ta.highestbars(high, FPeriod)
FL = ta.lowestbars(low, FPeriod)
AutoFibo = FH < FL

// Расчет уровней Fibonacci
F0 = AutoFibo ? Flow : Fhigh
F236 = AutoFibo ? (Fhigh - Flow) * 0.236 + Flow : Fhigh - (Fhigh - Flow) * 0.236
F382 = AutoFibo ? (Fhigh - Flow) * 0.382 + Flow : Fhigh - (Fhigh - Flow) * 0.382
F500 = AutoFibo ? (Fhigh - Flow) * 0.500 + Flow : Fhigh - (Fhigh - Flow) * 0.500
F618 = AutoFibo ? (Fhigh - Flow) * 0.618 + Flow : Fhigh - (Fhigh - Flow) * 0.618
F786 = AutoFibo ? (Fhigh - Flow) * 0.786 + Flow : Fhigh - (Fhigh - Flow) * 0.786
F1000 = AutoFibo ? (Fhigh - Flow) * 1.000 + Flow : Fhigh - (Fhigh - Flow) * 1.000
F1618 = AutoFibo ? (Fhigh - Flow) * 1.618 + Flow : Fhigh - (Fhigh - Flow) * 1.618
F2000 = AutoFibo ? (Fhigh - Flow) * 2.000 + Flow : Fhigh - (Fhigh - Flow) * 2.000
F2618 = AutoFibo ? (Fhigh - Flow) * 2.618 + Flow : Fhigh - (Fhigh - Flow) * 2.618
FNeg618 = AutoFibo ? Flow - (Fhigh - Flow) * 0.618 : Fhigh + (Fhigh - Flow) * 0.618
FNeg1618 = AutoFibo ? Flow - (Fhigh - Flow) * 1.618 : Fhigh + (Fhigh - Flow) * 1.618
FNeg2000 = AutoFibo ? Flow - (Fhigh - Flow) * 2.000 : Fhigh + (Fhigh - Flow) * 2.000
FNeg2618 = AutoFibo ? Flow - (Fhigh - Flow) * 2.618 : Fhigh + (Fhigh - Flow) * 2.618

// Цвета уровней Fibonacci
Fcolor = #aacf92
FBcolor = #5a9afb
FUpDoColor = #f1680c
NFColor = #f76ad8e0
OFColor = #00ff0d



// Отображение уровней Fibonacci
plot(AFB0 and AFBswitch ? F0 : na, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='0')
plot(AFB1 and AFBswitch ? F236 : na, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='0.236')
plot(AFB2 and AFBswitch ? F382 : na, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='0.382')
plot(AFB3 and AFBswitch ? F500 : na, color=NFColor, linewidth=1, trackprice=true, show_last=1, title='0.5')
plot(AFB4 and AFBswitch ? F618 : na, color=FBcolor, linewidth=1, trackprice=true, show_last=1, title='0.618')
plot(AFB5 and AFBswitch ? F786 : na, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='0.786')
plot(AFB6 and AFBswitch ? F1000 : na, color=OFColor, linewidth=1, trackprice=true, show_last=1, title='1')
plot(AFB7 and AFBswitch ? F1618 : na, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='1.618')
plot(AFB8 and AFBswitch ? F2000 : na, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='2')
plot(AFB9 and AFBswitch ? F2618 : na, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='2.618')
plot(AFB10 and AFBswitch ? FNeg618 : na, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='-0.618')
plot(AFB11 and AFBswitch ? FNeg1618 : na, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='-1.618')
plot(AFB12 and AFBswitch ? FNeg2000 : na, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='-2')
plot(AFB13 and AFBswitch ? FNeg2618 : na, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='-2.618')

// Отображение уровней Fibonacci в виде фигур
plotshape(AFB0 and AFBswitch ? F0 : na, style=shape.diamond, location=location.absolute, color=#ffffff00, textcolor=color.new(#ff0000, 12), show_last=1, text='%0', offset=15)
plotshape(AFB1 and AFBswitch ? F236 : na, style=shape.diamond, location=location.absolute, color=#ffffff00, textcolor=color.new(#aacf92, 12), show_last=1, text='%0.236', offset=15)
plotshape(AFB2 and AFBswitch ? F382 : na, style=shape.diamond, location=location.absolute, color=#ffffff00, textcolor=color.new(#aacf92, 12), show_last=1, text='%0.382', offset=15)
plotshape(AFB3 and AFBswitch ? F500 : na, style=shape.diamond, location=location.absolute, color=#ffffff00, textcolor=#f76ad8e0, show_last=1, text='%0.5', offset=15)
plotshape(AFB4 and AFBswitch ? F618 : na, style=shape.diamond, location=location.absolute, color=#ffffff00, textcolor=color.new(#5a9afb, 12), show_last=1, text='%0.618', offset=15)
plotshape(AFB5 and AFBswitch ? F786 : na, style=shape.diamond, location=location.absolute, color=#ffffff00, textcolor=color.new(#aacf92, 12), show_last=1, text='%0.786', offset=15)
plotshape(AFB6 and AFBswitch ? F1000 : na, style=shape.diamond, location=location.absolute, color=#ffffff00, textcolor=color.new(#00ff0d, 12), show_last=1, text='%1', offset=15)
plotshape(AFB7 and AFBswitch ? F1618 : na, style=shape.diamond, location=location.absolute, color=#ffffff00, textcolor=color.new(#aacf92, 12), show_last=1, text='%1.618', offset=15)
plotshape(AFB8 and AFBswitch ? F2000 : na, style=shape.diamond, location=location.absolute, color=#ffffff00, textcolor=color.new(#aacf92, 12), show_last=1, text='%2', offset=15)
plotshape(AFB9 and AFBswitch ? F2618 : na, style=shape.diamond, location=location.absolute, color=#ffffff00, textcolor=color.new(#aacf92, 12), show_last=1, text='%2.618', offset=15)
plotshape(AFB10 and AFBswitch ? FNeg618 : na, style=shape.diamond, location=location.absolute, color=#ffffff00, textcolor=color.new(#aacf92, 12), show_last=1, text='%-0.618', offset=15)
plotshape(AFB11 and AFBswitch ? FNeg1618 : na, style=shape.diamond, location=location.absolute, color=#ffffff00, textcolor=color.new(#aacf92, 12), show_last=1, text='%-1.618', offset=15)
plotshape(AFB12 and AFBswitch ? FNeg2000 : na, style=shape.diamond, location=location.absolute, color=#ffffff00, textcolor=color.new(#aacf92, 12), show_last=1, text='%-2', offset=15)
plotshape(AFB13 and AFBswitch ? FNeg2618 : na, style=shape.diamond, location=location.absolute, color=#ffffff00, textcolor=color.new(#aacf92, 12), show_last=1, text='%-2.618', offset=15)

// Отображение высшего и низшего значений за период
plotshape(FibHighLow and AFBswitch ? Flow : na, style=shape.labelup, location=location.absolute, size=size.tiny, color=color.new(#ff6600, 0), textcolor=color.new(color.black, 0), show_last=1, text='Low', offset=FL)
plotshape(FibHighLow and AFBswitch ? Fhigh : na, style=shape.labeldown, location=location.absolute, size=size.tiny, color=color.new(#ff6600, 0), textcolor=color.new(color.black, 0), show_last=1, text='High', offset=FH)
Editor is loading...
Leave a Comment