Strategy · Pine Script v6 · On the chart

PF Probe Kanuck-Probe-Integration

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

This validation strategy tests the simultaneous runtime handling of Kaufman's Adaptive Moving Average (KAMA), intra-bar tick counting, and deep historical buffer retention.

View on GitHub

Repaints

GitHub stars1on the repository
Pine versionv6current
Lines of code85
Settings7inputs
LicenceApache-2.0
Last update7 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

85 lines of Pine Script v6 from validation/composite-kanuck-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 kanuck-probe-integration — KAMA + tick + deep-history composition
// Clean-room: written from validation goal, not from source.
//
// Purpose: composes the three surfaces isolated by `kanuck-probe-01..03`
// (KAMA stateful smoothing, `calc_on_every_tick=true` per-tick counter,
// `max_bars_back=500` deep-history reference chain) into one strategy.
// Verifies the runtime handles all three runtime modes simultaneously
// without state corruption between them. The engine surfaces under test
// are: KAMA recurrence, per-tick counter under `calc_on_every_tick=true`,
// and deep-history retention under `max_bars_back=500`.
//
// Entries fire on `ta.crossover(close, kama)` gated by the tick-counter
// modulo (probes 01 + 02). The deep-history terms (`ta.sma(close, 400)`,
// `ta.rsi(close[200], 14)`, `close[450]`) are computed on every bar so
// the runtime has to retain the 500-bar buffer (probe 03 surface) but
// they no longer ALSO gate entries — the earlier four-AND composition
// fired far too rarely on 15m crypto for parity to be meaningful.
//
// 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 kanuck-probe-integration", shorttitle="PF_kanINT",
     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,
     calc_on_every_tick=true, max_bars_back=500)

// ---- inputs --------------------------------------------------------
int i_kama_len   = input.int(14,  "KAMA length",         minval=2)
int i_kama_fast  = input.int(2,   "KAMA fast end",       minval=1)
int i_kama_slow  = input.int(30,  "KAMA slow end",       minval=2)
int i_step       = input.int(2,   "Tick-counter modulo", minval=1)
int i_sma_len    = input.int(400, "Long SMA length",     minval=50)
int i_rsi_offset = input.int(200, "RSI source offset",   minval=1)
int i_deep_lag   = input.int(450, "Close-reference lag", minval=1)

// ---- KAMA (manual recurrence; v6 has no ta.kama built-in) ----------
float change_n  = math.abs(close - close[i_kama_len])
float vol_sum   = math.sum(math.abs(close - close[1]), i_kama_len)
float er        = vol_sum > 0 ? change_n / vol_sum : 0.0
float fast_sc   = 2.0 / (i_kama_fast + 1)
float slow_sc   = 2.0 / (i_kama_slow + 1)
float sc        = math.pow(er * (fast_sc - slow_sc) + slow_sc, 2)
var float kama  = na
kama := na(kama[1]) ? close : kama[1] + sc * (close - kama[1])

// ---- per-evaluation tick counter ----------------------------------
var int tick_counter = 0
tick_counter += 1
bool gate = (tick_counter % i_step) == 0

// ---- deep-history terms (computed every bar; force 500-bar buffer) -
float long_sma   = ta.sma(close, i_sma_len)
float deep_rsi   = ta.rsi(close[i_rsi_offset], 14)
float deep_close = close[i_deep_lag]
bool  deep_ready = not na(long_sma) and not na(deep_rsi) and not na(deep_close)

// Plot the corroborating deep-history terms so the engine has to keep
// them resolved even though they no longer gate entries.
plot(long_sma,   "deep SMA", color=color.new(color.blue,   0))
plot(deep_rsi,   "deep RSI", color=color.new(color.purple, 0), display=display.data_window)
plot(deep_close, "deep ref", color=color.new(color.gray,   0), display=display.data_window)

// ---- composed signals ---------------------------------------------
bool kama_up   = ta.crossover(close, kama)
bool kama_down = ta.crossunder(close, kama)

bool go_long  = deep_ready and kama_up   and gate
bool go_short = deep_ready and kama_down and gate

// ---- 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")

Overview

PF Probe Kanuck-Probe-Integration enters trades when the closing price crosses above KAMA, gated by an intra-bar tick counter modulo. Deep-history terms including a long-period SMA, lagged RSI, and past close prices are calculated to stress-test historical buffering. Configurable settings adjust KAMA lengths, tick step modulo, and history lags. Plotted on the main chart, it calculates on every tick and operates without stop-loss or take-profit 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

  • Signals can change on the live bar or after it closes (repainting)
  • 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
KAMA lengthint14i_kama_len
KAMA fast endint2i_kama_fast
KAMA slow endint30i_kama_slow
Tick-counter moduloint2i_step
Long SMA lengthint400i_sma_len
RSI source offsetint200i_rsi_offset
Close-reference lagint450i_deep_lag
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

Doge SMA

by hackingthemarkets
474 stars

Doge SMA is a long-only moving-average crossover strategy drawn on the price chart. It calculates a fast and a slow simple moving average of close and enters a long position when the fast average crosses above the slow average, but only inside a user-defined s

Strategy v4 TrendMoving averages
Updated 4 years ago · None stated GitHub repository of Doge SMA

This strategy calculates and plots a fast Exponential Moving Average (EMA) and a slow EMA directly on the main price chart. It enters long trades when the fast EMA crosses above the slow EMA and exits when the fast EMA crosses below the slow EMA. Inputs allow

Strategy v6 TrendMoving averages
Updated 2 days ago · AGPL-3.0 GitHub repository of Forven S01508 — Simple EMA20/50 Cross
330 stars

2 EMA/SMA + RSI Strategy [Alorse] combines three configurable moving averages with a short-period Relative Strength Index filter. It plots fast, slow, and trend moving averages on the price chart. Long entries trigger when the fast moving average is above the

Strategy v4 TrendOscillators & momentum
Updated 2 months ago · None stated GitHub repository of 2 EMA/SMA + RSI Strategy [Alorse]

Acrypto - Weighted Strategy

by AlbertoCuadra
318 stars

This strategy plots on the price chart and opens long or short positions when a weighted score from MACD, Stochastic RSI, RSI, Supertrend and a moving-average crossover exceeds a user-set trigger. Each component has its own weight and candle delay. Entries can

Strategy v5 TrendOscillators & momentum
Updated 3 years ago · Custom licence GitHub repository of Acrypto - Weighted Strategy
257 stars

This strategy calculates dynamic support and resistance levels using pivot highs and lows alongside a custom smoothed trend filter and a 3-period EMA. It identifies entry opportunities when price breaks out relative to the trend filter and short-term EMA cross

Strategy v5 TrendSupport & resistance Repaints
Updated 7 weeks ago · None stated GitHub repository of 30s - ES 1m Strategy Candle Bar

EMA Crossover Strategy

by TradersPost
228 stars

EMA Crossover Strategy plots a fast and a slow exponential moving average on the price chart. It treats a confirmed fast-over-slow cross as a long condition and a confirmed cross under as a short condition. Position size is a percentage of equity. Optional per

Strategy v6 TrendMoving averages
Updated 3 months ago · None stated GitHub repository of EMA Crossover Strategy

More Moving averages 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