//-----------------------------------------//
//PRC_Cumulative Delta Volume (TFLab)
//version = 0
//16.07.2025
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//-----------------------------------------//
// --- Inputs
//-----------------------------------------//
CumMode=1
Period=21
//-----------------------------------------//
// --- Calculation: Delta Volume
//-----------------------------------------//
if (high-low) <>0 then
buying=volume*((close-low)/(high-low))
selling=volume*((high-close)/(high-low))
endif
delta=buying-selling
//-----------------------------------------//
// --- Calculation: Cumulative Delta Volume
//-----------------------------------------//
if CumMode=1 then
cumulative=cumsum(delta)
elsif CumMode=2 then
cumulative=summation[period](delta)
else
cumulative=average[period,1](delta)
endif
//-----------------------------------------//
// --- Plot Candles & colors
//-----------------------------------------//
if cumulative>cumulative[1] then
r=0
g=255
b=0
else
r=255
g=0
b=0
endif
drawcandle(cumulative[1],cumulative[1],cumulative,cumulative)coloured(r,g,b)
//-----------------------------------------//
return