# Bollinger Squeeze 2

This study calculates and displays a Bollinger Squeeze for the data specified by the Input Data Input. The calculations of this study include calculations of Momentum, an Exponential Moving Average of the Momentum, Bollinger Bands and Keltner Bands. See those studies for an explanation of the notation used here.

The Inputs are denoted as follows. $$X$$ is the Input Data, $$n_B$$ is the Bollinger Bands Length, $$v_B$$ is the Bollinger Bands Multiplier, $$n_K$$ is the Keltner Bands Length, $$n_{ATR}$$ is the Keltner True Range MovAvg Length, and $$v_K$$ is the Keltner Bands Multiplier. Note that both the Top and Bottom Keltner Bands have the same Multiplier Input, unlike in the Keltner Channel study. The moving average types for the Bollinger Bands, the Average True Range, and the Keltner Bands are all controlled via the Moving Average Type for Internal Calculation Input.

The Momentum $$M_t(X,n_M)$$ is calculated by subtraction exclusively (not division). That is, $$M_t(X,n_M) = X_t - X_{t - n_M}$$. Here, $$n_M$$ denotes the Momentum Length Input.

This study displays two Subgraphs for $$t \geq \max\{n_B,n_K,n_{ATR},n_M\} - 1$$: the Exponential Moving Average of the Momentum and the Squeeze Indicator.

The Exponential Moving Average of the Momentum is simply $$EMA_t\left(M(X,n_M),n_M\right)$$, and it is displayed as a bar graph. It is colored as follows.

• $$EMA_t\left(M(X,n_M),n_M\right) > 0$$ and $$EMA_t\left(M(X,n_M),n_M\right) \geq EMA_{t - 1}\left(M(X,n_M),n_M\right) \Rightarrow$$ Bright Green
• $$EMA_t\left(M(X,n_M),n_M\right) > 0$$ and $$EMA_t\left(M(X,n_M),n_M\right) < EMA_{t - 1}\left(M(X,n_M),n_M\right) \Rightarrow$$ Dark Green
• $$EMA_t\left(M(X,n_M),n_M\right) < 0$$ and $$EMA_t\left(M(X,n_M),n_M\right) \leq EMA_{t - 1}\left(M(X,n_M),n_M\right) \Rightarrow$$ Bright Red
• $$EMA_t\left(M(X,n_M),n_M\right) < 0$$ and $$EMA_t\left(M(X,n_M),n_M\right) > EMA_{t - 1}\left(M(X,n_M),n_M\right) \Rightarrow$$ Dark Red

The Squeeze Indicator is denoted as $$SI_t(X,n_B,v_B,n_K,n_{ATR},v_K)$$, and it is computed as follows.

$$\displaystyle{SI_t(X,n_B,v_B,n_K,n_{ATR},v_K) = \left\{ \begin{matrix} 10^{-4} & TB_t^{(B)}(X,n_B,v_B) > TB_t^{(K)}(X,n_K,n_{ATR},v_K) \space and \space BB_t^{(B)}(X,n_B,v_B) < BB_t^{(K)}(X,n_K,n_{ATR},v_K) \\ -10^{-4} & TB_t^{(B)}(X,n_B,v_B) \leq TB_t^{(K)}(X,n_K,n_{ATR},v_K) \space or \space BB_t^{(B)}(X,n_B,v_B) \geq BB_t^{(K)}(X,n_K,n_{ATR},v_K) \end{matrix}\right .}$$

The Squeeze Indicator is displayed as a sequence of points that are colored as follows.

• $$SI_t(X,n_B,v_B,n_K,n_{ATR},v_K) = 10^{-4} \Rightarrow$$ Green
• $$SI_t(X,n_B,v_B,n_K,n_{ATR},v_K) = -10^{-4} \Rightarrow$$ Red