Strategy · Pine Script v6 · On the chart

PF probe bos-curv-probe-integration

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

This overlay strategy combines confirmed pivot break-of-structure with a curved linear-regression and ATR channel.

View on GitHub

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

80 lines of Pine Script v6 from validation/composite-boscurv-integration-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 bos-curv-probe-integration — BOS trigger gated by curved channel
// Clean-room: written from validation goal, not from source.
//
// Purpose: composes the two surfaces isolated by `bos-curv-probe-01..02`
// (pivot-based break-of-structure + curved linreg/ATR channel) into one
// strategy. Long entry requires both a BOS-up confirmation AND `close`
// above the curved upper band's lower envelope; short symmetric. The
// integrated probe verifies that the engine evaluates pivot-state and
// linreg/ATR math in agreement on the same bars TradingView does.
//
// Validation goal: bit-exact trade list against TradingView's broker
// emulator on the reference 15-minute ETH-USDT-USDT feed.
//
// 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 bos-curv-probe-integration", shorttitle="PF_bosINT",
     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_left         = input.int(5,    "Pivot left bars",  minval=1)
int   i_right        = input.int(5,    "Pivot right bars", minval=1)
int   i_lr_len       = input.int(50,   "Linreg length",   minval=10)
int   i_atr_len      = input.int(14,   "ATR length",      minval=2)
float i_atr_mult     = input.float(2.0, "ATR multiplier",  minval=0.1, step=0.1)
float i_curve_offset = input.float(5.0, "Slope curve offset", step=0.5)

// ---- pivot + last-confirmed state ---------------------------------
float ph = ta.pivothigh(high, i_left, i_right)
float pl = ta.pivotlow(low,   i_left, i_right)

var float last_ph = na
var float last_pl = na

if not na(ph)
    last_ph := ph
if not na(pl)
    last_pl := pl

bool bos_long  = not na(last_ph) and close > last_ph and close[1] <= nz(last_ph[1], last_ph)
bool bos_short = not na(last_pl) and close < last_pl and close[1] >= nz(last_pl[1], last_pl)

// ---- curved channel -----------------------------------------------
float mid    = ta.linreg(close, i_lr_len, 0)
float lr_lag = ta.linreg(close, i_lr_len, 1)
float slope  = mid - lr_lag
float width  = ta.atr(i_atr_len) * i_atr_mult
float upper  = mid + width + slope * i_curve_offset
float lower  = mid - width + slope * i_curve_offset

// ---- composite gates ----------------------------------------------
bool channel_bull = close > mid + slope * i_curve_offset
bool channel_bear = close < mid + slope * i_curve_offset

bool go_long  = bos_long  and channel_bull
bool go_short = bos_short and channel_bear

// ---- exit when price re-enters opposite half of channel -----------
bool exit_long  = strategy.position_size > 0 and ta.crossunder(close, lower)
bool exit_short = strategy.position_size < 0 and ta.crossover(close, upper)

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

if go_short and strategy.position_size >= 0
    strategy.entry("S", strategy.short, qty=1, comment="integ short")

if exit_long
    strategy.close("L", comment="integ exit long")
if exit_short
    strategy.close("S", comment="integ exit short")

Overview

PF probe bos-curv-probe-integration enters long when price breaks a confirmed pivot high and closes above the slope-adjusted channel midline, and enters short on the symmetric bearish conditions, reversing from the opposite side with a fixed quantity of one. It exits a long when close crosses under the lower band and a short when close crosses over the upper band. Pivot width, regression length, ATR length and multiplier, and slope offset change the structure and channel. There is no stop loss. It draws on the price chart.

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, Support & resistance, Volatility & bands, Trend

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
Pivot left barsint5i_left
Pivot right barsint5i_right
Linreg lengthint50i_lr_len
ATR lengthint14i_atr_len
ATR multiplierfloat2.0i_atr_mult
Slope curve offsetfloat5.0i_curve_offset
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
16 stars

This strategy trades Donchian breakouts measured on weekly bars while orders execute on the chart timeframe. It allows long and short entries when price breaks the prior weekly channel and exits against the shorter weekly channel. Position size risks a set per

Strategy v6 TrendBreakout
Updated 11 months ago · None stated GitHub repository of Seykota Alt 4: Weekly Donchian
11 stars

Calculates upper and lower Donchian Channel bands over a customizable lookback length and plots them on the main price chart. At a specified exchange hour, the strategy places a long buy stop order at the upper Donchian Channel level. Unfilled pending orders a

Strategy v6 BreakoutSupport & resistance
Updated 5 months ago · Apache-2.0 GitHub repository of Estrategia Donchian Breakout

This trend-following strategy executes a classic Donchian channel breakout system designed to cross-validate backtest results against external framework benchmarks. It triggers a long entry when the closing price breaks above the highest high of the prior entr

Strategy v6 BreakoutTrend
Updated today · AGPL-3.0 GitHub repository of Forven S01509 - Simple Donchian 20/10 Breakout
106 stars

This overlay strategy plots a two-timeframe Ichimoku setup on the price chart, with Tenkan, Kijun, Chikou, and Kumo from a base higher timeframe and an optional highest-timeframe cloud. It allows two entries in the same direction and uses ATR-based trailing st

Strategy v4 TrendVolatility & bands
Updated 2 years ago · GPL-3.0 GitHub repository of 2Tier Ichimoku Pyramiding [Takazudo]

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