بتكوين

fibonaaci ve parabolic sar kesişimleri tek bir alarm ile

1068
Merhabalar aşağıda vermiş olduğum pine script kodu fibonacci seviyelerinden
%0
%23,6
%38,,2
%50
%61,8
%78,6
%100
fibonaccci değerlerinde, parobolic sar indikatöründen de "buy" alarmı geldiği zaman tek bir alarm koyarak kesişimleri bulmaktadır.

// © ozgurhan

//version=4


study(title="ozgurhan fibo-psar", shorttitle="ozgurhan fibo sar", overlay=true)
FPeriod = input(144, title="Fibo Period")
plotF1618 = input(title="Plot 1.618 Level?", type=input.bool, defval=false)

Fhigh = highest(FPeriod)
Flow = lowest(FPeriod)
FH = highestbars(high, FPeriod)
FL = lowestbars(low, FPeriod)
downfibo = FH < FL

F0 = downfibo ? Flow : Fhigh
F236 = downfibo ? (Fhigh - Flow) * 0.236 + Flow : Fhigh - (Fhigh - Flow) * 0.236
F382 = downfibo ? (Fhigh - Flow) * 0.382 + Flow : Fhigh - (Fhigh - Flow) * 0.382
F500 = downfibo ? (Fhigh - Flow) * 0.500 + Flow : Fhigh - (Fhigh - Flow) * 0.500
F618 = downfibo ? (Fhigh - Flow) * 0.618 + Flow : Fhigh - (Fhigh - Flow) * 0.618
F786 = downfibo ? (Fhigh - Flow) * 0.786 + Flow : Fhigh - (Fhigh - Flow) * 0.786
F1000 = downfibo ? (Fhigh - Flow) * 1.000 + Flow : Fhigh - (Fhigh - Flow) * 1.000
F1618 = downfibo ? (Fhigh - Flow) * 1.618 + Flow : Fhigh - (Fhigh - Flow) * 1.618

Fcolor = downfibo ? #00cc00 : #E41019
Foffset = downfibo ? FH : FL

plot(F0, color=Fcolor, linewidth=2, trackprice=true, show_last=1, title='0', transp=0)
plot(F236, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='0.236', transp=0)
plot(F382, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='0.382', transp=0)
plot(F500, color=Fcolor, linewidth=2, trackprice=true, show_last=1, title='0.5', transp=0)
plot(F618, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='0.618', transp=0)
plot(F786, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='0.786', transp=0)
plot(F1000, color=Fcolor, linewidth=2, trackprice=true, show_last=1, title='1', transp=0)
plot(plotF1618 and F1618 ? F1618 : na, color=Fcolor, linewidth=3, trackprice=true, show_last=1, title='1.618', transp=0)

plotshape(F0, style=shape.labeldown, location=location.absolute, color=Fcolor, textcolor=color.black, show_last=1, text="%0", offset=15, transp=30)
plotshape(F236, style=shape.labeldown, location=location.absolute, color=Fcolor, textcolor=color.black, show_last=1, text="%23.6", offset=15, transp=30)
plotshape(F382, style=shape.labeldown, location=location.absolute, color=Fcolor, textcolor=color.black, show_last=1, text="%38.2", offset=15, transp=30)
plotshape(F500, style=shape.labeldown, location=location.absolute, color=Fcolor, textcolor=color.black, show_last=1, text="%50", offset=15, transp=30)
plotshape(F618, style=shape.labeldown, location=location.absolute, color=Fcolor, textcolor=color.black, show_last=1, text="%61.8", offset=15, transp=30)
plotshape(F786, style=shape.labeldown, location=location.absolute, color=Fcolor, textcolor=color.black, show_last=1, text="%78.6", offset=15, transp=30)
plotshape(F1000, style=shape.labeldown, location=location.absolute, color=Fcolor, textcolor=color.black, show_last=1, text="%100", offset=15, transp=30)
plotshape(plotF1618 and F1618 ? F1618 : na, style=shape.labeldown, location=location.absolute, color=Fcolor, textcolor=color.black, show_last=1, text="%161.8", offset=15, transp=30)

plotshape(Flow, style=shape.labelup, location=location.absolute, size=size.large, color=color.yellow, textcolor=color.black, show_last=1, text="Low", offset=FL, transp=0)
plotshape(Fhigh, style=shape.labeldown, location=location.absolute, size=size.large, color=color.yellow, textcolor=color.black, show_last=1, text="High", offset=FH, transp=0)



//
start = input(title="Start", type=input.float, step=0.001, defval=0.02)
increment = input(title="Increment", type=input.float, step=0.001, defval=0.02)
maximum = input(title="Maximum", type=input.float, step=0.01, defval=0.2)
width = input(title="Point Width", type=input.integer, minval=1, defval=2)
highlightStartPoints = input(title="Highlight Start Points ?", type=input.bool, defval=true)
showLabels = input(title="Show Buy/Sell Labels ?", type=input.bool, defval=true)
highlightState = input(title="Highlight State ?", type=input.bool, defval=true)
psar = sar(start, increment, maximum)
dir = psar < close ? 1 : -1
psarColor = dir == 1 ? #3388bb : #fdcc02
psarPlot = plot(psar, title="PSAR", style=plot.style_circles, linewidth=width, color=psarColor, transp=0)
var color longColor = color.green
var color shortColor = color.red
buySignal = dir == 1 and dir[1] == -1
plotshape(buySignal and highlightStartPoints ? psar : na, title="Long Start", location=location.absolute, style=shape.circle, size=size.tiny, color=longColor, transp=0)
plotshape(buySignal and showLabels ? psar : na, title="Buy Label", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=longColor, textcolor=color.white, transp=0)
midPricePlot = plot(ohlc4, title="", display=display.none)
fillColor = highlightState ? (dir == 1 ? longColor : shortColor) : na
fill(midPricePlot, psarPlot, title="Trade State Filling", color=fillColor)


alertcondition(((FH > FL and crossover(close, F236)) and (buySignal)) or ((FH > FL and crossover(close, F382)) and (buySignal)) or ((FH > FL and crossover(close, F500)) and (buySignal)) or ((FH > FL and crossover(close, F618)) and (buySignal)) or ((FH > FL and crossover(close, F786)) and (buySignal)) or ((FH < FL and crossover(close, 236)) and (buySignal)) or ((FH < FL and crossover(close, F382)) and (buySignal)) or ((FH < FL and crossover(close, F500)) and (buySignal)) or ((FH < FL and crossover(close, F618)) and (buySignal)) or ((FH < FL and crossover(close, F786)) and (buySignal)), title="fibo-Parabolic alarm", message="fibo-parabolic alarm")

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.