The standard SuperTrend is a well known tool, but it has a few limitations that show up quickly in live trading. The band flips too easily on brief wicks, it treats all volatility regimes the same way, and it gives no indication of how strong or weak the current trend actually is. StealthTrail SuperTrend addresses all three of those points with a set of targeted enhancements while keeping the core concept intact.
The first change is an adaptive multiplier. Instead of using a fixed ATR multiplier, the indicator computes the ratio of the current ATR to its own smoothed average over a longer period. When current volatility is running above its recent norm, the bands widen automatically. When the market is calm and ranges compress, the bands tighten. This means the indicator self-adjusts to the instrument and the current market regime without requiring manual reconfiguration.
The second change is a flip cushion. A standard SuperTrend flips direction the moment price crosses the band by any amount, including a single-tick wick. Here, a configurable cushion expressed as a fraction of ATR requires price to move a meaningful distance beyond the band before a trend change is registered. This filters out a large proportion of false reversals in choppy conditions.
The third change is a cooldown mechanism. After a trend flip, the indicator enforces a minimum number of bars before another flip can occur. This prevents the rapid back-and-forth signals that the standard SuperTrend can produce around flat or slow-moving band levels.
On top of those structural changes, two optional confirmation filters can be enabled independently. The RSI filter checks that momentum is aligned with the trend direction before confirming a signal, requiring RSI to be above a threshold for longs and below the mirror level for shorts. The volume filter checks that current volume is running above its 20-bar average by a configurable factor, so signals during thin or unconvincing moves can be suppressed.
The indicator also computes a trend strength value from 0 to 100, combining two components: how far price has moved away from the SuperTrend band relative to ATR, and how strongly RSI is aligned with the current direction. This strength value is used to modulate the opacity of the band visualization, so a strong confirmed trend appears vivid and a weak or recently flipped trend appears more faded. Buy and sell signals are marked with arrows at the band level at the moment of the confirmed flip.
Parameters
Suggested usage
Works well on trending instruments across daily and intraday timeframes. The adaptive multiplier makes it reasonably versatile across different asset classes without needing to retune the base settings. As with any trend following tool, it performs best when the market has a clear directional bias and will produce more noise during extended sideways phases, which is where the cooldown and cushion parameters earn their place.
// ============================================
// StealthTrail SuperTrend — ProBuilder Port
// Based on: WillyAlgoTrader
// www.prorealcode.com
// Sharing ProRealTime Knowledge
// ============================================
// Parameters
atrLen = 13
baseMult = 2.5
adaptSmooth = 55
cushion = 0.15
cooldownBars = 3
useRSI = 1 // 1 = RSI filter on, 0 = off
rsiLen = 13
rsiThresh = 45
useVolume = 0 // 1 = volume filter on, 0 = off
volMult = 1.2
minMult = 1.0
maxMult = 5.0
if barindex>atrLen+rsiLen+adaptSmooth then
once stband=medianprice
once upperband=high
once lowerband=low
// Warmup: no signals before indicators are primed
warmup = MAX(MAX(atrLen, adaptSmooth), 50)
// ATR and adaptive multiplier
atrVal = AverageTrueRange[atrLen](close)
atrSma = Average[adaptSmooth](atrVal)
IF atrSma > 0 THEN
volRatio = atrVal / atrSma
ELSE
volRatio = 1
ENDIF
adaptMult = MAX(minMult, MIN(maxMult, baseMult * volRatio))
// Band calculation
midPrice = (high + low) / 2
upperBand = midPrice + adaptMult * atrVal
lowerBand = midPrice - adaptMult * atrVal
flipCushion = cushion * atrVal
// Treat 0 (uninitialised) as bullish on the first bar
IF trendDir[1] = 0 THEN
prevDir = 1
ELSE
prevDir = trendDir[1]
ENDIF
// Cooldown counter: increments every bar, resets on a flip
barsSinceFlip = barsSinceFlip[1] + 1
// SuperTrend band ratcheting with flip cushion and cooldown
IF prevDir = 1 THEN
stBand = MAX(lowerBand, stBand[1])
IF close < (stBand - flipCushion) AND barsSinceFlip >= cooldownBars THEN
trendDir = -1
stBand = upperBand
barsSinceFlip = 0
ELSE
trendDir = 1
ENDIF
ELSE
if stband[1]>0 then
stBand = MIN(upperBand, stBand[1])
else
stband = upperband
endif
IF close > (stBand + flipCushion) AND barsSinceFlip >= cooldownBars THEN
trendDir = 1
stBand = lowerBand
barsSinceFlip = 0
ELSE
trendDir = -1
ENDIF
ENDIF
// RSI momentum filter
rsiVal = RSI[rsiLen](close)
IF useRSI = 1 THEN
IF trendDir = 1 THEN
momentumOk = (rsiVal >= rsiThresh)
ELSE
momentumOk = (rsiVal <= (100 - rsiThresh))
ENDIF
ELSE
momentumOk = 1
ENDIF
// Volume filter
volSma = Average[20](volume)
IF useVolume = 1 AND volSma > 0 THEN
volumeOk = (volume > volSma * volMult)
ELSE
volumeOk = 1
ENDIF
// Signal confirmation
filtersOk = momentumOk AND volumeOk
rawFlipUp = (trendDir = 1 AND trendDir[1] = -1)
rawFlipDown = (trendDir = -1 AND trendDir[1] = 1)
confirmedBuy = rawFlipUp AND filtersOk AND (BarIndex >= warmup)
confirmedSell = rawFlipDown AND filtersOk AND (BarIndex >= warmup)
// Trend strength 0-100
// Distance component: how far price is from band in ATR units (max 50)
// Momentum component: RSI alignment with trend direction (max 50)
IF atrVal > 0 THEN
distScore = MIN(ABS(close - stBand) / atrVal * 20, 50)
ELSE
distScore = 0
ENDIF
IF trendDir = 1 THEN
momRaw = MAX(rsiVal - 50, 0)
ELSE
momRaw = MAX(50 - rsiVal, 0)
ENDIF
momScore = MIN(momRaw, 50)
strengthVal = MIN(distScore + momScore, 100)-20
// Buy/sell arrows
IF confirmedBuy THEN
DrawArrowUp(BarIndex, stband) COLOURED(0, 230, 118, 255)
lastsignal=1
ENDIF
IF confirmedSell THEN
DrawArrowDown(BarIndex, stband) COLOURED(255, 82, 82, 255)
lastsignal=-1
ENDIF
// Band color by trend direction
IF trendDir = 1 THEN
r= 51
g= 230
b= 111
drawcandle(stband,close,stband,close) coloured(r,g,b,strengthval) bordercolor(0,0,0,0)
ELSE
r= 255
g= 83
b= 81
drawcandle(stband,stband,close,close) coloured(r,g,b,strengthval) bordercolor(0,0,0,0)
ENDIF
endif
RETURN stBand COLOURED(r,g,b) AS "SuperTrend"