OPEN-SOURCE SCRIPT
BB Volatility Squeeze Momentum

BB Volatility Squeeze / Expansion
This indicator highlights periods when Bollinger Bands are tight relative to price (a volatility squeeze) versus wider expansion phases. Squeeze conditions can be based on Keltner Channels, a percentile of BB width, or both.
What it shows on the chart
Dot vertical position is controlled as a percentage of the bar range below the low.
Squeeze logic (summary)
Keltner-based: Squeeze when the Bollinger envelope sits inside the Keltner envelope (BB lower above KC lower and BB upper below KC upper).
Percentile-based: Computes BB width as (upper - lower) / basis. Squeeze when the percent rank of that width over the lookback is below your threshold (e.g. unusually narrow vs. recent history).
Squeeze method input chooses Keltner only, percentile only, or either (fires if either condition is true). The active squeeze used for band coloring follows that choice; the dots always show both methods for comparison.
Multi-timeframe (MTF) table
A table in the top-right shows four user-selected timeframes. For each TF it reports whether Keltner and percentile squeezes are on (SQZ) or off (—), with red/green cell backgrounds. Calculations use request.security() with no lookahead.
Inputs (by group)
License
This source code is subject to the terms of the Mozilla Public License 2.0.
This indicator highlights periods when Bollinger Bands are tight relative to price (a volatility squeeze) versus wider expansion phases. Squeeze conditions can be based on Keltner Channels, a percentile of BB width, or both.
What it shows on the chart
- Bollinger Bands (upper, lower, SMA basis) drawn on price. Band and fill colors switch with squeeze state: cool tones (blue) when a squeeze is active, warm tones (orange) when it is not.
- Small dots under each bar summarize how each underlying squeeze method reads that bar:
- Green: neither Keltner nor percentile squeeze
- Red: Keltner squeeze only
- Orange: percentile squeeze only
- Yellow: both methods agree (squeeze on both)
Dot vertical position is controlled as a percentage of the bar range below the low.
Squeeze logic (summary)
Keltner-based: Squeeze when the Bollinger envelope sits inside the Keltner envelope (BB lower above KC lower and BB upper below KC upper).
Percentile-based: Computes BB width as (upper - lower) / basis. Squeeze when the percent rank of that width over the lookback is below your threshold (e.g. unusually narrow vs. recent history).
Squeeze method input chooses Keltner only, percentile only, or either (fires if either condition is true). The active squeeze used for band coloring follows that choice; the dots always show both methods for comparison.
Multi-timeframe (MTF) table
A table in the top-right shows four user-selected timeframes. For each TF it reports whether Keltner and percentile squeezes are on (SQZ) or off (—), with red/green cell backgrounds. Calculations use request.security() with no lookahead.
Inputs (by group)
- Bollinger Bands: length, standard-deviation multiplier.
- Keltner Channels: length, ATR multiplier.
- Percentile method: lookback bars for the percent rank, squeeze threshold (percentile).
- Squeeze method: Keltner / percentile / both.
- MTF table: four timeframe strings (defaults: 15m, 1h, 4h, daily).
- Visuals: squeeze dot offset below the bar (% of range).
License
This source code is subject to the terms of the Mozilla Public License 2.0.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน