[blackcat] L2 Volatility Shield

1 249
█ OVERVIEW

L2 Volatility Shield is a dynamic trend-following indicator combining Parabolic SAR, ATR, and ALMA smoothing to generate adaptive volatility-based stop levels with complete trading signals. V2 adds bidirectional entries, ATR-based TP/SL, state machine governance, and real-time dashboard.

█ CONCEPTS

This indicator builds an adaptive volatility envelope:

 • Volatility Stop: derives dynamic levels from PSAR and True Range, scaled by multiplier
 • ALMA Smoothing: reduces noise while preserving responsiveness
 • RSI Gradient: maps momentum to a 110-color spectrum
 • Crossover Signals: entries trigger when volatile stop crosses smoothed counterpart

Volatility-expanded PSAR levels, when smoothed, act as a trailing filter adapting faster than traditional MA crossovers.

█ HOW TO USE

1 — Add indicator (displays in separate pane below price)
2 — Observe colored Volatility Stop and gray Smoothed VS (stepline)
3 — Bullish: VS crosses above Smoothed; Bearish: crosses below
4 — Use labels (E/S/XL/XS) and background color for position state
5 — Monitor dashboard for ATR, entry price, TP/SL

Input Parameters

Volatility: Period (14), Multiplier (2.0) — controls stop band calculation
ALMA: Length (21), Offset (0.85), Sigma (6), Smooth Period (89) — smoothing settings
PSAR: Start/Step/Max (0.02/0.02/0.2) — Parabolic SAR parameters
RSI: Length (21) — gradient color mapping
Signals: Enable (on), Cooldown (3), Exclusivity (on) — signal governance
Risk: Show TP/SL (on), ATR Len (14), SL (2.0 xATR), TP (3.0 xATR)
Visual: Background Color, Dashboard, Labels (all on by default)

█ FEATURES

 • Adaptive volatility trailing stops (expand in high vol, contract in calm)
 • Bidirectional signal system with state machine governance
 • ATR-based TP/SL adjusting to market conditions
 • 110-color RSI gradient for instant momentum read
 • Real-time dashboard: position, trend, ATR, entry, SL/TP
 • Four alertconditions for entry/exit signals
 • Background color shading for position feedback
 • All toggleable — disable signals to revert to V1

█ SIGNALS

Visual Elements
 • Colored Volatility Stop: gradient above line; gray below
 • Gray Smoothed VS (stepline): signal threshold
 • E (green up): Long entry | S (red down): Short entry
 • XL/XS (orange X): Long/Short exit (crossover or SL)
 • Green/red bg: LONG/SHORT state | Dashboard: all key values

Alerts: Long/Short Entry (crossover), Long/Short Exit (crossover or SL)

█ IMPLEMENTATION NOTES

Open-source Pine Script v6 using ta.alma(), ta.sar(), ta.rsi(), ta.atr(), array.* for gradient palette. Signal generation uses edge detection with nz() protection + state machine (var int posState). Alerts use alert.freq_once_per_bar_close.

█ LIMITATIONS

 • Best for trending markets; may whipsaw in ranges
 • Recommended: 15m to daily timeframes
 • Not standalone — combine with other analysis
 • Validate on your own charts before live trading
 • Plot lines update intrabar (normal Pine behavior)

█ NOTES

 • V2: added signals, risk management, visualization, alerts; V1 logic preserved
 • Disable "Enable Trading Signals" for V1 pure-indicator mode
 • Inspired by Wilder's PSAR and ATR channel methodologies
 • Mozilla Public License 2.0

════════════════════════════════════════════════════════════════════════
For questions or feedback, please use the comments section below.
Feel free to use and modify — attribution appreciated.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.