Strategy · Pine Script v6 · On the chart

PF Probe 99 - Keltner Channel Break

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

This strategy calculates Keltner Channels using an Exponential Moving Average (EMA) for the midline and Average True Range (ATR) scaled by a multiplier for band width.

View on GitHub

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

62 lines of Pine Script v6 from validation/ta-keltner-channel-break-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 99 — Keltner channel breakout
// Clean-room: written from validation goal, not from source.
//
// Purpose: exercises a compact composite of three v6 surfaces in one
// strategy — `ta.ema(close, 20)` for the channel midline, `ta.atr(10)`
// for the half-width, and `ta.crossover` / `ta.crossunder` of close
// against the upper/lower band for the entry/exit triggers. The
// channel construction `mid ± atr * mult` is a TA-on-TA expression;
// any tiny seed drift in either the EMA or the ATR shifts the band,
// which in turn shifts WHICH bar the close-vs-band cross resolves on.
//
// Validation goal: bit-exact trade list against TradingView's broker
// emulator on the reference 15m feed. Pass = every entry/exit fires
// on the same bar TradingView places it.
//
// 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 99 - keltner channel break", shorttitle="PF_p99_KCH",
     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_ema_len = input.int(20,  "Channel EMA length", minval=2,  maxval=200)
int   i_atr_len = input.int(10,  "Channel ATR length", minval=2,  maxval=100)
float i_mult    = input.float(2.0, "Channel multiple", minval=0.5, maxval=10.0, step=0.1)

// ---- channel construction -----------------------------------------
float mid_line = ta.ema(close, i_ema_len)
float half_w   = ta.atr(i_atr_len) * i_mult
float upper    = mid_line + half_w
float lower    = mid_line - half_w

// ---- entries / exits on cross of close vs band --------------------
bool long_break  = ta.crossover(close,  upper)
bool short_break = ta.crossunder(close, lower)
bool long_exit   = ta.crossunder(close, mid_line)
bool short_exit  = ta.crossover(close,  mid_line)

if long_break and strategy.position_size <= 0
    if strategy.position_size < 0
        strategy.close("S", comment="flip flat")
    strategy.entry("L", strategy.long, comment="upper break")

if short_break and strategy.position_size >= 0
    if strategy.position_size > 0
        strategy.close("L", comment="flip flat")
    strategy.entry("S", strategy.short, comment="lower break")

if long_exit and strategy.position_size > 0
    strategy.close("L", comment="back to mid")

if short_exit and strategy.position_size < 0
    strategy.close("S", comment="back to mid")

Overview

PF Probe 99 - Keltner Channel Break triggers a long entry when the close price crosses above the upper band and a short entry when it crosses below the lower band. Open long positions exit when the price crosses below the midline, while short positions exit when crossing above it. User inputs allow adjustment of the EMA length, ATR length, and channel multiplier. It plots directly on the price chart and includes no stop loss or take profit mechanisms.

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

Trend, Volatility & bands, Breakout

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
Channel EMA lengthint20i_ema_len
Channel ATR lengthint10i_atr_len
Channel multiplefloat2.0i_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

257 stars

This strategy plots VWMA-based Bollinger bands on the 1-minute ES futures price chart for volatility analysis and potential breakout identification. It calculates dynamic long and short stop loss and take profit levels using percentage inputs relative to entry

Strategy v6 Volatility & bandsSupport & resistance
Updated 6 weeks ago · None stated GitHub repository of V1.6 ES - Futures 1M No Repaint
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 均线突破交易系统
16 stars

This trend-following strategy adapts classic Donchian breakout channels according to market volatility regimes. It calculates an ATR percentile rank across a rolling lookback period, shifting dynamically between tighter breakout channels with smaller stops dur

Strategy v6 TrendBreakout
Updated 11 months ago · None stated GitHub repository of Seykota Alt 1: Adaptive Volatility

This strategy executes breakout trades using two Donchian Channels alongside an optional 200-period EMA trend filter. Entries trigger when the price sets a new highest high or lowest low over the primary Donchian Channel period. Exits are managed via a shorter

Strategy v5 BreakoutTrend
Updated 1 year ago · None stated GitHub repository of Ruckard Walcrypto DoubleDonchian B002

Breakout Strategy

by JoelPasapera
11 stars

This strategy implements a channel breakout system directly on the main price chart. It calculates highest highs and lowest lows over configurable entry and exit periods using historical candles. A long entry triggers when the close breaks above the entry chan

Strategy v6 BreakoutTrend
Updated 5 months ago · Apache-2.0 GitHub repository of Breakout Strategy

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