TradingView
fheinrichs
Feb 8, 2017 10:23 AM

FHX Bands (VWMA BB) 

USOIL+0.02TVC

Description

This study is an optimized version of Bollinger Bands based on volume weighted data points: more volume on a bar gives those prices a higher impact. FHX bands base on the assumptions of auction market theory (e.g., as does volume profiling). Bollinger Bands implicitly assume a uniform probability mass function for data points and consider only the - somewhat arbitrary - close price. In contrast to this, FHX bands take all four available data points into account (OHLC) and use the volume at each candle* to define a probability mass function in order to compute mean and standard deviation.

As an indicator, FHX bands could be used in the same way as BB to facilitate or confirm Break-Out trades and identify strong momentum moves. Settings for the standard deviation multiplier should be interpreted as follows (following the 68–95–99.7 rule):
  • x standard deviation set to 1: ~32% chance that a move outside the bands is by chance
  • x standard deviation set to 2: ~5% chance that a move outside the bands is by chance
  • x standard deviation set to 3: ~0.3% chance that a move outside the bands is by chance


This however assumes a fairly solid period of consolidation beforehand (visible through notable contraction of the bands) and a normal distribution of values within that consolidation period. Therefore users need to experiment within their time frame in order to identify a Length setting that suits their needs. Personally, I set Length to 21 or lower, depending on my targeted time frame. Note that the indicator does not test for normality in any way; you can, however, use a quick visual test using the fixed range volume profile indicator to increase its reliability.

Good luck and mind your risk
-fhx

* of course tick data would be the real deal, but we work with what we have
Comments
fheinrichs
I accidentally chose the script to be protected and the "Edit" button leaves me with an unchangeable script publishing dialog. But for those of you who are interested in the indicator, here is the source:

study(shorttitle="VWMA BB", title="VWMA BB (FHX)", overlay=true)
length = input(21, minval=1, title="Length")
mult = input(2.0, minval=0.001, maxval=5, title="Multiplier (x SD)")
adjust = input(defval=0, type=integer, minval=-5, maxval=5, title="Adjustment (Offset)")

// probability mass function
p_i = volume / (4 * sum(volume, length))

// note that we have 4 sample points for each bar
// and we assume that volume is evenly distributed among them ... which is incorrect,
// but an approximation (of course, tick data would be what we are after)

// compute median (mu)
mu = vwma((open + high + low + close) / 4, length)

// compute and add variances in order to compute combined standard deviation
var_open = sum(p_i * pow(open - mu, 2), length)
var_high = sum(p_i * pow(high - mu, 2), length)
var_low = sum(p_i * pow(low - mu, 2), length)
var_close = sum(p_i * pow(close - mu, 2), length)
sigma = sqrt(var_open + var_high + var_low + var_close)

dev = mult * sigma
upper = mu + dev
lower = mu - dev

p1 = plot(upper, color=blue, offset=adjust, title="Upper")
p2 = plot(lower, color=blue, offset=adjust, title="Lower")
fill(p1, p2, title="Background")
plot(mu, color=red, title="Mu")
adsonav
very good thanks
More