Volume Delta Indicator Development
Volume Delta (Volume Delta) — the difference between aggressive buy and aggressive sell volumes for a period. Positive delta means buyers dominated. Negative delta means sellers are more aggressive. This is one of the most informative indicators for understanding real market pressure unlike simple volume (which doesn't distinguish initiator side).
Calculation Principle
Determining Trade Side
Each trade on an exchange has an aggressor side — who was the initiator (came with market order):
def determine_trade_side(trade: dict) -> str:
"""
Binance aggTrade: m=True means buyer was maker (limit order).
So seller was aggressor (came with market sell).
"""
if trade['m'] is True:
return 'sell' # aggressive sell
else:
return 'buy' # aggressive buy
Calculating Delta for Period (Candle)
from decimal import Decimal
from collections import defaultdict
class VolumeDeltaCalculator:
def calculate_candle_delta(self, trades: list[dict]) -> CandleDelta:
buy_volume = Decimal(0)
sell_volume = Decimal(0)
for trade in trades:
qty = Decimal(str(trade['q']))
if determine_trade_side(trade) == 'buy':
buy_volume += qty
else:
sell_volume += qty
delta = buy_volume - sell_volume
total = buy_volume + sell_volume
return CandleDelta(
buy_volume=buy_volume,
sell_volume=sell_volume,
delta=delta,
total_volume=total,
delta_percent=float(delta / total * 100) if total > 0 else 0
)
Types of Delta Indicators
Bar Delta
Delta for individual candle. Displayed as histogram below price chart:
def calculate_bar_deltas(candles: list) -> list[BarDelta]:
result = []
for candle in candles:
trades = fetch_trades_for_candle(candle)
delta_data = calculator.calculate_candle_delta(trades)
result.append(BarDelta(
time=candle.open_time,
delta=float(delta_data.delta),
delta_percent=delta_data.delta_percent,
color='green' if delta_data.delta > 0 else 'red'
))
return result
Cumulative Delta (CVD)
Accumulated sum of delta from start of day or selected period:
def calculate_cvd(bar_deltas: list[BarDelta]) -> list[float]:
cvd = []
running = 0
for bar in bar_deltas:
running += bar.delta
cvd.append(running)
return cvd
CVD divergence — key signal: price rising (new highs), but CVD falling (sellers accumulating) → potential trend change.
Session Delta
Delta from start of trading session (08:00 UTC for crypto or NYSE open for related assets). Shows accumulated balance of forces for session.
Implementation as TradingView Indicator
Pine Script Implementation
//@version=5
indicator("Volume Delta", overlay=false, format=format.volume)
// Parameters
show_cvd = input.bool(true, "Show CVD")
show_bar_delta = input.bool(true, "Show Bar Delta")
// Calculation of delta through close and volume
// Accurate calculation requires tick data; approximation through candle direction:
candle_up = close >= open
delta_approx = candle_up ? volume : -volume
// Bar Delta histogram
if show_bar_delta
hline(0, color=color.gray, linewidth=1)
barcolor_delta = delta_approx >= 0 ? color.new(color.green, 40) : color.new(color.red, 40)
plot(delta_approx, style=plot.style_columns, color=barcolor_delta, title="Bar Delta")
// CVD line
cvd = ta.cum(delta_approx)
if show_cvd
plot(cvd, color=color.yellow, linewidth=2, title="CVD")
Important note: Pine Script doesn't have access to tick data, so approximation through candle direction is inaccurate. For accurate delta need custom datasource via TradingView Broker API or custom indicator.
Accurate Delta Through Custom Datasource
// Custom data series for Lightweight Charts
class DeltaDataProvider {
private tradesCache: Map<string, CandleDelta> = new Map();
async getDeltaForCandle(
symbol: string,
openTime: number,
closeTime: number
): Promise<CandleDelta> {
const cacheKey = `${symbol}_${openTime}`;
if (this.tradesCache.has(cacheKey)) {
return this.tradesCache.get(cacheKey)!;
}
const trades = await this.fetchTrades(symbol, openTime, closeTime);
const delta = this.calculate(trades);
this.tradesCache.set(cacheKey, delta);
return delta;
}
private calculate(trades: Trade[]): CandleDelta {
let buyVol = 0, sellVol = 0;
for (const t of trades) {
if (t.isBuyerMaker) {
sellVol += t.quantity; // seller was aggressor
} else {
buyVol += t.quantity;
}
}
return { buyVol, sellVol, delta: buyVol - sellVol };
}
}
Signal Interpretation
| Situation | Price | Delta | Interpretation |
|---|---|---|---|
| Bullish confirmation | Rising | Positive | Buys support rise |
| Bearish confirmation | Falling | Negative | Sells push down |
| Bullish divergence | Falling | Positive | Hidden buys — potential reversal |
| Bearish divergence | Rising | Negative | Hidden sells — trend weakness |
| Absorption | Not moving | Extreme | Large participant absorbs orders |
Delta is not standalone indicator, but confirmation tool. Combined with support/resistance levels and volume profile gives significantly more accurate signals.







