OPEN-SOURCE SCRIPT

10 EMA and 50 EMA Crossover Alerts

119
//version=5
indicator("10 EMA and 50 EMA Crossover Alerts", overlay=true)

// Define the EMAs
ema10 = ta.ema(close, 10)
ema50 = ta.ema(close, 50)

// Plot the EMAs on the chart
plot(ema10, color=color.blue, linewidth=2, title="10 EMA")
plot(ema50, color=color.red, linewidth=2, title="50 EMA")

// Crossover conditions
bullishCross = ta.crossover(ema10, ema50) // 10 EMA crosses above 50 EMA
bearishCross = ta.crossunder(ema10, ema50) // 10 EMA crosses below 50 EMA

// Generate alerts for crossovers
alertcondition(bullishCross, title="10 EMA Crosses Above 50 EMA", message="10 EMA has crossed above 50 EMA on the 1-hour chart. Buy Signal.")
alertcondition(bearishCross, title="10 EMA Crosses Below 50 EMA", message="10 EMA has crossed below 50 EMA on the 1-hour chart. Sell Signal.")

// Background color to indicate the crossover (optional for visualization)
bgcolor(bullishCross ? color.new(color.green, 90) : na, title="Bullish Crossover Background")
bgcolor(bearishCross ? color.new(color.red, 90) : na, title="Bearish Crossover Background")

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน