StealthTrail SuperTrend [WillyAlgoTrader]📡 StealthTrail SuperTrend is an overlay indicator that takes the classic SuperTrend concept and adds five layers of noise reduction: an adaptive multiplier that scales bands to current volatility, a flip cushion that requires price to push beyond the band by a configurable ATR distance before confirming a trend change, a cooldown timer that enforces a minimum gap between flips, an RSI momentum filter that blocks trend changes without directional confirmation, and a composite trend strength score (0–100) that quantifies how committed the current trend is. The result is a SuperTrend that stays in trends longer, flips less often in chop, and gives you a real-time confidence reading on every trend leg.
🧩 WHY THESE COMPONENTS WORK TOGETHER
The standard SuperTrend has one well-known problem: whipsaws. In ranging or choppy markets, price repeatedly crosses the band boundary, triggering rapid bullish→bearish→bullish flips that produce losing signals. The root causes are:
1. Fixed multiplier — the band width doesn't adapt when volatility contracts or expands, so the same multiplier is too tight in high-vol and too wide in low-vol
2. Instant flip — a single close beyond the band triggers a trend change, even if it's a minor wick-driven overshoot
3. No recovery time — the indicator can flip back on the very next bar, creating same-bar or next-bar whipsaws
4. No momentum context — the flip happens regardless of whether momentum actually supports the new direction
StealthTrail addresses each root cause with a dedicated mechanism:
Adaptive multiplier → solves #1 : bands automatically widen when ATR is above its average (high volatility) and tighten when below (low volatility), keeping the band distance proportional to current market conditions.
Flip cushion → solves #2 : price must close beyond the band by an additional cushion (configurable fraction of ATR) before the flip is accepted, filtering out marginal crossovers.
Cooldown timer → solves #3 : after a flip, the indicator ignores further flip attempts for N bars (default 3), preventing rapid back-and-forth in chop.
Momentum filter → solves #4 : a bullish flip requires RSI above a threshold, a bearish flip requires RSI below the symmetric threshold, confirming that momentum actually supports the direction change.
Trend strength scoring → provides context : combines price distance from band + RSI alignment into a 0–100 score, so you know whether the current trend is strong, fading, or about to flip.
These five mechanisms work as a pipeline: the adaptive multiplier sets the right band width → the cushion prevents marginal crossovers → the cooldown prevents rapid reversals → the momentum filter confirms directional support → and the strength score tells you how committed the trend is. Removing any one layer reintroduces the specific whipsaw pattern it was designed to prevent.
🔍 WHAT MAKES IT ORIGINAL
1️⃣ Adaptive volatility multiplier.
Instead of using a fixed ATR multiplier (classic SuperTrend), StealthTrail scales the multiplier dynamically:
adaptiveMult = baseMultiplier × (currentATR / SMA(ATR, adaptationPeriod))
Where currentATR = ta.atr(atrLength), and SMA(ATR) is the volatility baseline over the adaptation smoothing period (default 55 bars). The ratio currentATR / averageATR measures whether volatility is currently above (ratio > 1.0) or below (ratio < 1.0) its recent norm.
The adaptive multiplier is clamped between configurable min (default 1.0) and max (default 5.0) to prevent extreme values. When volatility spikes (e.g., news event), the multiplier increases → bands widen → the trend doesn't flip on a volatility-driven spike. When volatility compresses (consolidation), the multiplier decreases → bands tighten → the indicator catches the breakout earlier.
This can be toggled off for classic fixed-multiplier behavior.
2️⃣ Flip cushion — requires extra ATR distance beyond the band.
A standard SuperTrend flips the moment close crosses the band. StealthTrail requires:
Bullish flip: close > upperBand + cushion × ATR
Bearish flip: close < lowerBand − cushion × ATR
The cushion (default 0.15× ATR) creates a dead zone around the band boundary. Price must push meaningfully beyond the band — not just touch it — before a flip is accepted. This single mechanism eliminates a large portion of marginal crossover whipsaws where price briefly clips the band before returning.
Setting the cushion to 0.0 restores classic SuperTrend behavior (flip exactly at the band).
3️⃣ Signal cooldown timer.
After every confirmed trend flip, a counter starts. No new flip can occur for N bars (default 3). This prevents the most destructive whipsaw pattern: a bearish flip immediately followed by a bullish flip on the next bar (or vice versa), which generates two consecutive losing signals.
The cooldown is tracked as barsSinceFlip, incremented each bar, and checked before any flip is processed. Only when barsSinceFlip ≥ cooldownInput can a new flip occur. This is independent of the cushion — both must pass.
4️⃣ RSI momentum filter.
On every raw trend flip (band crossed + cushion passed + cooldown passed), an additional RSI check is applied:
Bullish flip requires: RSI(rsiLength) ≥ rsiThreshold (default 45)
Bearish flip requires: RSI(rsiLength) ≤ (100 − rsiThreshold) = 55
This is deliberately asymmetric around the center by design (threshold 45, not 50): a bullish flip only needs RSI ≥ 45 (slightly below center), meaning it passes unless momentum is actively bearish. A bearish flip only needs RSI ≤ 55. This permissive threshold blocks the worst counter-momentum flips without being so strict that it delays legitimate trend changes.
When the filter blocks a flip, the trend direction does not change and the band continues ratcheting in the original direction. An optional "Show Filtered Flips" setting displays a muted dot where a flip was blocked — useful for understanding filter behavior.
5️⃣ Composite trend strength score (0–100).
On every bar, a strength score is calculated from two components:
Distance score (0–50): How far price is from the SuperTrend band, measured in ATR units:
distScore = min(|close − band| / ATR × 20, 50)
A large distance means price is well away from the band — the trend has room before a potential flip.
Momentum score (0–50): How well RSI aligns with the current trend direction:
For bullish: momScore = min(max(RSI − 50, 0), 50)
For bearish: momScore = min(max(50 − RSI, 0), 50)
RSI reading that confirms the trend direction contributes up to 50 points.
Total: strength = round(min(distScore + momScore, 100))
Classification: Strong ≥ 70, Medium ≥ 40, Weak < 40. Displayed in the dashboard and included in alert messages. This gives you a real-time confidence reading: a Strong reading means price is far from the band with confirming momentum — the trend is well-established. A Weak reading means price is near the band or momentum is fading — a flip may be imminent.
6️⃣ Filtered flip visualization.
When "Show Filtered Flips" is enabled, a muted gray dot appears on the band at every point where a raw flip occurred but was blocked by a filter (momentum or volume). This is a transparency feature: instead of silently suppressing signals, the indicator shows you exactly where it intervened and what it filtered out. You can evaluate whether the filter saved you from a bad signal or delayed a good one.
7️⃣ Gradient fill between price and band.
The space between close and the SuperTrend band is filled with a directional gradient: bullish trends fade from green (near band) to transparent (near price), bearish trends fade from red to transparent. The gradient uses fill() with top/bottom color mapping — the visual intensity naturally increases as the band is further from price, creating an intuitive "strength of trend" visual without needing to read the dashboard.
⚙️ HOW IT WORKS — CALCULATION FLOW
Step 1 — ATR calculation: ta.atr(atrLength) with a high-low fallback for early bars where ATR is unavailable.
Step 2 — Adaptive multiplier: If adaptive mode is on: multiplier = baseMultiplier × (ATR / SMA(ATR, adaptSmoothing)), clamped to . If off: multiplier = baseMultiplier (fixed).
Step 3 — Band calculation: upperBand = hl2 + multiplier × ATR. lowerBand = hl2 − multiplier × ATR. Bands are calculated from hl2 (midpoint) for symmetry.
Step 4 — Band ratcheting: In an uptrend, the lower band can only rise — it is set to max(current_lowerBand, previous_band). In a downtrend, the upper band can only fall — min(current_upperBand, previous_band). This ratcheting prevents the band from retreating during a trend, which would prematurely trigger a flip.
Step 5 — Flip detection: In an uptrend: if close < band − cushion × ATR AND barsSinceFlip ≥ cooldown → raw bearish flip. In a downtrend: if close > band + cushion × ATR AND barsSinceFlip ≥ cooldown → raw bullish flip. On flip, the band resets to the opposite band value and barsSinceFlip resets to 0.
Step 6 — Filter gate: If RSI momentum filter is on: bullish flip requires RSI ≥ threshold, bearish requires RSI ≤ (100 − threshold). If volume filter is on: volume must exceed SMA(volume, 20) × multiplier. Both must pass for the flip to become a confirmed signal. If either fails, the flip is recorded as "filtered" (visualizable) but the trend direction reverts — no signal is emitted.
Step 7 — Signal emission: Confirmed flip + barstate.isconfirmed + warmup check → Buy (▲) or Sell (▼) label appears. Strength score is calculated and updated.
📖 HOW TO USE
🎯 Quick start:
1. Add the indicator — the adaptive SuperTrend band appears immediately
2. Green band = bullish trend, red band = bearish trend
3. ▲ label below bar = confirmed buy (trend flipped bullish through all filters)
4. ▼ label above bar = confirmed sell (trend flipped bearish)
5. Check dashboard for strength score — Strong trends are more reliable
👁️ Reading the chart:
— 🟢 Green step-line = SuperTrend band in bullish mode (following lower band)
— 🔴 Red step-line = SuperTrend band in bearish mode (following upper band)
— 🟢 Large green dot on band = confirmed bullish flip
— 🔴 Large red dot on band = confirmed bearish flip
— ⚫ Gray dot on band (optional) = raw flip that was blocked by a filter
— 🟩🟥 Gradient fill = visual trend strength (denser = further from band = stronger trend)
— Background tint (optional) = overall trend direction shading
📊 Dashboard fields:
— Trend: current direction (Bullish / Bearish)
— Signal: last confirmed signal with bars elapsed
— Strength: 0–100 score with classification (Strong / Medium / Weak)
— Multiplier: current adaptive multiplier value (e.g., 2.83×)
— RSI: current RSI reading
— Timeframe and version
🔧 Tuning guide:
— Too many whipsaws: increase Flip Cushion (0.2–0.3), increase Cooldown (4–6), enable Momentum Filter
— Signals too late: decrease Flip Cushion (0.05–0.10), decrease Cooldown (1–2), lower Base Multiplier
— Bands too wide in low-vol: decrease Min Adaptive Mult (0.8), decrease Adaptation Smoothing (30–40)
— Bands too tight in high-vol: increase Max Adaptive Mult (5.0–6.0), increase Base Multiplier
— Ranging/choppy market: enable Momentum Filter, increase Cooldown, increase Cushion — all three work together to suppress chop signals
— Strong trending market: decrease Cushion (0.05), decrease Cooldown (1), disable Momentum Filter — let the indicator react faster to trend continuation
⚙️ KEY SETTINGS REFERENCE
⚙️ Main:
— ATR Length (default 13): volatility measurement period
— Base Multiplier (default 2.5): base ATR multiplier for band width
— Adaptive Multiplier (default On): scale bands by current/average ATR ratio
— Adaptation Smoothing (default 55): SMA lookback for ATR baseline
🔍 Filters:
— Flip Cushion (default 0.15× ATR): extra distance beyond band required for flip
— Signal Cooldown (default 3 bars): minimum gap between flips
— Momentum Filter (default On): RSI confirmation for trend changes
— RSI Length (default 13) / RSI Threshold (default 45): momentum filter parameters
— Volume Filter (default Off): above-average volume confirmation
🔧 Advanced:
— Min Adaptive Mult (default 1.0): floor for adaptive scaling
— Max Adaptive Mult (default 5.0): ceiling for adaptive scaling
🎨 Visual:
— Band line, gradient fill, filtered flip dots, trend background (all toggleable)
— Auto / Dark / Light theme
🔔 Alerts
— 🟢 BUY — ticker, price, band level, timeframe, strength score
— 🔴 SELL — same fields
Both support plain text and JSON webhook format. Bar-close confirmed, filter-gated, cooldown-enforced.
⚠️ IMPORTANT NOTES
— 🚫 No repainting. All signals require barstate.isconfirmed. Band ratcheting is deterministic — the band value on a closed bar never changes retroactively. A warmup period (max of ATR length, adaptation smoothing, and 50 bars) prevents signals during insufficient data.
— 📐 This is not a standard SuperTrend. The adaptive multiplier, flip cushion, cooldown, and momentum filter fundamentally change the signal generation logic. A classic SuperTrend flip would occur significantly earlier (or later, depending on volatility) than a StealthTrail flip — they are not interchangeable.
— ⚖️ The flip cushion and cooldown work independently . Both must pass for a flip to occur. In chop, the cooldown may block a flip even after the cushion is satisfied, or the cushion may prevent a flip even after the cooldown expires. This dual-gate design is intentional.
— 📊 Trend strength is a real-time reading , not a prediction. A strength of 85 means price is far from the band with confirming momentum right now — it does not predict how long the trend will continue.
— 🔄 "Filtered Flips" (gray dots) show where a trend change would have occurred in a classic SuperTrend but was blocked by the momentum or volume filter. This transparency helps you understand the filter's impact and tune the threshold accordingly.
— 📈 Volume filter auto-disables on instruments without volume data (many forex pairs). On these instruments, only the momentum filter, cushion, and cooldown provide noise reduction.
— 🛠️ This is a trend-following signal tool , not an automated trading bot. It identifies trend direction, scores trend strength, and generates filtered signals — trade decisions remain yours.
— 🌐 Works on all markets and timeframes. The adaptive multiplier self-calibrates to any instrument's volatility profile.
Pine Script® インジケーター






















