Strategy · Pine Script v6 · On the chart

VCP Probe 08 - Integration

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

This integration strategy combines seven analytical layers into a single system drawn directly on the main price chart.

View on GitHub

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

195 lines of Pine Script v6 from validation/composite-vcp-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
//
// VCP probe 08 — integration probe (pivot + FVG + RSI divergence + vol
//                z-anomaly + cumulative delta + ADX regime + NY session,
//                composed in a clean-room layered design)
// Clean-room: written from validation goal, not from source.
//
// Purpose: composes the surfaces already isolated in vcp-probe-01..07 in
// a single strategy so engine/TV agreement on each component probe can
// be cross-checked against agreement on a representative composition.
// The seven layers exercised here are:
//   (1) pivot       — ta.pivothigh / ta.pivotlow at strength 5 (probe 01).
//   (2) FVG         — 3-bar imbalance + ATR-fraction min size + active-zone
//                     array iteration (probe 02).
//   (3) RSI div     — smoothed RSI(14)→EMA(3) with 5-bar memory (probe 03).
//   (4) vol z       — (volume - sma) / stdev anomaly threshold (probe 04).
//   (5) cum delta   — candle-position buy/sell volume + 10-bar sum (probe 05).
//   (6) ADX regime  — manual DI/ADX chain via ta.rma (probe 06).
//   (7) session     — NY 0800-1600 with DST-aware tz (probe 07).
// Long entry requires (a) confirmed pivot LOW carried as breakout level
// AND close > carried pivot HIGH, (b) currently inside a bull FVG zone,
// (c) bullish vol-z anomaly OR cum-delta cross-up, (d) trending bull
// ADX regime, (e) NY session active. Short symmetric. The composition
// is the author's; the per-layer math mirrors the surfaces isolated by
// the component probes (NOT the original VCP source).
//
// Validation goal: integration parity. If probes 01–07 each pass
// individually but this composition disagrees with TradingView, the
// gap is attributable to interaction between the layers (state ordering,
// per-bar containment loops touching arrays under load, ta-on-ta
// seeding) rather than any single layer.
//
// 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("VCP probe 08 - integration", shorttitle="VCP_p08_INT",
     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,
     max_boxes_count=300)

// =====================================================================
// inputs (one per layer; defaults match component probes)
// =====================================================================
int    i_pivot      = input.int(5, "Pivot strength",                 minval=2,  maxval=20)
float  i_fvg_atr    = input.float(0.3,"FVG min size (atr fraction)", minval=0.05,maxval=2.0, step=0.05)
int    i_rsi_len    = input.int(14,"RSI length",                     minval=5,  maxval=30)
int    i_vol_ma_len = input.int(20,"Volume MA length",               minval=5,  maxval=50)
float  i_vol_z      = input.float(2.0,"Volume z threshold",          minval=1.0, maxval=4.0, step=0.1)
int    i_cd_sum     = input.int(10,"Cum-delta window",               minval=2,  maxval=50)
int    i_adx_len    = input.int(14,"ADX length",                     minval=5,  maxval=30)
float  i_adx_thr    = input.float(25,"ADX trend threshold",          minval=15, maxval=40)
string i_session    = input.session("0800-1600", "Active session")
string i_tz         = input.string("America/New_York", "Timezone",
     options=["America/New_York", "Europe/London", "Asia/Tokyo", "UTC"])

// =====================================================================
// shared building blocks
// =====================================================================
float atr_v = ta.atr(14)

// =====================================================================
// layer 1 — pivot detection + carried last-confirmed levels
// =====================================================================
float ph_v = ta.pivothigh(high, i_pivot, i_pivot)
float pl_v = ta.pivotlow(low,   i_pivot, i_pivot)

var float last_ph = na
var float last_pl = na
if not na(ph_v)
    last_ph := ph_v
if not na(pl_v)
    last_pl := pl_v

bool pivot_break_up = not na(last_ph) and close > last_ph
bool pivot_break_dn = not na(last_pl) and close < last_pl

// =====================================================================
// layer 2 — FVG zones (parallel array trio + per-bar containment loop)
// =====================================================================
bool bull_fvg_event = low > high[2] and close[1] > open[1]
bool bear_fvg_event = high < low[2] and close[1] < open[1]
float fvg_min_w = atr_v * i_fvg_atr

var array<float> z_top   = array.new<float>()
var array<float> z_bot   = array.new<float>()
var array<bool>  z_isb   = array.new<bool>()

if bull_fvg_event and (low - high[2]) >= fvg_min_w
    array.push(z_top, low)
    array.push(z_bot, high[2])
    array.push(z_isb, true)

if bear_fvg_event and (low[2] - high) >= fvg_min_w
    array.push(z_top, low[2])
    array.push(z_bot, high)
    array.push(z_isb, false)

while array.size(z_top) > 30
    array.shift(z_top)
    array.shift(z_bot)
    array.shift(z_isb)

bool in_bull_fvg = false
bool in_bear_fvg = false
if array.size(z_top) > 0
    for k = 0 to array.size(z_top) - 1
        float t = array.get(z_top, k)
        float b = array.get(z_bot, k)
        bool  s = array.get(z_isb, k)
        if low <= t and high >= b
            if s
                in_bull_fvg := true
            else
                in_bear_fvg := true

// =====================================================================
// layer 3 — smoothed-RSI divergence (kept as a bias hint, not required)
// =====================================================================
float rsi_v      = ta.rsi(close, i_rsi_len)
float rsi_smooth = ta.ema(rsi_v, 3)
bool  rsi_div_bull = rsi_smooth < 40 and close > close[5] and rsi_smooth > rsi_smooth[5]
bool  rsi_div_bear = rsi_smooth > 60 and close < close[5] and rsi_smooth < rsi_smooth[5]

// =====================================================================
// layer 4 — volume z-score anomaly
// =====================================================================
float vol_ma  = ta.sma(volume, i_vol_ma_len)
float vol_std = ta.stdev(volume, 20)
float vol_z   = vol_std > 0 ? (volume - vol_ma) / vol_std : 0
bool  vol_anom_bull = math.abs(vol_z) > i_vol_z and close > open
bool  vol_anom_bear = math.abs(vol_z) > i_vol_z and close < open

// =====================================================================
// layer 5 — cumulative volume delta (candle-position synthesis + sum)
// =====================================================================
float buy_vol  = close > open ? volume : volume * (close - low) / (high - low + 0.0001)
float sell_vol = close < open ? volume : volume * (high - close) / (high - low + 0.0001)
float vol_d    = buy_vol - sell_vol
float cum_d    = math.sum(vol_d, i_cd_sum)
bool  cd_up    = cum_d > 0
bool  cd_dn    = cum_d < 0

// =====================================================================
// layer 6 — manual ADX regime (matches probe 06)
// =====================================================================
float up_mv   = ta.change(high)
float dn_mv   = -ta.change(low)
float p_dm_v  = na(up_mv) ? na : (up_mv > dn_mv and up_mv > 0 ? up_mv : 0)
float m_dm_v  = na(dn_mv) ? na : (dn_mv > up_mv and dn_mv > 0 ? dn_mv : 0)
float tr_smo  = ta.rma(ta.tr, i_adx_len)
float p_di_v  = tr_smo > 0 ? 100 * ta.rma(p_dm_v, i_adx_len) / tr_smo : 0
float m_di_v  = tr_smo > 0 ? 100 * ta.rma(m_dm_v, i_adx_len) / tr_smo : 0
float dx_v    = (p_di_v + m_di_v) > 0 ? 100 * math.abs(p_di_v - m_di_v) / (p_di_v + m_di_v) : 0
float adx_v   = ta.rma(dx_v, i_adx_len)
bool  trending_bull = adx_v > i_adx_thr and p_di_v > m_di_v
bool  trending_bear = adx_v > i_adx_thr and m_di_v > p_di_v

// =====================================================================
// layer 7 — NY session gate
// =====================================================================
bool in_session = not na(time(timeframe.period, i_session, i_tz))

// =====================================================================
// composition — long requires pivot break up + bull fvg + (vol-anomaly
// bull OR cum-delta up) + trending bull + session active. Short symmetric.
// rsi divergences feed nothing here on purpose (kept as a tap point in
// case a future revision wants to gate on them).
// =====================================================================
bool long_setup =
     pivot_break_up and in_bull_fvg and (vol_anom_bull or cd_up)
     and trending_bull and in_session

bool short_setup =
     pivot_break_dn and in_bear_fvg and (vol_anom_bear or cd_dn)
     and trending_bear and in_session

if long_setup and strategy.position_size <= 0
    if strategy.position_size < 0
        strategy.close("S", comment="flip flat")
    strategy.entry("L", strategy.long, comment="vcp confluence long")

if short_setup and strategy.position_size >= 0
    if strategy.position_size > 0
        strategy.close("L", comment="flip flat")
    strategy.entry("S", strategy.short, comment="vcp confluence short")

// session-end exit: flatten on the falling edge of the session window
if not in_session and in_session[1] and strategy.position_size != 0
    strategy.close_all(comment="session end")

Overview

VCP Probe 08 - Integration calculates pivot highs and lows, Fair Value Gaps (FVG) scaled by ATR, smoothed RSI momentum, volume z-score anomalies, cumulative volume delta, ADX trend strength, and active trading sessions. Long and short trades enter when breakout price levels align with FVG zones, volume or cumulative delta spikes, an active ADX trend regime, and specified session hours. Inputs adjust indicator lengths, thresholds, and trading timeframes. The strategy contains no stop loss exit rules by default.

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
Pivot strengthint5i_pivot
FVG min size (atr fraction)float0.3i_fvg_atr
RSI lengthint14i_rsi_len
Volume MA lengthint20i_vol_ma_len
Volume z thresholdfloat2.0i_vol_z
Cum-delta windowint10i_cd_sum
ADX lengthint14i_adx_len
ADX trend thresholdfloat25i_adx_thr
Active sessionsession0800-1600i_session
TimezonestringAmerica/New_Yorki_tz
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

The Judas Indicator

by regardhodler
3 stars

The Judas Indicator strategy calculates a multi-factor composite score combining Volume Profile High Volume Nodes, Cumulative Volume Delta (CVD), pivot proximity, volume absorption, order imbalance, and higher-timeframe trend EMAs. It triggers trade entries wh

Strategy v5 TrendVolume
Updated 8 months ago · None stated GitHub repository of The Judas Indicator

FilledValueGap A006

by ruckard
13 stars

This strategy enters trades in the opposite direction of filled value gaps, operating under the assumption that price action will resume the primary trend after filling a recent gap. It plots directly on the main price chart and supports MA-based trend filters

Strategy v5 SMC / ICT / price actionTrend
Updated 1 year ago · None stated GitHub repository of FilledValueGap A006
12 stars

This strategy plots on the price chart and looks for three-candle fair value gaps and inverse gaps on Bitcoin. It enters long when a wide enough bullish gap appears in an uptrend with RSI above 30 and volume above its average, and short on the opposite bearish

Strategy v6 SMC / ICT / price actionTrend Repaints
Updated 4 months ago · None stated GitHub repository of BTC 4h FVG/iFVG Strategy

This strategy identifies reversal opportunities based on liquidity sweeps and multi-gate confluence scoring. It evaluates setups using mandatory conditions such as swing sweeps, body and ATR filters, and dual EMA higher-timeframe trend alignment, alongside opt

Strategy v6 SMC / ICT / price actionTrend
Updated 3 days ago · MIT GitHub repository of Reversal Engine Score [WavesUnchained] Strategy

XXX

by MeridianAlgo
9 stars

This multi-timeframe scalping strategy plots moving averages alongside Smart Money Concepts elements on the price chart. It calculates trend signals using configurable moving average types like ALMA, Hull MA, or TEMA across alternate timeframes. It also plots

Strategy v5 TrendMoving averages Repaints
Updated 4 months ago · MIT GitHub repository of XXX

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