## Pine Script

High/Low Volume Indicator

# High/Low Volume Indicator

I published a new indicator on TradingView:

In this indicator, I show you a better way to define high/low values of volume (or any other indicator).

Quite often, I get requests from my clients that an indicator level should be “high” or that it should be above a certain absolute level.

The first request is hard to interpret mathematically, but traders can easily spot it on the chart. The second one is not flexible, and it might not make sense in another market regime.

To solve that, you can compute dynamic high/low levels that represent unexpected extreme values that are adaptable to recent conditions.

There are two pretty simple methods I’m using quite often in my scripts percentiles and sigma (standard deviations).

Percentile looks back at X bars and computes the value under which a certain % of data points are located. So, for example, if we’re computing 90%tile and we’re looking at 100 bars, we’ll get a value under which we have values of precisely 90 bars for this indicator. It’s a good idea to use something like 5%tile for low level and 95%tile for high level.

Sigma(σ) is related to standard deviation. If we assume that our data is normally distributed, then 68% of data points should be in the range of mean +-1σ, 95% → mean +-2σ. So we can assume that something above 2σ is a pretty rare and extreme event.

In this script, I give you an example of how to compute both on volume, but you can easily change this to another indicator.

The issue with volume is that it’s not normally distributed, and your low level will be quite often too low to detect any low levels. Ideally, we have to use a more sophisticated formula that fits volume distribution better.

In this indicator, you can set the following parameters:

• Choose type: Percentile or Sigma
• Lookback Period
• High/Low Percentiles
• Sigmas #