RSI and EMA Crossover Alert

whoismudasar · study · 33 行 · 点赞 256 · TradingView 原页

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

Pine Script

//@version=5
indicator("RSI and EMA Crossover Alert", shorttitle="RE Alert", overlay = true)
 
// RSI(14)
rsi_value = ta.rsi(close, 14)
 
// EMA(5)
ema5_value = ta.ema(close, 5)
 
// EMA(10)
ema10_value = ta.ema(close, 10)
 
// RSI(14) above 50 condition
rsi_above_50 = rsi_value > 50
 
// EMA(5) crossover condition
ema5_condition = ta.crossover(ema5_value, ema10_value) and rsi_above_50
 
// Combine RSI and EMA conditions for long and short alerts
long_condition = ema5_condition
short_condition = ta.crossunder(ema5_value, ema10_value) and ta.crossunder(rsi_value, 50)
 
// Plot the conditions as green and red dots for visual reference
plotshape(series=long_condition, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(series=short_condition, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
 
// Plot RSI(14) and EMA lines on the chart
plot(ema5_value, title="EMA(5)", color=color.rgb(72, 255, 0))
plot(ema10_value, title="EMA(10)", color=color.rgb(148, 17, 7))
 
// Alert conditions
alertcondition(long_condition, title="Long Position Alert", message="EMA(5) crosses above EMA(10) while RSI(14) is above 50")
alertcondition(short_condition, title="Short Position Alert", message="EMA(5) crosses below EMA(10) and RSI(14) is below 50")

← 返回列表