Indicator · Pine Script v5 · Own pane

TTM Squeeze

by mihakralj

This indicator detects volatility compression by comparing Bollinger Bands with Keltner Channels.

View on GitHub

GitHub stars99on the repository
Pine versionv5runs as is
Lines of code9
Settings3inputs
LicenceApache-2.0
Last update4 weeks ago27 Sep 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

9 lines of Pine Script v5 from lib/dynamics/ttm_squeeze/ttm_squeeze.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

ttm_squeeze.pine
//@version=5
indicator("TTM Squeeze", "TTM_SQUEEZE")
period = input.int(20, minval=2)
bbMult = input.float(2.0)
kcMult = input.float(1.5)
middle = ta.sma(close, period)
bbWidth = bbMult * ta.stdev(close, period)
kcWidth = kcMult * ta.atr(period)
plot(bbWidth < kcWidth ? 1 : 0, "Squeeze", style=plot.style_columns, color=bbWidth < kcWidth ? color.red : color.gray)

Overview

TTM Squeeze calculates standard deviation and Average True Range over a user-defined period, plotting a binary column in a separate pane. When the Bollinger Band width falls below the Keltner Channel width, the indicator signals an active squeeze with a red column at level one; otherwise, it displays a gray column at level zero. Users can customize the calculation period and the multipliers for both bands.

Details

Published by

mihakralj on GitHub

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Volatility & bands, Breakout

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

algorithmic-tradingcsharpdotnetpinescriptpythonquantitative-financesimdta-libtechnical-analysistechnical-indicators

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
periodint20period
bbMultfloat2.0bbMult
kcMultfloat1.5kcMult
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

Chop and Explode

by capissimo
114 stars

This indicator measures market consolidation and breakout phases by computing a scaled Relative Strength Index (RSI) on normalized price data. It identifies chop zones when the RSI oscillates between 40 and 60, highlighting tight consolidation between 45 and 5

Indicator v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of Chop and Explode

ATR Breakout

by TamaraKGreen
46 stars

This indicator plots the 100-bar percent rank of ATR in a separate pane and draws a midline at 50. It colors that midline green, red, or gray by comparing the close with the open a set number of bars earlier against a multiple of ATR across a lookback window.

Indicator v5 Volatility & bandsBreakout
Updated 7 weeks ago · None stated GitHub repository of ATR Breakout

Renko Acceleration

by f-cksociety
11 stars

Calculates the time elapsed between consecutive bars to measure market speed and volatility, designed primarily for Renko chart blocks where bar duration varies. In Momentum mode, it contrasts the current duration against a 100-period moving average baseline,

Indicator v4 Volatility & bandsOscillators & momentum
Updated 4 years ago · MPL-2.0 GitHub repository of Renko Acceleration

CRT + Turtle Soup Scanner

by alboogycOdR
6 stars

Calculates CRT session range boundaries and detects Turtle Soup setups to identify potential breakout signals. The script tracks session high, low, and midpoint values to determine intraday bias while measuring price break distances against ATR thresholds. It

Indicator v5 SMC / ICT / price actionSessions & time
Updated 7 months ago · None stated GitHub repository of CRT + Turtle Soup Scanner

EMA Breakout

by jerryinyang
5 stars

This indicator calculates and plots the exponential moving average on the chart, along with Keltner Channel bands. It applies optional filters based on Keltner Channel and Money Flow to identify breakout signals. Breakouts occur when price crosses the EMA with

Indicator v4 TrendMoving averages
Updated 2 years ago · None stated GitHub repository of EMA Breakout

The Market Tail Risk Detector evaluates market fragility and compression to identify environments preceding volatile price moves. It calculates a composite tail risk score ranging from 0 to 100 based on realized volatility percentiles, volatility of volatility

Indicator v6 Volatility & bandsBreakout Repaints
Updated 3 months ago · Apache-2.0 GitHub repository of Market Tail Risk Detector (Quiet → Explosive)

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers