OPEN-SOURCE SCRIPT

One-Time 50 SMA Trend Start

29
//version=5
indicator("One-Time 50 SMA Trend Start", overlay=true)

// ─── Inputs ──────────────────────────────────────────────
smaLength = input.int(50, "SMA Length")

// ─── Calculations ────────────────────────────────────────
sma50 = ta.sma(close, smaLength)
crossUp = ta.crossover(close, sma50)

// Track whether we've already fired today
var bool alerted = false

// Reset alert for new session
if ta.change(time("D"))
alerted := false

// Trigger one signal only
signal = crossUp and not alerted
if signal
alerted := true

// ─── Plots ───────────────────────────────────────────────
plot(sma50, color=color.orange, linewidth=2, title="50 SMA")

plotshape(
signal,
title="First Cross Above",
style=shape.triangleup,
color=color.new(color.green, 0),
size=size.large,
location=location.belowbar,
text="Trend"
)

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.