You now have instant access to StealthAlgo Pro.
You’ll also receive a TradingView invite within 15 minutes so you can add the indicator to your charts.
To get started right away, copy the Pine Script code below and paste it into TradingView’s Pine editor:
//@version=5
//@version=5
indicator("StealthAlgo Pro – Final Clean Edition", overlay=true, max_bars_back=5000)
// === INPUTS ===
fastEMA = input.int(9, "Fast EMA")
slowEMA = input.int(21, "Slow EMA")
volumeMult = input.float(1.5, "Volume Spike Multiplier")
higherTF = input.timeframe("5", "Higher Timeframe Filter")
lookbackBars = input.int(15, "Swing Breakout Lookback")
cooldownBars = input.int(20, "Signal Cooldown (bars)")
requireBreakout = input.bool(true, "Require Swing Breakout?")
breakBasis = input.string("High", "Breakout Basis", options=["High","Close","High or Close"])
// === CALCULATIONS ===
emaFast = ta.ema(close, fastEMA)
emaSlow = ta.ema(close, slowEMA)
tr = ta.tr(true)
atr = ta.atr(14)
// === TREND LINES ===
plot(emaFast, title="Fast EMA", color=color.rgb(0,255,0), linewidth=2)
plot(emaSlow, title="Slow EMA", color=color.rgb(255,0,0), linewidth=2)
// === VOLUME SPIKE ===
vol = volume
volAvg = ta.sma(vol, 20)
volSpike = vol > volAvg * volumeMult
// === HTF TREND FILTER ===
emaHTF = request.security(syminfo.tickerid, higherTF, ta.ema(close, slowEMA))
trendOKLong = close > emaHTF
trendOKShort = close < emaHTF
// === CANDLE QUALITY FILTER ===
bodySize = math.abs(close - open)
minBody = atr * 0.3
strongCandle = bodySize > minBody
// === BREAKOUT CHECK (UPDATED) ===
prevHigh = ta.highest(high, lookbackBars)[1]
prevLow = ta.lowest(low, lookbackBars)[1]
brokeHighHigh = high > prevHigh
brokeHighClose = close > prevHigh
brokeLowLow = low < prevLow
brokeLowClose = close < prevLow
// choose which condition to use
brokeHighUsed = breakBasis == "High" ? brokeHighHigh
: breakBasis == "Close" ? brokeHighClose
: (brokeHighHigh or brokeHighClose)
brokeLowUsed = breakBasis == "High" ? brokeLowLow
: breakBasis == "Close" ? brokeLowClose
: (brokeLowLow or brokeLowClose)
// apply your requireBreakout toggle
breakoutOKLong = not requireBreakout or brokeHighUsed
breakoutOKShort = not requireBreakout or brokeLowUsed
// === SIGNAL LOGIC ===
longCondition = ta.crossover(emaFast, emaSlow) and volSpike and trendOKLong and strongCandle and breakoutOKLong
shortCondition = ta.crossunder(emaFast, emaSlow) and volSpike and trendOKShort and strongCandle and breakoutOKShort
// === COOLDOWN LOGIC ===
var int lastSignalBar = na
canSignal = na(lastSignalBar) or (bar_index - lastSignalBar > cooldownBars)
// === VISUAL SETTINGS ===
solidGreen = color.rgb(0,255,0)
solidRed = color.rgb(255,0,0)
labelOffset = tr * 6
lineLength = tr * 0.05
// === FINAL SIGNAL OUTPUT ===
if longCondition and canSignal
y1 = low - labelOffset
line.new(bar_index, low, bar_index, low + lineLength, xloc.bar_index, color=solidGreen, width=2)
line.new(bar_index, y1, bar_index, low, xloc.bar_index, color=solidGreen, width=1)
label.new(bar_index, y1, "Buy", style=label.style_label_up, textcolor=color.white, color=solidGreen, size=size.tiny)
lastSignalBar := bar_index
if shortCondition and canSignal
y2 = high + labelOffset
line.new(bar_index, high, bar_index, high - lineLength, xloc.bar_index, color=solidRed, width=2)
line.new(bar_index, y2, bar_index, high, xloc.bar_index, color=solidRed, width=1)
label.new(bar_index, y2, "Sell", style=label.style_label_down, textcolor=color.white, color=solidRed, size=size.tiny)
lastSignalBar := bar_index
Download the Script File
If you have any issues, email us at support@stealthalgo.com.