Cumulative Volume Delta
Approximate cumulative volume delta from up and down bars: volume of rising bars minus volume of falling bars, summed.
- CVD
- Built into Spectral
- Updates every tick
- Uses volume
- cumulative volume delta
- cvd
- volume delta
- buying pressure
- selling pressure
MIT-0: free to use, change and share, no attribution needed. What you build from it is yours.
Already in Spectral: add it from the Indicators toolbox. The file here is the same indicator written as a custom indicator, to change or learn from. Installed, it appears next to the built-in one, marked Custom.

Overview
Cumulative Volume Delta is a running total of the difference between buying and selling volume. Spectral's bars carry only open, high, low, close and total volume, with no split into trades at the bid and at the ask, so this indicator approximates each bar's delta from the direction of the bar: a bar that closes above its open counts its whole volume as positive, a bar that closes below its open counts it as negative, and a bar that closes at its open counts as zero.
This is an approximation, not true order-flow delta. Real delta needs tick data with the side of every trade. Treat the line as a volume-weighted measure of up bars versus down bars.
How to read it
A rising line means that volume has been concentrated in rising bars; a falling line, in falling bars. Price rising while CVD rises is a healthy move; price making a new high while CVD does not is a divergence that suggests the advance is not backed by volume, and the reverse at lows.
Because each bar is classified as a whole, a bar that rallied and then closed slightly below its open counts completely as selling. The approximation is better on small bar sizes, where a bar is closer to a single move, and weaker on large ones. It cannot show absorption, where heavy selling is met by passive buyers.
Settings and limitations
Reset chooses the starting point of the total. Session starts the total at zero on every New York trading date, so each day shows its own build-up of up or down volume (best on intraday charts). Never keeps a single total over all loaded bars, whose level depends on how much history is loaded. On daily and longer bars every bar is its own session, so use Never there.
The line has a value from the first bar. A bar without volume adds nothing.
Notes
Standard cumulative volume delta uses the volume traded at the ask minus the volume traded at the bid. TradingView offers this as Cumulative Volume Delta, computed from lower timeframe data (or tick data) inside each bar, which is more precise; this indicator does not use lower timeframe data and therefore differs, sometimes noticeably. The Session reset follows the New York calendar date, so for instruments that trade around the clock the total restarts at midnight New York time.
Settings
Each setting appears in the indicator's settings panel in Spectral, next to a color setting for every output.
| Setting | Type | Default | Range or options | What it does |
|---|---|---|---|---|
| Reset | Choice | Session | Session, Never | Session restarts the total at zero on each New York trading date; Never keeps one running total over all loaded bars. |
Presets
Each preset is its own entry in the Indicators toolbox, with these settings changed.
| Toolbox entry | Short name | Settings |
|---|---|---|
| CVD (no reset) | CVD | Reset: Never |
What it draws
Lines
- CVDsolid · 1.5 px · primary
#8AA9C3
Levels
- Zerodashed · 1 px
#8A94A3
Source
Save it as cumulative-volume-delta.js and add it with Indicators → Custom indicators → Add file…. The format is explained in the custom indicators guide.
// Copyright (c) 2026 Spectral
// SPDX-License-Identifier: MIT-0
// Free to use, copy, modify and share: https://spectral.trade/docs/custom-indicators/LICENSE.txt
/** @type {import('./spectral-indicator').IndicatorV2} */
export default {
schemaVersion: 2,
id: 'cumulative-volume-delta',
name: 'Cumulative Volume Delta',
shortName: 'CVD',
version: '1.0.0',
author: 'Spectral',
description: 'Approximate cumulative volume delta from up and down bars: volume of rising bars minus volume of falling bars, summed.',
pane: 'oscillator',
live: { lookback: 0 },
usesVolume: true,
inputs: {
reset: { type: 'select', label: 'Reset', default: 'Session', options: ['Session', 'Never'], description: 'Session restarts the total at zero on each New York trading date; Never keeps one running total over all loaded bars.' },
},
plots: {
cvd: { label: 'CVD', color: '#8AA9C3', lineWidth: 1.5, primary: true },
},
levels: {
zero: { label: 'Zero', color: '#8A94A3', lineStyle: 'dashed' },
},
presets: [
{ id: 'no-reset', name: 'CVD (no reset)', shortName: 'CVD', inputs: { reset: 'Never' } },
],
docs: {
overview: 'Cumulative Volume Delta is a running total of the difference between buying and selling volume. Spectral\'s bars carry only open, high, low, close and total volume, with no split into trades at the bid and at the ask, so this indicator approximates each bar\'s delta from the direction of the bar: a bar that closes above its open counts its whole volume as positive, a bar that closes below its open counts it as negative, and a bar that closes at its open counts as zero.\n\nThis is an approximation, not true order-flow delta. Real delta needs tick data with the side of every trade. Treat the line as a volume-weighted measure of up bars versus down bars.',
howToRead: 'A rising line means that volume has been concentrated in rising bars; a falling line, in falling bars. Price rising while CVD rises is a healthy move; price making a new high while CVD does not is a divergence that suggests the advance is not backed by volume, and the reverse at lows.\n\nBecause each bar is classified as a whole, a bar that rallied and then closed slightly below its open counts completely as selling. The approximation is better on small bar sizes, where a bar is closer to a single move, and weaker on large ones. It cannot show absorption, where heavy selling is met by passive buyers.',
settings: 'Reset chooses the starting point of the total. Session starts the total at zero on every New York trading date, so each day shows its own build-up of up or down volume (best on intraday charts). Never keeps a single total over all loaded bars, whose level depends on how much history is loaded. On daily and longer bars every bar is its own session, so use Never there.\n\nThe line has a value from the first bar. A bar without volume adds nothing.',
notes: 'Standard cumulative volume delta uses the volume traded at the ask minus the volume traded at the bid. TradingView offers this as Cumulative Volume Delta, computed from lower timeframe data (or tick data) inside each bar, which is more precise; this indicator does not use lower timeframe data and therefore differs, sometimes noticeably. The Session reset follows the New York calendar date, so for instruments that trade around the clock the total restarts at midnight New York time.',
},
calculate(ctx) {
const { bars, inputs, ta, time } = ctx;
const resetEachSession = inputs.reset === 'Session';
// The running total (and the New York date it belongs to) is carried from bar to bar by ta.scan.
const states = ta.scan(bars, { total: 0, date: '' }, (state, bar) => {
const date = resetEachSession ? time.ny(bar).dateKey : '';
let total = date === state.date ? state.total : 0;
const volume = Number(bar.volume);
const traded = Number.isFinite(volume) && volume > 0 ? volume : 0;
if (bar.close > bar.open) total += traded;
else if (bar.close < bar.open) total -= traded;
return { total, date };
});
const cvd = states.map((state) => state.total);
return { plots: { cvd }, levels: { zero: 0 } };
},
};Adapt it with an LLM
Paste this into your assistant and replace the second-to-last line with the change you want.
Start from this Spectral custom indicator: https://spectral.trade/indicators/cumulative-volume-delta.js Format reference: https://spectral.trade/docs/custom-indicators.llm.md Keep the file format and every rule of the reference; give the result a new id, name, shortName and version, and update docs and input descriptions to match. Keep its live updates exact and fast (section "Fast live updates" of the reference): carry values from bar to bar only through ctx.ta, and raise live.lookback if the change reads further back; Spectral rejects a file whose live updates differ from a full recalculation or are too slow. Change I want: <describe the change> Answer with the complete file in one code block, ready to save as <id>.js.


