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")

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.