RE: Late Spike1 Jun 2026 20:47
More cerfisticated trend reversal is "CONFIRMED" using a combination of SMA: https://www.tradingview.com/x/rgqEPizv/
I can share the code here if anyone wants it for their trading view:
//@version=5
indicator("Recovery Indicator", overlay=true)
// Daily moving averages
dClose = request.security(syminfo.tickerid, "D", close)
dSma20 = request.security(syminfo.tickerid, "D", ta.sma(close, 20))
dSma50 = request.security(syminfo.tickerid, "D", ta.sma(close, 50))
dSma200 = request.security(syminfo.tickerid, "D", ta.sma(close, 200))
// Daily slope checks
dSma200Falling = dSma200 < dSma200[10]
dSma50Rising = dSma50 > dSma50[10]
// Stage conditions based on daily data
avoid = dClose < dSma200 and dSma200Falling
watch = ta.crossover(dClose, dSma20)
earlyRecovery = ta.crossover(dClose, dSma50)
trendRepair = ta.crossover(dClose, dSma200)
// Earlier confirmation
confirmedRecovery = dClose > dSma200 and dClose > dSma50 and dSma50Rising
confirmedSignal = confirmedRecovery and not confirmedRecovery[1]
// Later bull-trend confirmation
bullTrend = dSma50Rising and ta.crossover(dSma50, dSma200)
// Stage labels
plotshape(avoid and not avoid[1], title="Avoid", text="Avoid", style=shape.labeldown, location=location.abovebar, color=color.red, textcolor=color.white, size=size.tiny)
plotshape(watch, title="Watch", text="Watch", style=shape.labelup, location=location.belowbar, color=color.yellow, textcolor=color.black, size=size.tiny)
plotshape(earlyRecovery, title="Early Recovery", text="Early", style=shape.labelup, location=location.belowbar, color=color.blue, textcolor=color.white, size=size.tiny)
plotshape(trendRepair, title="Trend Repair", text="Repair", style=shape.labelup, location=location.belowbar, color=color.purple, textcolor=color.white, size=size.tiny)
plotshape(confirmedSignal, title="Confirmed Recovery", text="Confirmed", style=shape.labelup, location=location.belowbar, color=color.green, textcolor=color.white, size=size.tiny)
plotshape(bullTrend, title="Bull Trend", text="Bull Trend", style=shape.labelup, location=location.belowbar, color=color.lime, textcolor=color.black, size=size.tiny)
// Background traffic light
bgcolor(avoid ? color.new(color.red, 88) : na)
bgcolor(dClose > dSma20 and dClose < dSma50 ? color.new(color.yellow, 90) : na)
bgcolor(dClose > dSma50 and dClose < dSma200 ? color.new(color.blue, 90) : na)
bgcolor(dClose > dSma200 and dClose > dSma50 and dSma50Rising ? color.new(color.green, 92) : na)
// Alerts
alertcondition(avoid and not avoid[1], title="Avoid", message="Daily price is below a falling 200-day SMA. Avoid.")
alertcondition(watch, title="Watch", message="Daily price has reclaimed the 20-day SMA. Watchlist signal.")
alertcondition(earlyRecovery, title="Early Recovery", message="Daily price has reclaimed the 50-day SMA. Early recovery signal.")
alertcondition(trendRepair, title="Trend Repair", message="Daily price has reclaimed the 200