Strategy · Pine Script v6 · On the chart

Tally Volume Index ROC

by pineforge-4pass· code credited to PineForge

A long-only strategy that measures the rate of change of the Negative Volume Index and Positive Volume Index over separate windows.

View on GitHub

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

39 lines of Pine Script v6 from validation/ta-tally-volume-index-roc-01/strategy.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

strategy.pine
//@version=6
// SPDX-License-Identifier: Apache-2.0
// Copyright 2026 PineForge
// PineForge Owned Strategy: Tally Volume Index ROC
// Scale-invariant NVI and PVI growth rates must jointly support the price trend.
strategy("PineForge — Tally Volume Index ROC", overlay=true,
     initial_capital=100000,
     default_qty_type=strategy.fixed, default_qty_value=2,
     pyramiding=0, commission_type=strategy.commission.percent,
     commission_value=0.05, slippage=1,
     margin_long=100, margin_short=100,
     process_orders_on_close=false, calc_on_order_fills=false)

nviGrowthLength = input.int(83, "NVI Growth Window", minval=5, group="Volume Growth")
pviGrowthLength = input.int(61, "PVI Growth Window", minval=5, group="Volume Growth")
minimumNviGrowth = input.float(0.55, "Minimum NVI Growth %", minval=-10, maxval=10, step=0.05, group="Volume Growth")
minimumPviGrowth = input.float(0.35, "Minimum PVI Growth %", minval=-10, maxval=10, step=0.05, group="Volume Growth")
trendLength = input.int(53, "Trend EMA Length", minval=5, group="Trend")
atrLength = input.int(20, "ATR Length", minval=2, group="Risk")
maximumAtrLoss = input.float(2.6, "Maximum ATR Loss", minval=0.5, step=0.1, group="Risk")

nviGrowth = ta.roc(ta.nvi, nviGrowthLength)
pviGrowth = ta.roc(ta.pvi, pviGrowthLength)
trendLine = ta.ema(close, trendLength)
atrValue = ta.atr(atrLength)

growthAgreement = nviGrowth > minimumNviGrowth and pviGrowth > minimumPviGrowth
enterLong = growthAgreement and not growthAgreement[1] and close > trendLine
growthEnded = nviGrowth < -minimumNviGrowth * 0.5 or pviGrowth < -minimumPviGrowth * 0.5 or close < trendLine
riskExceeded = strategy.position_size > 0 and close < strategy.position_avg_price - atrValue * maximumAtrLoss

if strategy.position_size == 0 and enterLong
    strategy.entry("Tally Long", strategy.long)
else if strategy.position_size > 0 and (growthEnded or riskExceeded)
    strategy.close("Tally Long", comment=riskExceeded ? "ATR risk" : "Growth ended")

plot(trendLine, "Trend EMA", color=color.orange)
plot(nviGrowth, "NVI Growth %", color=color.purple, display=display.data_window)
plot(pviGrowth, "PVI Growth %", color=color.blue, display=display.data_window)

Overview

Tally Volume Index ROC enters long when both growth rates first exceed their minimum thresholds and price is above a trend EMA. It exits when either growth turns weak, price drops below the EMA, or price falls a set multiple of ATR below entry. The trend EMA is drawn on the price chart.

Details

Published by

pineforge-4pass on GitHub

Code credit

PineForge, as written in the script's header

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Volume, Trend

Markets

Any symbol

Timeframes

Any timeframe

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
NVI Growth Windowint83nviGrowthLength
PVI Growth Windowint61pviGrowthLength
Minimum NVI Growth %float0.55minimumNviGrowth
Minimum PVI Growth %float0.35minimumPviGrowth
Trend EMA Lengthint53trendLength
ATR Lengthint20atrLength
Maximum ATR Lossfloat2.6maximumAtrLoss
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

218 stars

This strategy enters long when a faster moving average crosses above a slower one and short when it crosses below, unless long-only mode is on. An optional volume filter requires volume above a 20-bar average times a multiplier. Exits use a percentage stop los

Strategy v6 TrendMoving averages
Updated 3 months ago · None stated GitHub repository of MA Cross Strategy Template
106 stars

This Pine Script strategy identifies potential Buy Today, Sell Tomorrow (BTST) opportunities based on price action and volume patterns. It calculates a 20-period simple moving average of volume and checks for three consecutive bullish candles with higher highs

Strategy v4 TrendVolume
Updated 2 years ago · GPL-3.0 GitHub repository of 3 Higher High Price & Vol
23 stars

This strategy evaluates breakout and trend opportunities on the price chart using a weighted composite score of volume, trend, and candlestick structure. It tracks volume spikes, fast and slow EMAs, higher-timeframe EMA trend alignment, opening ranges, and ses

Strategy v6 TrendVolume Repaints
Updated 3 weeks ago · Custom licence GitHub repository of TradingAlpha Point-Clip Strategy

This strategy enters long or short when eight conditions align over the last two bars. It requires EMA 10 and EMA 55 alignment on the one-hour, four-hour and daily charts, a positive ADX slope, matching monitor direction, and price relative to a 400-bar point

Strategy v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ruckard ABCBitcoin TradingLatino B002
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

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