Golden Death Cross Indicator

Trader745638 · study · 18 行 · 点赞 103 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

//@version=5
indicator("Golden Death Cross Indicator", overlay=true)
 
// Define the moving averages
smaShort = ta.sma(close, 50)  // 50-period SMA
smaLong = ta.sma(close, 200)  // 200-period SMA
 
// Detect crossovers
goldenCross = ta.crossover(smaShort, smaLong)  // Short crosses above Long
deathCross = ta.crossunder(smaShort, smaLong)  // Short crosses below Long
 
// Plot the moving averages on the chart
plot(smaShort, color=color.blue, title="SMA 50")
plot(smaLong, color=color.red, title="SMA 200")
 
// Create alerts
alertcondition(goldenCross, title="Golden Cross", message="Golden Cross Detected!")
alertcondition(deathCross, title="Death Cross", message="Death Cross Detected!")

← 返回列表