OPEN-SOURCE SCRIPT

SMMA 40/225 Crossover Alert (Bar Close)

40
//version=5
indicator("SMMA 40/225 Crossover Alert (Bar Close)", shorttitle="SMMA Cross Alert", overlay=true)

// === SMMA Function ===
smma(src, length) =>
sma_ = ta.sma(src, length)
smma = 0.0
smma := na(smma[1]) ? sma_ : (smma[1] * (length - 1) + src) / length
smma

// === Calculate SMMA 40 & 225 ===
smma40 = smma(close, 40)
smma225 = smma(close, 225)

// === Crossover Conditions (confirmed after bar close) ===
bullishCross = ta.crossover(smma40, smma225)
bearishCross = ta.crossunder(smma40, smma225)

// === Trigger only after bar close ===
bullishSignal = bullishCross and barstate.isconfirmed
bearishSignal = bearishCross and barstate.isconfirmed

// === Alerts ===
alertcondition(bullishSignal, title="SMMA Bullish Crossover", message="✅ SMMA 40 crossed ABOVE SMMA 225 — BUY Signal (Confirmed at Bar Close)")
alertcondition(bearishSignal, title="SMMA Bearish Crossover", message="❌ SMMA 40 crossed BELOW SMMA 225 — SELL Signal (Confirmed at Bar Close)")

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.