TTMSqueeze
Flags when volatility is squeezed tight, with a momentum line that shows which way price leans.
TTM Squeeze marks volatility compression. A squeeze is on when both Bollinger Bands (a moving average of close plus or minus a multiple of its standard deviation) sit inside the Keltner Channels (an EMA of close plus or minus a multiple of the average true range). The momentum line is a linear-regression endpoint over the last momentum_window bars of close minus the average of the recent range midpoint and the mean close, so its sign shows which side of that level price is leaning to. Momentum is in price units (dollars on SPY), not scaled.
How to read it
- The squeeze markers sit on candles where both Bollinger Bands are inside the Keltner Channels; a run of markers is one squeeze.
- The momentum line sits in its own pane, centred on zero: above zero price leans up, below zero it leans down.
- Momentum values are in dollars for SPY, so read the sign and the turns, not the size.
What it outputs
- Squeeze on
- True on each candle where the Bollinger Bands sit fully inside the Keltner Channels, so recent volatility is compressed. On the SPY sample about 6% of bars.
- Momentum
- A linear-regression fit of recent close minus the midpoint of the range and the mean close. Positive means price leans up, negative means down. Units are price.
- Squeeze release
- Meant to mark the first candle the squeeze turns off. On the SPY sample with defaults it never fired, and a code bug means no setting makes it fire.
When it fires
The squeeze flag is on for every candle while the bands sit inside the channels. A squeeze starts at the first candle of each run, about 11 starts per day in the SPY sample. It means volatility is compressed; it does not say which way price will break.
Settings
- bb_window
- Bars the Bollinger mid and spread average over. Longer makes the bands steadier, so squeezes get rarer and last longer; shorter flips squeezes on and off more often.
- bb_mult
- Width of the Bollinger Bands in standard deviations. Raising it widens them, so they sit inside the channels less often and squeezes get rarer; lowering it narrows them and squeezes start more easily.
- kc_ema
- Bars in the EMA that centres the Keltner Channels. Longer keeps the channel midline slow; shorter lets it track price closely.
- kc_atr
- Bars in the average true range that sets the channel width. Shorter makes the channels jump with recent volatility; longer keeps them steady.
- kc_mult
- Channel width in average-true-range units. Raising it widens the channels, so the bands fit inside more often and squeezes get more frequent; lowering it narrows them and squeezes get rarer.
- momentum_window
- Bars behind the momentum line and the range midpoint and mean. Shorter makes the line quick and jumpy; longer smooths it and lags turns. It also sets how many bars pass before the first squeeze appears.
Pitfalls
- The release output never fired on SPY with default settings, and no setting makes it fire. The code checks the previous squeeze with 'is True', which fails for the numpy booleans it produces. Treat it as broken.
- Squeeze means compressed volatility, not a direction or a timing signal. Momentum is the only hint at which way it may break, and it is jumpy on one-minute bars.
- Momentum is in price units, so its size changes with the symbol's price and volatility; do not compare its values across symbols.