OPEN-SOURCE SCRIPT
Updated Phantom Trend Cloud [WillyAlgoTrader]

Phantom Trend Cloud is an adaptive trend-following system built on a Hull-weighted midline and ATR-based dynamic cloud. It automatically identifies trend direction and detects retest zones — moments where price pulls back into the cloud and bounces in the direction of the trend, offering high-probability entry opportunities.
━━━━━━━━━━━━━━━━━━━━━━━━
🔍 HOW IT WORKS
The indicator plots a dynamic envelope around a Hull Moving Average midline. The cloud width adapts to volatility via ATR — it expands during volatile conditions and contracts in calm markets. When price touches the cloud and rejects in the trend direction, that's a retest signal.
Unlike traditional moving averages, the Hull-weighted midline responds faster while staying smooth — fewer false signals during consolidation, quicker reaction to real reversals.
━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ SIGNAL LOGIC
◆ Bull Retest — price dips into the cloud from above, closes above the midline with a bullish candle. Potential long entry.
◆ Bear Retest — price pushes into the cloud from below, closes below the midline with a bearish candle. Potential short entry.
◆ Trend Change — fast/slow EMA crossover signals a shift in trend direction.
Every signal is confirmed only on bar close — no repainting, ever.
━━━━━━━━━━━━━━━━━━━━━━━━
🛡️ BUILT-IN FILTERS
Signals pass through a multi-layer filtering system to reduce noise and improve quality:
◆ Volume Filter — signals fire only when volume exceeds SMA(20) × multiplier. Auto-disables on instruments with no volume data (Forex).
◆ RSI Momentum — bullish retests require RSI > 40, bearish retests require RSI < 60. Eliminates signals against the momentum.
◆ ADX Trend Strength — optional filter that only allows signals when ADX confirms a trending market (above threshold).
◆ HTF Trend Filter — optional higher timeframe alignment. Uses `[1]` offset + `lookahead_on` to ensure zero repainting.
◆ Cooldown — minimum pause between consecutive signals (default 8 bars), prevents signal clustering during chop.
━━━━━━━━━━━━━━━━━━━━━━━━
📊 RETEST STRENGTH SCORE (0–100)
Each retest is assigned a composite quality score based on four components:
◆ Proximity (up to 50 pts) — how deep price penetrated into the cloud
◆ Volume (up to 25 pts) — current volume relative to its 20-bar average
◆ RSI (up to 15 pts) — how well momentum aligns with the signal direction
◆ ADX (up to 10 pts) — overall trend strength at the time of signal
Higher score = higher quality setup. The score is displayed in the signal tooltip and on the dashboard.
━━━━━━━━━━━━━━━━━━━━━━━━
🎨 VISUALS
◆ Gradient cloud fill with automatic theme detection (Dark / Light / Auto)
◆ Diamond ◆ markers at retest points with detailed tooltips (score, RSI, ADX)
◆ Dotted S/R lines from the latest retests — automatically removed when price breaks through
◆ Optional background tint based on trend direction
◆ Compact dashboard: trend, last signal, score, trend strength, timeframe, version
━━━━━━━━━━━━━━━━━━━━━━━━
🔔 ALERTS & WEBHOOKS
4 alert types: Bull Retest, Bear Retest, Trend Up, Trend Down.
Two output formats:
◆ Text — human-readable messages for Telegram, email, or mobile notifications
◆ JSON — structured webhook payloads for 3Commas, Alertatron, or custom bots
━━━━━━━━━━━━━━━━━━━━━━━━
📝 RECOMMENDED SETTINGS
◆ Ribbon Length: 14–30 (default 21) — higher values produce smoother clouds with fewer whipsaws
◆ Cloud Width: 1.0–2.5 × ATR (default 1.5) — wider clouds filter more noise, tighter clouds catch more retests
◆ Works best on timeframes 15m and above
◆ Enable Volume + RSI filters for balanced signal quality; add ADX and/or HTF filter for a more conservative approach
━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ DISCLAIMER
This indicator is a technical analysis tool and does not constitute financial advice. All trading decisions are made at your own risk. Always use proper risk management and backtest settings on historical data before live trading.
━━━━━━━━━━━━━━━━━━━━━━━━
🔍 HOW IT WORKS
The indicator plots a dynamic envelope around a Hull Moving Average midline. The cloud width adapts to volatility via ATR — it expands during volatile conditions and contracts in calm markets. When price touches the cloud and rejects in the trend direction, that's a retest signal.
Unlike traditional moving averages, the Hull-weighted midline responds faster while staying smooth — fewer false signals during consolidation, quicker reaction to real reversals.
━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ SIGNAL LOGIC
◆ Bull Retest — price dips into the cloud from above, closes above the midline with a bullish candle. Potential long entry.
◆ Bear Retest — price pushes into the cloud from below, closes below the midline with a bearish candle. Potential short entry.
◆ Trend Change — fast/slow EMA crossover signals a shift in trend direction.
Every signal is confirmed only on bar close — no repainting, ever.
━━━━━━━━━━━━━━━━━━━━━━━━
🛡️ BUILT-IN FILTERS
Signals pass through a multi-layer filtering system to reduce noise and improve quality:
◆ Volume Filter — signals fire only when volume exceeds SMA(20) × multiplier. Auto-disables on instruments with no volume data (Forex).
◆ RSI Momentum — bullish retests require RSI > 40, bearish retests require RSI < 60. Eliminates signals against the momentum.
◆ ADX Trend Strength — optional filter that only allows signals when ADX confirms a trending market (above threshold).
◆ HTF Trend Filter — optional higher timeframe alignment. Uses `[1]` offset + `lookahead_on` to ensure zero repainting.
◆ Cooldown — minimum pause between consecutive signals (default 8 bars), prevents signal clustering during chop.
━━━━━━━━━━━━━━━━━━━━━━━━
📊 RETEST STRENGTH SCORE (0–100)
Each retest is assigned a composite quality score based on four components:
◆ Proximity (up to 50 pts) — how deep price penetrated into the cloud
◆ Volume (up to 25 pts) — current volume relative to its 20-bar average
◆ RSI (up to 15 pts) — how well momentum aligns with the signal direction
◆ ADX (up to 10 pts) — overall trend strength at the time of signal
Higher score = higher quality setup. The score is displayed in the signal tooltip and on the dashboard.
━━━━━━━━━━━━━━━━━━━━━━━━
🎨 VISUALS
◆ Gradient cloud fill with automatic theme detection (Dark / Light / Auto)
◆ Diamond ◆ markers at retest points with detailed tooltips (score, RSI, ADX)
◆ Dotted S/R lines from the latest retests — automatically removed when price breaks through
◆ Optional background tint based on trend direction
◆ Compact dashboard: trend, last signal, score, trend strength, timeframe, version
━━━━━━━━━━━━━━━━━━━━━━━━
🔔 ALERTS & WEBHOOKS
4 alert types: Bull Retest, Bear Retest, Trend Up, Trend Down.
Two output formats:
◆ Text — human-readable messages for Telegram, email, or mobile notifications
◆ JSON — structured webhook payloads for 3Commas, Alertatron, or custom bots
━━━━━━━━━━━━━━━━━━━━━━━━
📝 RECOMMENDED SETTINGS
◆ Ribbon Length: 14–30 (default 21) — higher values produce smoother clouds with fewer whipsaws
◆ Cloud Width: 1.0–2.5 × ATR (default 1.5) — wider clouds filter more noise, tighter clouds catch more retests
◆ Works best on timeframes 15m and above
◆ Enable Volume + RSI filters for balanced signal quality; add ADX and/or HTF filter for a more conservative approach
━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ DISCLAIMER
This indicator is a technical analysis tool and does not constitute financial advice. All trading decisions are made at your own risk. Always use proper risk management and backtest settings on historical data before live trading.
Release Notes
📋What's new in v1.1.0This update is about honesty and consistency. The indicator is called "Trend Cloud," yet in the previous version the trend direction was computed from a separate EMA crossover that could contradict the cloud itself — the midline falling while the cloud was already green. Trend is now derived directly from the slope of the cloud's own midline, so what you see and what the indicator computes finally match.
✅ Fixes and improvements
➖Trend is now honestly derived from the cloud. Direction and color follow the slope of the (Hull) midline instead of a side EMA crossover. The hidden mismatch between the cloud's shape and its color is gone.
➖The HTF filter actually works now. Previously, leaving "Higher Timeframe" empty silently fell back to the chart timeframe, so the filter did nothing. An empty value now auto-resolves to a real higher timeframe (1m→5m, 5m→15m, 15m→1H, 1H→4H, 4H→D, above→W). Still non-repainting.
➖Correct retest scoring. The RSI contribution to the composite score can no longer go negative and understate the result. The penetration-depth metric was renamed for clarity.
➖New settings. Added separate ADX and RSI length inputs (previously hardcoded to 14).
➖Cleaner code and memory. Broken S/R levels are now capped (no unbounded line accumulation), dead code removed, and higher-timeframe requests optimized (one call instead of two).
⚠️Important
Because the trend logic is now stricter, signal frequency in ranging conditions will likely change — retests fire more precisely where the cloud and price agree. I recommend reviewing your presets and backtesting the indicator on your own instruments before relying on it.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
10 years in trading. For all inquiries, contact me on my Telegram channel: t.me/WillyAlgoTrader or Instagram: @willytraderbtc
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
10 years in trading. For all inquiries, contact me on my Telegram channel: t.me/WillyAlgoTrader or Instagram: @willytraderbtc
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.