本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=6
indicator("Omega Triple Cross", overlay=true)
// =====================================================
// EMAs
// =====================================================
ema20 = ta.ema(close, 20)
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)
// =====================================================
// Plot EMAs
// =====================================================
plot(ema20, color=color.new(color.white, 0), linewidth=1, title="EMA 20")
plot(ema50, color=color.new(color.aqua, 0), linewidth=1, title="EMA 50")
plot(ema200, color=color.new(color.red, 0), linewidth=1, title="EMA 200")
// =====================================================
// GOLDEN CROSSES
// =====================================================
// EMA 20 crosses ABOVE EMA 50
goldenCross20_50 = ta.crossover(ema20, ema50)
plotshape(
goldenCross20_50,
style=shape.diamond,
location=location.belowbar,
color=color.yellow,
size=size.small,
title="Golden Cross 20/50"
)
// EMA 50 crosses ABOVE EMA 200
goldenCross50_200 = ta.crossover(ema50, ema200)
plotshape(
goldenCross50_200,
style=shape.diamond,
location=location.belowbar,
color=color.blue,
size=size.small,
title="Golden Cross 50/200"
)
// =====================================================
// DEATH CROSSES
// =====================================================
// EMA 20 crosses BELOW EMA 50
deathCross20_50 = ta.crossunder(ema20, ema50)
plotshape(
deathCross20_50,
style=shape.xcross,
location=location.belowbar,
color=color.fuchsia,
size=size.small,
title="Death Cross 20/50"
)
// EMA 50 crosses BELOW EMA 200
deathCross50_200 = ta.crossunder(ema50, ema200)
plotshape(
deathCross50_200,
style=shape.xcross,
location=location.belowbar,
color=color.red,
size=size.small,
title="Death Cross 50/200"
)
// =====================================================
// ALERTS
// =====================================================
if goldenCross20_50
alert("Omega Triple Cross: Golden Cross 20/50 occurred!", alert.freq_once_per_bar)
if goldenCross50_200
alert("Omega Triple Cross: Golden Cross 50/200 occurred!", alert.freq_once_per_bar)
if deathCross20_50
alert("Omega Triple Cross: Death Cross 20/50 occurred!", alert.freq_once_per_bar)
if deathCross50_200
alert("Omega Triple Cross: Death Cross 50/200 occurred!", alert.freq_once_per_bar)