Strategy · Pine Script v6 · On the chart

PF probe kkb-probe-02-breakout-trigger

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

This strategy draws an exponential moving average of close and an ATR envelope around it on the price chart.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code48
Settings3inputs
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

48 lines of Pine Script v6 from validation/composite-kkb-ema-atr-breakout-band-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
//
// PF probe kkb-probe-02-breakout-trigger — EMA mid + ATR breakout band
// Clean-room: written from validation goal, not from source.
//
// Purpose: isolates a smoothed-band breakout. The engine surfaces under
// test are `ta.ema(close, len)` for the central band, `ta.atr(len)` for
// volatility, and the upper/lower band arithmetic. Long entries fire on
// `ta.crossover(close, upper)`, short on `ta.crossunder(close, lower)`.
// Verifies that engine vs TV agree on the EMA/ATR numerics at the
// breakout boundary.
//
// Validation goal: bit-exact entries on close-vs-band breakouts. Pass =
// identical trade list vs TradingView's broker emulator.
//
// TV setup: 15m chart, ETH-USDT-USDT (Binance USDT-M Perpetual). Full window
// matching corpus/data/ohlcv_ETH-USDT-USDT_15m.csv. Strategy properties:
// leave defaults from script header. Export "List of trades" → tv_trades.csv.
//@version=6
strategy("PF probe kkb-probe-02-breakout-trigger", shorttitle="PF_kkb02_BRK",
     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 --------------------------------------------------------
int   i_band_len = input.int(20,    "Band EMA length", minval=2)
int   i_atr_len  = input.int(14,    "ATR length",      minval=2)
float i_atr_mult = input.float(1.5, "ATR multiplier",  minval=0.1, step=0.1)

// ---- band ---------------------------------------------------------
float band  = ta.ema(close, i_band_len)
float vol   = ta.atr(i_atr_len)
float upper = band + vol * i_atr_mult
float lower = band - vol * i_atr_mult

// ---- crosses ------------------------------------------------------
bool cross_up   = ta.crossover(close, upper)
bool cross_down = ta.crossunder(close, lower)

// ---- order routing -------------------------------------------------
if cross_up and strategy.position_size <= 0
    strategy.entry("L", strategy.long, qty=1, comment="band breakout long")

if cross_down and strategy.position_size >= 0
    strategy.entry("S", strategy.short, qty=1, comment="band breakdown short")

Overview

PF probe kkb-probe-02-breakout-trigger enters one long contract when close crosses above the upper band and one short contract when close crosses below the lower band, reversing only from a flat or opposite position. Band EMA length, ATR length, and ATR multiplier set the envelope. There is no stop loss, take profit, or other exit rule. The validation note uses a 15-minute crypto perpetual feed.

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

Breakout, Moving averages, Volatility & bands

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
Band EMA lengthint20i_band_len
ATR lengthint14i_atr_len
ATR multiplierfloat1.5i_atr_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