INVITE-ONLY SCRIPT

Volatility Bands Deviation [MarktQuant]

115
The "Volatility Bands Deviation" indicator combines a multi-asset crypto volatility projection calculation with performance and risk metrics analysis to assist traders in evaluating market conditions and strategy effectiveness.


Input Breakdown

1️⃣Range Length
The parameter determines the number of periods used to calculate the volatility projection bands via the VSB (Volatility Shift Bands) library. It essentially sets the window size for the statistical analysis of past price data.

❗Functionality
A smaller length (e.g., 20-30) makes the bands more sensitive to recent price movements, resulting in quicker reactions to market changes but potentially more noise.
A larger length (e.g., 50-100) smooths out short-term fluctuations, focusing on longer-term trends and reducing false signals.


2️⃣Band Multiplier
The parameter scales the volatility bands, effectively controlling their width around the mean or central tendency.

❗Functionality
A smaller multiplier (e.g., 0.1 - 0.3) results in narrower bands, making the indicator more sensitive and likely to trigger signals more frequently.
A larger multiplier (e.g., 0.5 - 1.0) widens the bands, reducing false signals and emphasizing significant deviations.


3️⃣Smoothing Length
The parameter specifies the smoothing length used within the Volatility Shift Bands (VSB) projection calculation. It essentially determines the period over which the indicator smooths the volatility signals to produce more stable upper and lower bands.

❗Functionality
It applies a smoothing technique—most likely an Exponential Moving Average (EMA)—to the raw volatility data or the projection output to reduce noise and short-term fluctuations.
A smaller value (e.g., 10-20) makes the bands more reactive to recent changes but can introduce more noise.
A larger value (e.g., 50-100) results in smoother bands that respond more gradually, filtering out short-term volatility spikes.


Multi-Crypto Score Calculation:
Computes a deviation score for 40 different cryptocurrencies based on their price relation to dynamically calculated volatility bands using the VSB projection function. Each asset's score indicates whether the current price is above the upper band (+1), below the lower band (-1), or within the bands (0).

Aggregate Market Sentiment:
Summing individual asset scores provides a net score representing overall market deviation and volatility signals. A crossover of this net score with predefined thresholds triggers buy or sell signals.

Bullish & Bearish Signals:
Bull: When the net score crosses above the buy threshold, indicating bullish deviation.
Bear: When the net score crosses below the sell threshold, indicating bearish deviation.

Visualizations:
  • Colored candle bars indicating long (green), short (red), or neutral (gray) positions.
  • Background shading highlights active long/short signals.
  • Overlays plots for equity growth, net scores, and threshold levels for clear visual analysis.


Performance & Risk Metrics
  • Sharpe Ratio, Sortino Ratio, Omega Ratio
  • Max Drawdowns (Equity & Trade-based)
  • CAGR, Calmar Ratio
  • Gain/Pain Ratio, Payoff Ratio, Common Sense Ratio, CPC Index, Alpha
  • Skewness, Kurtosis, R-squared, Volatility, Recovery Factor


Customization Options:
  • Threshold levels for bullish/bearish signals.
  • Enable/disable short positions.
  • Plot modes: Strategy Equity or Volatility Metric.
  • Backtest date range.



Usage Notes:
The indicator analyzes multiple cryptocurrencies to generate a composite market deviation score, aiding in identifying market extremes and potential entries/exits.
It is optimized for backtesting strategies over historical data, with detailed risk and performance metrics for comprehensive evaluation.
Adjust thresholds and parameters to suit your style and market conditions.

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.