OPEN-SOURCE SCRIPT
Atualizado

Elastic Volume-Weighted Student-T Tension

3 241
Overview
The Elastic Volume-Weighted Student-T Tension Bands indicator dynamically adapts to market conditions using an advanced statistical model based on the Student-T distribution. Unlike traditional Bollinger Bands or Keltner Channels, this indicator leverages elastic volume-weighted averaging to compute real-time dispersion and location parameters, making it highly responsive to volatility changes while maintaining robustness against price fluctuations.

This methodology is inspired by incremental calculation techniques for weighted mean and variance, as outlined in the paper by Tony Finch:
📄 "Incremental Calculation of Weighted Mean and Variance".

Key Features
✅ Adaptive Volatility Estimation – Uses an exponentially weighted Student-T model to dynamically adjust band width.
✅ Volume-Weighted Mean & Dispersion – Incorporates real-time volume weighting, ensuring a more accurate representation of market sentiment.
✅ High-Timeframe Volume Normalization – Provides an option to smooth volume impact by referencing a higher timeframe’s cumulative volume, reducing noise from high-variability bars.
✅ Customizable Tension Parameters – Configurable standard deviation multipliers (σ) allow for fine-tuned volatility sensitivity.
✅ %B-Like Oscillator for Relative Price Positioning – The main indicator is in form of a dedicated oscillator pane that normalizes price position within the sigma ranges, helping identify overbought/oversold conditions and potential momentum shifts.
✅ Robust Statistical Foundation – Utilizes kurtosis-based degree-of-freedom estimation, enhancing responsiveness across different market conditions.

How It Works
  1. Volume-Weighted Elastic Mean (eμ) – Computes a dynamic mean price using an elastic weighted moving average approach, influenced by trade volume, if not volume detected in series, study takes true range as replacement.
  2. Dispersion (eσ) via Student-T Distribution – Instead of assuming a fixed normal distribution, the bands adapt to heavy-tailed distributions using kurtosis-driven degrees of freedom.
  3. Incremental Calculation of Variance – The indicator applies Tony Finch’s incremental method for computing weighted variance instead of arithmetic sum's of fixed bar window or arrays, improving efficiency and numerical stability.
  4. Tension Calculation – There are 2 dispersion custom "zones" that are computed based on the weighted mean and dynamically adjusted standard student-t deviation.
  5. %B-Like Oscillator Calculation – The oscillator normalizes the price within the band structure, with values between 0 and 1:
    * 0.00 → Price is at the lower band (-2σ).
    * 0.50 → Price is at the volume-weighted mean (eμ).
    * 1.00 → Price is at the upper band (+2σ).
    * Readings above 1.00 or below 0.00 suggest extreme movements or possible breakouts.


Recommended Usage
  • For scalping in lower timeframes, it is recommended to use the fixed α Decay Factor, it is in raw format for better control, but you can easily make a like of transformation to N-bar size window like in EMA-1 bar dividing 2 / decayFactor or like an RMA dividing 1 / decayFactor.
  • The HTF selector catch quite well Higher Time Frame analysis, for example using a Daily chart and using as HTF the 200-day timeframe, weekly or monthly.
  • Suitable for trend confirmation, breakout detection, and mean reversion plays.
  • The %B-like oscillator helps gauge momentum strength and detect divergences in price action if user prefer a clean chart without bands, this thanks to pineScript v6 force overlay feature.
  • Ideal for markets with volume-driven momentum shifts (e.g., futures, forex, crypto).


Customization Parameters
  • Fixed α Decay Factor – Controls the rate of volume weighting influence for an approximation EWMA approach instead of using sum of series or arrays, making the code lightweight & computing fast O(1).
  • HTF Volume Smoothing – Instead of a fixed denominator for computing α , a volume sum of the last 2 higher timeframe closed candles are used as denominator for our α weight factor. This is useful to review mayor trends like in daily, weekly, monthly.
  • Tension Multipliers (±σ) – Adjusts sensitivity to dispersion sigma parameter (volatility).
  • Oscillator Zone Fills – Visual cues for price positioning within the cloud range.


Posible Interpretations
As market within indicators relay on each individual edge, this are just some key ideas to glimpse how the indicator could be interpreted by the user:
📌 Price inside bands – Market is considered somehow "stable"; price is like resting from tension or "charging batteries" for volume spike moves.
📌 Price breaking outer bands – Potential breakout or extreme movement; watch for reversals or continuation from strong moves. Market is already in tension or generating it.
📌 Narrowing Bands – Decreasing volatility; expect contraction before expansion.
📌 Widening Bands – Increased volatility; prepare for high probability pull-back moves, specially to the center location of the bands (the mean) or the other side of them.
📌 Oscillator is just the interpretation of the price normalized across the Student-T distribution fitting "curve" using the location parameter, our Elastic Volume weighted mean (eμ) fixed at 0.5 value.

Final Thoughts
The Elastic Volume-Weighted Student-T Tension indicator provides a powerful, volume-sensitive alternative to traditional volatility bands. By integrating real-time volume analysis with an adaptive statistical model, incremental variance computation, in a relative price oscillator that can be overlayed in the chart as bands, it offers traders an edge in identifying momentum shifts, trend strength, and breakout potential. Think of the distribution as a relative "tension" rubber band in which price never leave so far alone.

DISCLAIMER:

The Following indicator/code IS NOT intended to be a formal investment advice or recommendation by the author, nor should be construed as such. Users will be fully responsible by their use regarding their own trading vehicles/assets.

The following indicator was made for NON LUCRATIVE ACTIVITIES and must remain as is, following TradingView's regulations. Use of indicator and their code are published for work and knowledge sharing. All access granted over it, their use, copy or re-use should mention authorship(s) and origin(s).


WARNING NOTICE!

THE INCLUDED FUNCTION MUST BE CONSIDERED FOR TESTING. The models included in the indicator have been taken from open sources on the web and some of them has been modified by the author, problems could occur at diverse data sceneries, compiler version, or any other externality.
Notas de Lançamento

  1. Added High's & Lows for the Oscillator to read complete distribution of price delivery and change it from style_line to histogram & bars.
  2. Rescale oscillator to have better reading of a true z-score, making 0.0 the "location parameter" that is the Elastic volume-weighted mean, and dispersion reads became both positive / negative [1, -1]
  3. Change default for the Fixed decay factor to 0.095 as it mimics better a more standarized used 20 like "EMA" weighting factor.
Notas de Lançamento

  • Minor plot fixes to oscillator.
  • Added oscillator settings to customize upper and bottom Z-Score "zones".
Notas de Lançamento

  • Added 2 additional sigma dispersion readings to make the indicator more discrete from the location parameter (weighted mean). The upper sigma now tracks the highs of the series, and the lower sigma the lows. This makes our distribution tracking more asymmetrical as it should be in price series.
Notas de Lançamento
Internal update to the
Pine Script®
ewStudentTParamers()
function:
  • Added a
    Pine Script®
    degreesOfFreedom
    float input parameter, could be a fixed number or a series containing dynamic ones; this will help the user to reutilize the function in other indicators if not want to use the internal dynamic algorithm based on kurtosis. If no input defined (NA), the function will use the internal kurtosis calculation by default.
Notas de Lançamento
Minor aesthetics defaults to the oscillator plots to be more readable.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.