Strategy · Pine Script v6 · On the chart

PF Probe Bos-Curv-Probe-02-Curved-Channel

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

This strategy constructs an asymmetric curved channel using linear regression and average true range.

View on GitHub

GitHub stars3on the repository
Pine versionv6current
Lines of code64
Settings4inputs
LicenceApache-2.0
Last update4 days ago20 Nov 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

64 lines of Pine Script v6 from validation/composite-boscurv-linreg-slope-channel-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-02-curved-channel — slope-warped linreg+ATR channel
// Clean-room: written from validation goal, not from source.
//
// Purpose: isolates a non-linear channel computed from `ta.linreg` plus
// per-bar slope and `ta.atr` width. The engine surfaces under test are
// `ta.linreg` (least-squares regression over a rolling window evaluated at
// two offsets to derive a slope), `ta.atr` (RMA chain), and the curved
// upper/lower band:
//
//     mid    = ta.linreg(close, len, 0)
//     slope  = ta.linreg(close, len, 0) - ta.linreg(close, len, 1)
//     width  = ta.atr(atr_len) * mult
//     upper  = mid + width + slope * curve_offset
//     lower  = mid - width + slope * curve_offset
//
// The slope term curves the band asymmetrically vs a flat linreg envelope.
// Verifies that engine vs TV agree on the regression coefficients at every
// bar and on the slope-difference numerics.
//
// Validation goal: bit-exact entries when `close` crosses above the
// curved upper band (long) or below the curved lower band (short).
//
// 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-02-curved-channel", shorttitle="PF_bos02_CRV",
     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_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)

// ---- linreg + slope ------------------------------------------------
float mid    = ta.linreg(close, i_lr_len, 0)
float lr_lag = ta.linreg(close, i_lr_len, 1)
float slope  = mid - lr_lag

// ---- ATR width -----------------------------------------------------
float width = ta.atr(i_atr_len) * i_atr_mult

// ---- curved bands --------------------------------------------------
float upper = mid + width + slope * i_curve_offset
float lower = mid - width + slope * i_curve_offset

// ---- 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="curve cross up")

if cross_down and strategy.position_size >= 0
    strategy.entry("S", strategy.short, qty=1, comment="curve cross down")

Overview

PF Probe Bos-Curv-Probe-02-Curved-Channel calculates rolling linear regression values and determines the current slope by comparing values across adjacent bars. The channel bands are dynamically adjusted by combining ATR volatility width with a slope-derived curve offset term. The strategy enters a long position when price crosses above the curved upper band and enters a short position when price crosses below the curved lower band. It operates without stop loss or profit target rules.

Details

Published by

pineforge-4pass on GitHub

Code credit

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

Draws

On the price chart

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
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

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 5 months ago · None stated GitHub repository of 均线突破交易系统
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 1 year ago · None stated GitHub repository of Seykota Alt 10: Profit Targets
4 stars

This strategy executes trend-following trades based on Bollinger Band breakouts confirmed by a long-term moving average filter. A long position opens when the price crosses above the upper Bollinger Band, provided the band spread meets a minimum threshold and

Strategy v5 Volatility & bandsTrend
Updated 2 years ago · None stated GitHub repository of Bollinger Trend - Strategy V1
4 stars

The Keltner Channel Strategy is a breakout system plotted directly on the main price chart. It calculates upper and lower channel bands around an exponential or simple moving average using ATR, True Range, or bar range multiplied by a specified factor. A long

Strategy v5 TrendVolatility & bands
Updated 5 months ago · None stated GitHub repository of Keltner Channel Strategy

More Trend 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