Strategy · Pine Script v6 · On the chart

PF IES probe 05 - bb/kc squeeze

by pineforge-4pass· code credited to PineForge contributors 2026

This Pine Script strategy detects volatility squeeze releases using parallel Bollinger Bands and Keltner Channels calculated with length 20 and specified multipliers.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code62
Settings4inputs
LicenceApache-2.0
Last update5 days ago23 Oct 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 strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

62 lines of Pine Script v6 from validation/composite-ies-bb-kc-squeeze-release-01/strategy.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

strategy.pine
// This Pine Script® code is licensed under Apache-2.0
// SPDX-License-Identifier: Apache-2.0
// © PineForge contributors 2026
//
// IES probe 05 — BB / KC squeeze release detection
//
// Purpose: isolate the IES integration probe family's volatility-squeeze
// gate. That family computes Bollinger Bands (sma+stdev) and Keltner
// Channels (ema+atr) at length 20 in parallel, then tracks
// `squeeze_on = bb_lower > kc_lower and bb_upper < kc_upper`. The release
// event is a one-bar pulse:
//
//   squeeze_release = squeeze_on[1] and not squeeze_on
//
// That `squeeze_on[1]` reference is exactly the kind of derived-bool
// history reference where engine vs TV can drift — the boolean is a
// derived series produced from four parallel TA chains (sma, stdev, ema,
// atr) and any one of those warming up differently in the early bars
// flips the boundary value of `squeeze_on` for one or two bars.
//
// Trade shape: long-only — enter on `squeeze_release` (one-bar pulse);
// exit when close crosses below the KC basis (ema(close,20)). This keeps
// the entry trigger laser-focused on the squeeze_release boundary while
// leaving exit logic trivial.
//
// TV setup: 15m chart, ETH-USDT-USDT, same window as
// data/ohlcv_ETH-USDT-USDT_15m.csv. Export "List of trades" → trades.csv.
//@version=6
strategy("PF IES probe 05 - bb/kc squeeze", shorttitle="IES_p05_SQZ", overlay=true,
     initial_capital=1000000,
     commission_type=strategy.commission.percent, commission_value=0, slippage=0,
     default_qty_type=strategy.fixed, default_qty_value=1, pyramiding=1,
     process_orders_on_close=false)

// ---- inputs (mirrored from IES) ------------------------------------
int   i_bb_len  = input.int(20,    "BB Length", minval=10, maxval=50)
float i_bb_mult = input.float(2.0, "BB Mult",   minval=1.0, maxval=3.0, step=0.1)
int   i_kc_len  = input.int(20,    "KC Length", minval=10, maxval=50)
float i_kc_mult = input.float(1.5, "KC Mult",   minval=1.0, maxval=3.0, step=0.1)

// ---- Bollinger Bands (sma + stdev*mult) ----------------------------
float bb_basis = ta.sma(close, i_bb_len)
float bb_dev   = ta.stdev(close, i_bb_len) * i_bb_mult
float bb_upper = bb_basis + bb_dev
float bb_lower = bb_basis - bb_dev

// ---- Keltner Channels (ema + atr*mult) -----------------------------
float kc_basis = ta.ema(close, i_kc_len)
float kc_range = ta.atr(i_kc_len) * i_kc_mult
float kc_upper = kc_basis + kc_range
float kc_lower = kc_basis - kc_range

// ---- squeeze + release boundary ------------------------------------
bool squeeze_on      = bb_lower > kc_lower and bb_upper < kc_upper
bool squeeze_release = squeeze_on[1] and not squeeze_on

// ---- enter on the release pulse, exit on KC-basis cross-under ------
if squeeze_release and strategy.position_size == 0
    strategy.entry("L", strategy.long, qty=1, comment="squeeze release")

if ta.crossunder(close, kc_basis) and strategy.position_size > 0
    strategy.close("L", comment="kc basis lost")

Overview

PF IES probe 05 - bb/kc squeeze plots the bands and channels overlaid on the price chart. The strategy enters a long position on the one-bar squeeze release signal when no position is held, and exits when price crosses below the Keltner Channel basis. Main inputs adjust BB and KC lengths and multipliers. It uses fixed position sizing of 1 unit and has no stop loss.

Details

Published by

pineforge-4pass on GitHub

Code credit

PineForge contributors 2026, as written in the script's header

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Volatility & bands, Breakout, Moving averages

Markets

Crypto

Timeframes

M15-H1

Risk Notes

  • The strategy enters trades without a stop loss

Topics

algorithmic-tradingbacktestingparitypine-scriptpinescriptquantitative-financetest-corpustradingview

Settings

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

SettingTypeDefaultVariable
BB Lengthint20i_bb_len
BB Multfloat2.0i_bb_mult
KC Lengthint20i_kc_len
KC Multfloat1.5i_kc_mult
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

Bollinger Breakout

by hackingthemarkets
189 stars

This price-chart strategy plots a simple moving average and upper and lower bands built from the standard deviation of close, scaled by separate offset inputs. It enters a fixed quantity long when close crosses above the upper band and a fixed quantity short w

Strategy v4 Volatility & bandsBreakout
Updated 3 years ago · None stated GitHub repository of Bollinger Breakout
106 stars

This strategy runs on the price chart and enters long when a fast simple moving average crosses above a slow one, and short on the opposite cross, while closing the other side. Entries also need ATR above a filter, a pullback check, a minimum candle-body chang

Strategy v5 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of 9:22 5 MIN 15 MIN BANKNIFTY

均线突破交易系统

by tangly1024
76 stars

This strategy trades long breakouts of a fast and a slow moving average on the price chart. It opens a long position when price crosses above either average, using a percentage of equity as size. It reduces the position by a set share when the high reaches the

Strategy v5 TrendMoving averages
Updated 4 months ago · None stated GitHub repository of 均线突破交易系统

Bollinger bands examples

by tradingstrategy-ai
53 stars

This strategy plots exponential-moving-average Bollinger bands on the price chart and calculates RSI. It opens a long position when close crosses above the upper band while RSI is at or above a threshold, the date filter allows trading, and no position is open

Strategy v5 Volatility & bandsOscillators & momentum
Updated 3 years ago · None stated GitHub repository of Bollinger bands examples

Keltner Channels Strategy

by TWODS-CAPITAL
37 stars

This strategy builds Keltner-style bands around an exponential or simple moving average of the chosen source. Band width uses average true range, raw true range, or a smoothed high-low range, scaled by a multiplier. When the source crosses above the upper band

Strategy v5 Volatility & bandsBreakout
Updated 3 years ago · MIT GitHub repository of Keltner Channels Strategy
16 stars

This strategy plots Donchian channels, trailing stops, and profit targets directly on the price chart. It enters breakout trades using a 55-bar Donchian channel and sizes positions according to an ATR-based risk percentage per unit. The system adds units as pr

Strategy v6 TrendBreakout
Updated 11 months ago · None stated GitHub repository of Seykota Alt 10: Profit Targets

More strategys

Trade Your Charts With a Regulated Broker

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

Compare brokers