本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=4
// Bilgin Tanyol - Kaptanin Seyir Defteri
study(title="Golden & Death Cross", shorttitle="Golden & Death Cross", overlay=true)
len1 = input(50, minval=1, title="Fast SMA")
src1 = input(close, title="Source")
FAST = sma(src1, len1)
len2 = input(200, minval=1, title="Slow SMA")
src2 = input(close, title="Source")
SLOW = sma(src2, len2)
showFastSma = input(true, title= "Show Fast SMA")
showSlowSma = input(true, title= "Show Slow SMA")
p2 = plot(showFastSma and FAST ? FAST :na, color=color.green, linewidth=2, title="Fast EMA")
p4 = plot(showSlowSma and SLOW ? SLOW :na, color=color.red, linewidth=2, title="Slow EMA")
GoldenCross = crossover(FAST, SLOW)
DeathCross = crossunder(FAST, SLOW)
plotshape(series = GoldenCross, location=location.belowbar, style=shape.cross, color=color.green, transp=0, text="GOLDEN CROSS", size=size.normal)
plotshape(series = DeathCross, location=location.abovebar, style=shape.cross, color=color.red, transp=0, text="DEATH CROSS", size=size.normal)