TradingView
ozgurhan
Sep 14, 2021 7:57 AM

Golden cross indikatörü 

Bitcoin / DollarBitfinex

Description

Merhabalar, 50 günlük hareketli ortalamanın 200 günlük hareketli ortalamayı yukarı kesmesi durumuna golden cross denmektedir.
Aşağıda geliştirmiş olduğum pine script kodlarında ,golden cross durumunda indikatör hem al durumunda hem sat durumunda hemde alarm sayısından kazanmak için her iki durumda da alarm vermektedir.


// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
// © ozgurhan

//@version=4
study("Hareketlii ortalama", overlay=true)

hizliPeriyot=input(50)
yavasPeriyot=input(200)

hizliMa=sma(close, hizliPeriyot)
yavasMa=sma(close, yavasPeriyot)

yukariKeser=crossover(hizliMa, yavasMa)
asagiKeser=crossunder(hizliMa, yavasMa)

kesisimRengi=(hizliMa>yavasMa ? color.green : color.red)

plotshape(yukariKeser, size=size.small, style=shape.labelup, location=location.belowbar, color=color.green, text="AL", textcolor=color.black)
plotshape(asagiKeser, size=size.small, style=shape.labeldown , location=location.abovebar, color=color.red, text="SAT", textcolor=color.black)

plot1=plot(hizliMa, color=color.blue, linewidth=3, title="HIZLI MA")
plot2=plot(yavasMa, color=color.orange, linewidth=3, title="YAVAŞ MA")

fill(plot1, plot2, color=kesisimRengi, transp=10)


yukselenTrendrengi=hizliMa>yavasMa

bgcolor(yukselenTrendrengi ? color.green : color.red)

barcolor(yukselenTrendrengi ? color.green : color.red)

alertcondition(yukariKeser, title="yukari kesti", message="yukarı keser")
alertcondition(asagiKeser, title="asagi kesti", message="asagi kesti")
alertcondition(asagiKeser or yukariKeser, title="asağı veya yukarı golden cross", message="asağı veya yukarı golden cross")

More