OPEN-SOURCE SCRIPT

Uptrick: Volatility Weighted Cloud

1 543
Introduction
The Volatility Weighted Cloud (VWC) is a trend-tracking overlay that combines adaptive volatility-based bands with a multi-source smoothed price cloud to visualize market bias. It provides users with a dynamic structure that adapts to volatility conditions while maintaining a persistent visual record of trend direction. By incorporating configurable smoothing techniques, percentile-ranked volatility, and multi-line cloud construction, the indicator allows traders to interpret price context more effectively without relying on raw price movement alone.

Overview
The script builds a smoothed price basis using the open, and close prices independently, and uses these to construct a layered visual cloud. This cloud serves both as a reference for price structure and a potential area of dynamic support and resistance. Alongside this cloud, adaptive upper and lower bands are plotted using volatility that scales with percentile rank. When price closes above or below these bands, the script interprets that as a breakout and updates the trend bias accordingly.

Candle coloring is persistent and reflects the most recent confirmed signal. Labels can optionally be placed on the chart when the trend bias flips, giving traders additional visual reference points. The indicator is designed to be both flexible and visually compact, supporting different strategies and timeframes through its detailed configuration options.

Originality
This script introduces originality through its combined use of percentile-ranked volatility, adaptive envelope sizing, and multi-source cloud construction. Unlike static-band indicators, the Volatility Weighted Cloud adjusts its band width based on where current volatility ranks within a defined lookback range. This dynamic scaling allows for smoother signal behavior during low-volatility environments and more responsive behavior during high-volatility phases.
Additionally, instead of using a single basis line, the indicator computes two separate smoothed lines for open and close. These are rendered into a shaded visual cloud that reflects price structure more completely than traditional moving average overlays. The use of ALMA and MAD, both less commonly applied in volatility-band overlays, adds further control over smoothing behavior and volatility measurement, enhancing its adaptability across different market types.

Inputs
Group: Core
  • Basis Length (short-term): The number of bars used for calculating the primary basis line. Affects how quickly the basis responds to price changes.
  • Basis Type: Option to choose between EMA and ALMA. EMA provides a standard exponential average; ALMA offers a centered, Gaussian-weighted average with reduced lag.
  • ALMA Offset: Determines the balance point of the ALMA window. Only applies when ALMA is selected.
  • Sigma: Sets the width of the ALMA smoothing window, influencing how much smoothing is applied.
  • Basis Smoothing EMA: Adds additional EMA-based smoothing to the computed basis line for noise reduction.

Group: Volatility & Bands
  • Volatility: Choose between StDev (standard deviation) and MAD (median absolute deviation) for measuring price volatility.
  • Vol Length (short-term): Length of the window used for calculating volatility.
  • Vol Smoothing EMA: Smooths the raw volatility value to stabilize band behavior.
  • Min Multiplier: Minimum multiplier applied to volatility when forming the adaptive bands.
  • Max Multiplier: Maximum multiplier applied at high volatility percentile.
  • Volatility Rank Lookback: Number of bars used to calculate the percentile rank of current volatility.
  • Show Adaptive Bands: Enables or disables the display of upper and lower volatility bands on the chart.

Group: Trend Switch Labels
  • Show Trend Switch Labels: Toggles the appearance of labels when the trend direction changes.
  • Label Anchor: Defines whether the labels are anchored to recent highs/lows or to the main basis line.
  • ATR Length (offset): Length used for calculating ATR, which determines label offset distance.
  • ATR Offset (multiplier): Multiplies the ATR value to place labels away from price bars for better visibility.
  • Label Size: Allows selection of label size (tiny to huge) to suit different chart setups.


Features
  • Adaptive Volatility Bands: The indicator calculates volatility using either standard deviation or MAD. It then applies an EMA smoothing layer and scales the band width dynamically based on the percentile rank of volatility over a user-defined lookback window. This avoids fixed-width bands and allows the indicator to adapt to changing volatility regimes in real time.
    快照
  • Volatility Method Options: Users can switch between two volatility measurement methods:

  • ➤ Standard Deviation (StDev): Captures overall price dispersion, but may be sensitive to spikes.

  • ➤ Median Absolute Deviation (MAD): A more robust measure that reduces the effect of outliers, making the bands less jumpy during erratic price behavior.

  • Basis Type Options: The core price basis used for cloud and bands can be built from:

  • ➤ Exponential Moving Average (EMA): Fast-reacting and widely used in trend systems.

  • ➤ Arnaud Legoux Moving Average (ALMA): A smoother, more centered alternative that offers greater control through offset and sigma parameters.

  • Multi-Line Basis Cloud: The cloud is formed by plotting two individually smoothed basis lines from open and close prices. A filled area is created between the open and close basis lines. This cloud serves as a dynamic support or resistance zone, allowing users to identify possible reversal areas. Price moving through or rejecting from the cloud can be interpreted contextually, especially when combined with band-based signals.

  • Persistent Trend Bias Coloring: The indicator uses the last confirmed breakout (above upper band or below lower band) to determine bias. This bias is reflected in the color of every subsequent candle, offering a persistent visual cue until a new signal is triggered. It helps simplify trend recognition, especially in choppy or sideways markets.

  • Trend Switch Labels: When enabled, the script places labeled markers at the exact bar where the bias direction switches. Labels are anchored either to recent highs/lows or to the main basis line, and spaced vertically using an ATR-based offset. This allows the trader to quickly locate historical trend transitions.

  • Alert Conditions: Two built-in alert conditions are available:

  • ➤ Long Signal: Triggered when the close crosses above the upper adaptive band.

  • ➤ Short Signal: Triggered when the close crosses below the lower adaptive band.
    These conditions can be used for custom alerts, automation, or external signaling tools.

  • Display Control and Flexibility: Users can disable the adaptive bands for a cleaner layout while keeping the basis cloud and candle coloring active. The indicator can be tuned for fast or slow response depending on the strategy in use, and is suitable for intraday, swing, or position trading.

Summary
The Volatility Weighted Cloud is a configurable trend-following overlay that uses adaptive volatility bands and a structured cloud system to help visualize market bias. By combining EMA or ALMA smoothing with percentile-ranked volatility and a four-line price structure, it provides a flexible and informative charting layer. Its key strengths lie in the use of dynamic envelopes, visually persistent trend indication, and clearly defined breakout zones that adapt to current volatility conditions.

Disclaimer
This indicator is for informational and educational purposes only. Trading involves risk and may not be suitable for all investors. Past performance does not guarantee future results.

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。