Indicator · Pine Script v6 · Own pane

Buddha Squeeze

by DarthBuddha

A separate-pane momentum and volatility indicator in the style of the TTM Squeeze.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code113
Settings4inputs
LicenceMIT
Last update3 months ago15 Jul 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

113 lines of Pine Script v6 from src/BuddhaSqueeze.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

BuddhaSqueeze.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Darth_Buddha

// @version=6
indicator(
      title='Buddha Squeeze',
      shorttitle='Squeeze',
      overlay=false)

//----------------------------------------------------------------------------------------------------< CONSTANTS >---//

const color DARK_GREEN = color.rgb(0, 128, 0)
const color LIGHT_GREEN = color.rgb(0, 255, 0)
const color DARK_RED = color.rgb(128, 0, 0)
const color LIGHT_RED = color.rgb(255, 0, 0)
const color YELLOW = color.rgb(255, 255, 0)
const color BLACK = color.rgb(0, 0, 0)
const color GRAY = color.rgb(120, 120, 120)

//-------------------------------------------------------------------------------------------------------< INPUTS >---//
const string groupSqueeze = 'Squeeze Settings'
const string groupDisplay = 'Display Settings'

i_Length = input.int(21, title='Chart Length', options=[8,13,21,34,55], group=groupSqueeze)
i_StdDevBB = input.float(2.1, title='Bollinger Band StdDev', step=0.1, group=groupSqueeze)
i_StdDevKC = input.float(1.4, title='Keltner Channel StdDev', step=0.1, group=groupSqueeze)

i_TextSize = input.string('large', title='Table Text Size',
  options=['tiny','small','normal','large','huge'], group=groupDisplay)

//----------------------------------------------------------------------------------------------------< FUNCTIONS >---//
// Squeeze detection
method buddhaSqueeze(series float src, int length, float stdKC, float stdBB) =>
    atr = ta.atr(length)
    stdev = ta.stdev(src, length)
    kcWidth = stdKC * atr
    bbWidth = stdBB * stdev
    squeeze = kcWidth != 0 ? (bbWidth / kcWidth) < 1 : false
    squeeze

//-------------------------------------------------------------------------------------------------< CALCULATIONS >---//
// TTM Oscillator
oscBase = (ta.highest(high, i_Length) + ta.lowest(low, i_Length)) / 2 + ta.ema(close, i_Length)
oscillator = ta.linreg(close - oscBase / 2, i_Length, 0)

// Oscillator color
oscillatorColor = oscillator > oscillator[1]
  ? (oscillator > 0 ? DARK_GREEN : LIGHT_GREEN)
  : (oscillator > 0 ? LIGHT_RED : DARK_RED)

// Pseudo‑code snippet for regime‑based stdDevBB
volRegime = ta.atr(i_Length) > ta.ema(ta.atr(i_Length), 50) ? high : low
bbMult = volRegime == high ? 2.2 : 1.8
kcMult = volRegime == high ? 1.7 : 1.3
squeezeSignal = buddhaSqueeze(close, i_Length, kcMult, bbMult)

// Squeeze Signal
//squeezeSignal = buddhaSqueeze(close, i_Length, i_StdDevKC, i_StdDevBB)

// Squeeze Length Counter
var int squeezeCount = na
squeezeCount := squeezeSignal ? (nz(squeezeCount) + 1) : 0

// Label Texts
squeezeLabelText = squeezeCount > 0 ? ' S ' : '   '
squeezeSignalCount = squeezeCount > 0 ? str.tostring(squeezeCount) : na

//-------------------------------------------------------------------------------------------------------< VISUAL >---//
// Zero Line
hline(0,
  title = 'Zero Line',
  color = color.rgb(255,255,255,70),
  linestyle = hline.style_solid)

// Oscillator Bars
plot(oscillator * 100,
  title = 'TTM',
  color = oscillatorColor,
  style = plot.style_columns)

// Squeeze Circles
plot(0,
  title = 'Squeeze',
  color = squeezeSignal ? YELLOW : na, linewidth = 2,
  style = plot.style_steplinebr,
  display = display.pane)

//-------------------------------------------------------------------------------------------------------< TABLES >---//
// Table Style
var table squeezeTable = table.new(position.middle_right, columns=1, rows=2)

if barstate.islast
    table.cell(
      table_id = squeezeTable,
      column = 0, row = 0,
      text = 'S', text_color = BLACK, text_size = i_TextSize,
      bgcolor = squeezeSignal ? YELLOW : GRAY,
      text_formatting = text.format_bold)
    table.cell(
      table_id = squeezeTable,
      column = 0, row = 1,
      text = squeezeSignalCount, text_color = BLACK, text_size = i_TextSize,
      bgcolor = oscillatorColor,
      text_formatting = text.format_bold)

// Table Style
table.set_bgcolor(squeezeTable, BLACK)
table.set_frame_color(squeezeTable, BLACK)
table.set_border_color(squeezeTable, BLACK)
table.set_frame_width(squeezeTable, 3)
table.set_border_width(squeezeTable, 5)

//-----------------------------------------------------------------------------------------------------< END CODE >---//

Overview

Buddha Squeeze plots a linear-regression oscillator as columns coloured by direction and by whether momentum is rising or falling, with yellow marks on the zero line while Bollinger Bands sit inside Keltner-style channels. The squeeze test switches between two multiplier sets depending on whether ATR is above its 50-period average, and a table shows the count of squeeze bars. The length is chosen from fixed options.

Details

Published by

DarthBuddha on GitHub

Draws

Separate pane below the chart

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.

Settings

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

SettingTypeDefaultVariable
Chart Lengthint21i_Length
Bollinger Band StdDevfloat2.1i_StdDevBB
Keltner Channel StdDevfloat1.4i_StdDevKC
Table Text Sizestringlargei_TextSize
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

TTM Squeeze

by Alorse
330 stars

This indicator plots a TTM Squeeze momentum oscillator in a separate pane. It compares a Bollinger Band offset to a Keltner Channel offset and marks the zero line white when the difference is non-negative and black when the bands are inside the channel. A line

Indicator v5 Oscillators & momentumVolatility & bands
Updated 2 months ago · None stated GitHub repository of TTM Squeeze

Function - Logistic Equation

by ricardosantos79
261 stars

Calculates dynamic modeling values by applying a mathematical logistic differential equation to price change over a specified lookback length. It measures price momentum relative to the recent high-low price range. The script plots positive and negative logist

Indicator v5 Oscillators & momentumVolatility & bands
Updated 4 years ago · None stated GitHub repository of Function - Logistic Equation
228 stars

This indicator detects a Bollinger Band squeeze when the bands sit inside Keltner Channels, marking low volatility. It plots red dots during a squeeze and green dots when the bands are outside, in a separate pane. An optional histogram shows momentum as the cl

Indicator v6 Volatility & bandsOscillators & momentum
Updated 3 months ago · None stated GitHub repository of Bollinger Band Squeeze Detector

MACD-V

by harryguiacorn
220 stars

MACD-V is a volatility-normalized momentum indicator based on research by Alex Spiroglou. It calculates the standard MACD histogram and normalizes it by dividing by the Average True Range (ATR). Plotted in a separate pane as a colored histogram, it includes us

Indicator v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of MACD-V
147 stars

This indicator generates trade entry signals and target levels optimized for 1-hour timeframes, designed for external signal extraction. It calculates 7-period and 16-period EMAs alongside 10-period RSI and ATR filters. Long signals occur when the fast EMA cro

Indicator v5 TrendOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of Signal Strategy 100 Candles of 1H Timeframe

Bubbles Indicator

by capissimo
114 stars

The Bubbles Indicator measures volatility squeezes and expansion bursts using Bollinger Bands combined with a sinusoid oscillator and RSI divergence. It processes price data through scaled Bollinger Bands to highlight volatility changes while confirming trend

Indicator v4 Volatility & bandsOscillators & momentum Repaints
Updated 1 year ago · None stated GitHub repository of Bubbles Indicator

More Oscillators & momentum scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers