Volatility Squeeze: whether the Bollinger Bands have contracted inside the
Keltner Channel, the quiet stretch that tends to come before a move, and a
momentum histogram that says which way the move is leaning.
Both envelopes share one basis and one length, so the squeeze is either on
or off; state carries it (1 on, 0 off) for the dots on the zero line. The
state needs one window and prints from length - 1; the momentum fits a line
to length values that each read a window, so it prints from
2 * length - 2. The histogram is coloured by sign and by direction against
the previous bar, a missing previous bar reading as zero.
Volatility Squeeze: whether the Bollinger Bands have contracted inside the Keltner Channel, the quiet stretch that tends to come before a move, and a momentum histogram that says which way the move is leaning.
basis = sma(close, length) bands = basis +/- bbMult * stdev(close, length) channel = basis +/- kcMult * sma(true range, length) on = lower band > lower channel and upper band < upper channel momentum = linreg(close - ((highest(high, length) + lowest(low, length)) / 2 + basis) / 2, length)
Both envelopes share one basis and one length, so the squeeze is either on or off;
statecarries it (1 on, 0 off) for the dots on the zero line. The state needs one window and prints fromlength - 1; the momentum fits a line tolengthvalues that each read a window, so it prints from2 * length - 2. The histogram is coloured by sign and by direction against the previous bar, a missing previous bar reading as zero.