Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Volume Difference Delta Cycle Oscillator

A Pine Script v5 strategy built on Change (src), CUM and PVT. It has 4 order rules, 2 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 100% of equity and pays no commission. 19 settings; defaults include Start Date 1, Start Month 1 and Start Year 2010.

Generated from the script's code by a template: every clause is a fact read from the source. Not written by a person or a model, and not taken from the author's description.

Does Volume Difference Delta Cycle Oscillator repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did Volume Difference Delta Cycle Oscillator do on BTCUSDT 1D with default settings?
Not measured
It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its code limits trading to a date window, which can leave this period out. It closed no trades on the other markets either. A backtest, not investment advice.
Does Volume Difference Delta Cycle Oscillator run in Pine Script v6?
Not tested
Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download.
Does Volume Difference Delta Cycle Oscillator use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Volume Difference Delta Cycle Oscillator run in Zeal Terminal?
Yes
It compiles in 25 ms and runs 1,000 bars in 57 ms, in the browser.

BTCUSDT · 1D · default settings

  • HLine
  • HLine
  • Histogram
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (19)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctHLine$1,000,000$2,025,273Equity from $1,000,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. Lines are what the script plots.
Net profit
0.00%
$0.00
Buy and hold
+102.5%
same period
Closed trades
0
0 won · 0 lost
Profitable
0.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
0.00%
$0.00

One run with the author's default settings, $1,000,000 starting capital, commission as the script sets it. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.

Review

What a careful reader of this script would point out, found by checking the source and the backtest.

  • Likely bug

    ta.ema(normalize(result, -1, 1), 20) ignores the settings line 40

    Line 40 hard-codes 20 where line 44 uses “Volume Bands Length”. Changing those settings moves one band but not this one.

    ta.ema(normalize(result, -1, 1), 20)ta.ema(normalize(result, -1, 1), length)
  • Check

    No stop loss

    Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.

  • Check

    No commission

    The backtest assumes free trading. Results on any real exchange will be lower.

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    2 settings have no label

    In the settings dialog oversold (line 61), overbought (line 62) show an empty name. The labels on this page come from the variable names.

  • Note

    No slippage

    Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.

  • Note

    Uses an argument v6 removed

    when = on line 75, 77, 79, 81. The upgraded version below moves each call inside an if block.

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

SettingDefaultType and rangeFeeds
Start Date1int · min 1 · max 31inDateRange
Start Month1int · min 1 · max 12inDateRange
Start Year2010int · min 1800 · max 2100inDateRange
End Date31int · min 1 · max 31inDateRange
End Month12int · min 1 · max 12inDateRange
End Year2021int · min 1800 · max 2100inDateRange
Long Stop Loss %2.0floatl_stop_level
Long Take Profit %4.0floatl_take_level
Short Stop Loss %2.0floats_stop_level
Short Take Profit %4.0floats_take_level
Volume Bands Length20int · min 1basis dev
Volume Bands StdDev2.0float · min 0.001 · max 50dev
Bollinger Bands Length20int · min 1basis1 dev1
Bollinger Bands StdDev2.0float · min 0.001 · max 50dev1
Hist Smoothing Factor #12intshort long histColor Histogram
Hist Smoothing Factor #22intshort long histColor Histogram
Hist Smoothing Factor #32intshort long histColor Histogram
Oversold (no label in the script)-.1floatlong hline
Overbought (no label in the script).4floatshort hline

What it calculates

  • Changesrcchange_src · line 36
  • CUMchange_src > 0 ? volume : change_src < 0 ? -volume : 0 * volumei_obv · line 37
  • PVTi_pvt · line 38
  • Changei_obv - i_pvtresult · line 39
  • EMAnormalize(result, -1, 1), 20nresult · line 40
  • EMAnresult, Volume Bands Length (20)basis · line 44
  • Stdevnresult, Volume Bands Length (20)dev · line 45
  • SMAsrc2, Bollinger Bands Length (20)basis1 · line 53
  • Stdevsrc2, Bollinger Bands Length (20)dev1 · line 54

Signal flow

How price data and settings reach the orders. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.

volumevolumeprice datalengthVolume Bands Lengthsetting · 20multVolume Bands StdDevsetting · 2.0l1Bollinger Bands Lengthsetting · 20mult1Bollinger Bands StdDevsetting · 2.0l_sl_inpLong Stop Loss %setting · 2.0l_tp_inpLong Take Profit %setting · 4.0s_sl_inpShort Stop Loss %setting · 2.0s_tp_inpShort Take Profit %setting · 4.0closecloseprice datatimetimeprice datastartYearStart Yearsetting · 2010startMonthStart Monthsetting · 1startDateStart Datesetting · 1endYearEnd Yearsetting · 2021endMonthEnd Monthsetting · 12endDateEnd Datesetting · 31histHist Smoothing Factor #3setting · 2overboughtOverboughtsetting · .4oversoldOversoldsetting · -.1change_srcChange→ change_srci_obvCUM→ i_obvi_pvtPVT→ i_pvtresultChange→ resultnresultEMA→ nresultbasisEMA→ basisdevStdev→ devbasis1SMA→ basis1dev1Stdev→ dev1_historicMin_historicMinvalue_historicMax_historicMaxvaluel_stop_levell_stop_levelvaluel_take_levell_take_levelvalues_stop_levels_stop_levelvalues_take_levels_take_levelvaluesrc, src2src · src22 valuesupper, lowerupper · lower2 valuesbbrbbrvalueupper1, lower1upper1 · lower12 valuesbbr1bbr1valueinDateRangeinDateRangeconditionshortshortconditionlonglongconditionhistColor, CrossBgColorColourhistColor · CrossBgColorentry:longOpen longstrategy.entryclose_all:close_all strategy.close_allentry:shortOpen shortstrategy.entryhline:63hlinehlinehline:64hlinehlineplot:70Histogramplotbgcolor:72bgcolorbgcolor

Order rules

OrderFires whenBy defaultLine
Open long longlonghist < oversoldOn75
Close shorthist > overboughtOn77
Open short shortshorthist > overboughtOn79
Close longhist < oversoldOn81

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Does it repaint?

No

No repainting patterns in the source.

Not measuredNo trades to compareThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, but neither the live nor the historical run produced any trades in them, so the replay says nothing either way.
  • ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
  • ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.

The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.

Other markets

The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D0.0%+102.5%00%—0.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h0.0%+5.5%00%—0.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D0.0%+9.8%00%—0.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h0.0%+8.4%00%—0.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D0.0%+16.7%00%—0.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h0.0%+21.5%00%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D0.0%+148.3%00%—0.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h0.0%+17.1%00%—0.0%8 May 2026 – 21 Oct 2026

Backtests are simulations on historical data and are not investment advice.

Similar scripts

Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.

ScriptSharesTypeNetTradesMax drawdown
Volume Difference Delta Cycle Oscillator this page—v5 strategy0.0%00.0%
BB+RSI+OBV by atakhadivicum sma stdevv4 strategy+52.5%7129.3%
Volume Weighted Bollinger Bands Strategy by Ankit_1618ema sma stdevv4 strategy+10.0%1527.5%
BB21_MA200_Strategy by mohaneeema sma stdevv4 strategyNo trades on this market
Super Breakout day trading by beststockalertstdev sma emav4 strategyNo trades on this market
Super Auto Breakout Day Trade Volatile stocks by beststockalertstdev sma emav4 strategy−6.1%5129.1%

Upgrade and export

Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.

  • 4 strategy calls use the when = argument (line 75, 77, 79, 81). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • 9 settings use the untyped input() (line 26, 27, 30, 31, 59, 59, 59, 61, 62). It still compiles in v6; input.int, input.float or input.source state the type.
  • No v6-only features. v6 is not needed to run this script.

Clean v5

Not verified

Neither version placed a trade on any of the 8 markets, so there was nothing to compare.

  • Line 26: input() → input.float()
  • Line 27: input() → input.float()
  • Line 30: input() → input.float()
  • Line 31: input() → input.float()
  • Line 59: input() → input.int()
  • Line 59: input() → input.int()
7 more edits
  • Line 59: input() → input.int()
  • Line 61: input() → input.float()
  • Line 62: input() → input.float()
  • Line 75: when = long → if block
  • Line 77: when = short → if block
  • Line 79: when = short → if block
  • Line 81: when = long → if block
⋯// Stop loss & Take Profit Section     -l_sl_inp = input(2.0, title='Long Stop Loss %') / 100+l_sl_inp = input.float(2.0, title='Long Stop Loss %') / 100-l_tp_inp = input(4.0, title='Long Take Profit %') / 100+l_tp_inp = input.float(4.0, title='Long Take Profit %') / 100l_stop_level = strategy.position_avg_price * (1 - l_sl_inp)l_take_level = strategy.position_avg_price * (1 + l_tp_inp)-s_sl_inp = input(2.0, title='Short Stop Loss %') / 100+s_sl_inp = input.float(2.0, title='Short Stop Loss %') / 100-s_tp_inp = input(4.0, title='Short Take Profit %') / 100+s_tp_inp = input.float(4.0, title='Short Take Profit %') / 100s_stop_level = strategy.position_avg_price * (1 + s_sl_inp)⋯/// Final Output Line-hist = ta.ema(ta.ema(ta.ema(bbr1 - bbr, input(2, title='Hist Smoothing Factor #1')), input(2, title='Hist Smoothing Factor #2')), input(2, title='Hist Smoothing Factor #3'))+hist = ta.ema(ta.ema(ta.ema(bbr1 - bbr, input.int(2, title='Hist Smoothing Factor #1')), input.int(2, title='Hist Smoothing Factor #2')), input.int(2, title='Hist Smoothing Factor #3'))/// Overbought / Oversold Line Creation-oversold = input(-.1)+oversold = input.float(-.1)-overbought = input(.4)+overbought = input.float(.4)hline(oversold, linewidth=2, color=color.new(#81c784, 62))⋯if inDateRange-    strategy.entry('long', strategy.long, when=long, stop=l_stop_level, limit=l_take_level)+    if long+        strategy.entry('long', strategy.long, stop=l_stop_level, limit=l_take_level)if inDateRange and strategy.position_size > 0-    strategy.close_all(when=short)+    if short+        strategy.close_all()if inDateRange-    strategy.entry('short', strategy.short, when=short, stop=s_stop_level, limit=s_take_level)+    if short+        strategy.entry('short', strategy.short, stop=s_stop_level, limit=s_take_level)if inDateRange and strategy.position_size < 0-    strategy.close_all(when=long)+    if long+        strategy.close_all()

Does it run in Pine Script v6?

Not tested

Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © tathal and special thanks to oakwhiz for his porting of my custom volume indicator-//@version=5+//@version=6strategy('Volume Difference Delta Cycle Oscillator', 'VDDC Osc', default_qty_type=strategy.percent_of_equity, default_qty_value=100, max_bars_back=5000)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 25 msYes 1,000 bars in 57 msNot measured
PineTSNot testedNot testedNot measured

“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report.

Source

Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.

//// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © tathal and special thanks to oakwhiz for his porting of my custom volume indicator//@version=5strategy('Volume Difference Delta Cycle Oscillator', 'VDDC Osc', default_qty_type=strategy.percent_of_equity, default_qty_value=100, max_bars_back=5000)startDate = input.int(title='Start Date', defval=1, minval=1, maxval=31)startMonth = input.int(title='Start Month', defval=1, minval=1, maxval=12)startYear = input.int(title='Start Year', defval=2010, minval=1800, maxval=2100)endDate = input.int(title='End Date', defval=31, minval=1, maxval=31)endMonth = input.int(title='End Month', defval=12, minval=1, maxval=12)endYear = input.int(title='End Year', defval=2021, minval=1800, maxval=2100)// Normalize Functionnormalize(_src, _min, _max) =>    // Normalizes series with unknown min/max using historical min/max.    // _src      : series to rescale.    // _min, _min: min/max values of rescaled series.    var _historicMin = 10e10    var _historicMax = -10e10    _historicMin := math.min(nz(_src, _historicMin), _historicMin)    _historicMax := math.max(nz(_src, _historicMax), _historicMax)    _min + (_max - _min) * (_src - _historicMin) / math.max(_historicMax - _historicMin, 10e-10)// STEP 2:// Look if the close time of the current bar// falls inside the date rangeinDateRange = time >= timestamp(syminfo.timezone, startYear, startMonth, startDate, 0, 0) and time < timestamp(syminfo.timezone, endYear, endMonth, endDate, 0, 0)// Stop loss & Take Profit Section     l_sl_inp = input(2.0, title='Long Stop Loss %') / 100l_tp_inp = input(4.0, title='Long Take Profit %') / 100l_stop_level = strategy.position_avg_price * (1 - l_sl_inp)l_take_level = strategy.position_avg_price * (1 + l_tp_inp)s_sl_inp = input(2.0, title='Short Stop Loss %') / 100s_tp_inp = input(4.0, title='Short Take Profit %') / 100s_stop_level = strategy.position_avg_price * (1 + s_sl_inp)s_take_level = strategy.position_avg_price * (1 - s_tp_inp)src = close//  Volume Differnce Indicator Deltafloat change_src = ta.change(src)float i_obv = ta.cum(change_src > 0 ? volume : change_src < 0 ? -volume : 0 * volume)float i_pvt = ta.pvtfloat result = ta.change(i_obv - i_pvt)float nresult = ta.ema(normalize(result, -1, 1), 20)// Volume Differnce Indicator Delta %Blength = input.int(20, minval=1, title='Volume Bands Length')mult = input.float(2.0, minval=0.001, maxval=50, title='Volume Bands StdDev')basis = ta.ema(nresult, length)dev = mult * ta.stdev(nresult, length)upper = basis + devlower = basis - devbbr = (nresult - lower) / (upper - lower)// Normal %B, Based on closel1 = input.int(20, minval=1, title='Bollinger Bands Length')src2 = closemult1 = input.float(2.0, minval=0.001, maxval=50, title='Bollinger Bands StdDev')basis1 = ta.sma(src2, l1)dev1 = mult1 * ta.stdev(src2, l1)upper1 = basis1 + dev1lower1 = basis1 - dev1bbr1 = (src - lower1) / (upper1 - lower1)/// Final Output Linehist = ta.ema(ta.ema(ta.ema(bbr1 - bbr, input(2, title='Hist Smoothing Factor #1')), input(2, title='Hist Smoothing Factor #2')), input(2, title='Hist Smoothing Factor #3'))/// Overbought / Oversold Line Creationoversold = input(-.1)overbought = input(.4)hline(oversold, linewidth=2, color=color.new(#81c784, 62))hline(overbought, linewidth=2, color=color.new(#c2185b, 38))/// Long & Short Conditionsshort = hist > overboughtlong = hist < oversold/// Colors & PlottinghistColor = hist >= 0 ? hist[1] < hist ? #26A69A : #B2DFDB : hist[1] < hist ? #FFCDD2 : #EF5350plot(hist, title='Histogram', style=plot.style_columns, color=color.new(histColor, 0))CrossBgColor = long ? color.new(#81c784, 62) : short ? color.new(#c2185b, 38) : nabgcolor(color.new(CrossBgColor, 90))/// Strategy Methodologyif inDateRange    strategy.entry('long', strategy.long, when=long, stop=l_stop_level, limit=l_take_level)if inDateRange and strategy.position_size > 0    strategy.close_all(when=short)if inDateRange    strategy.entry('short', strategy.short, when=short, stop=s_stop_level, limit=s_take_level)if inDateRange and strategy.position_size < 0    strategy.close_all(when=long)