本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
// EMA Golden/Death Cross Indicator
study(title="Eagle-Crossing", shorttitle="Goldeneagle-Crossing", overlay=true)
fastEmaPeriod = input(8, minval=1, title="Fast EMA Periods")
slowEmaPeriod = input(90, minval=1, title="Slow EMA Periods")
showCrosses = input(true, title="Show EMA Crosses?")
enableBarbie = input(true, title="Enable Barbie")
src = close
fastEma = ema(close, fastEmaPeriod)
slowEma = ema(close, slowEmaPeriod)
ma200 = sma(src, 200)
plot(fastEma, title = 'Fast EMA', linewidth=1, color=lime)
plot(slowEma, title = 'Slow EMA', linewidth=1, color=fuchsia)
goldenCross = crossover(fastEma, slowEma)
deathCross = crossover(slowEma, fastEma)
plotshape(showCrosses and deathCross*-1 ? deathCross*-1 : na, title="Death Cross", color=red, style=shape.diamond, location=location.abovebar, size=size.normal)
plotshape(showCrosses and goldenCross ? goldenCross : na, title="Golden Cross", color=green, style=shape.diamond, location=location.abovebar, size=size.normal)
// Barbie Indicator
longCond = crossover(close,ma200)
shortCond = crossover(ma200,close)
// Plot Barbie or Get Out
plotshape((longCond and not longCond[1]) and enableBarbie, color=#FF00FF, style=shape.square, location=location.belowbar, size=size.tiny, editable=true)
alertcondition((longCond and not longCond[1]) and enableBarbie, title='Barbie_Buy', message='e=binance s=<COINPAIR> b=buy q=99% | delay=1 b=buy q=99% | delay=1 b=buy q=99%')
alertcondition(goldenCross, title='GreenDiamond_buy', message='e=binance s=<COINPAIR> b=buy q=99% | delay=1 b=buy q=99% | delay=1 b=buy q=99%')
alertcondition(deathCross, title='RedDiamond_SELL', message='e=binance s=<COINPAIR> b=sell q=99% | delay=1 b=sell q=99% | delay=1 b=sell q=99%')