Sidechair

ta.cum()

Browse the reference

Returns the running total of source from the first bar to the current one.

Try it in the editor

ta.cum adds the current value of source to the total of all earlier bars. The total starts at the first bar and never resets.

If source is na on a bar, that bar's total is na, and the total restarts from zero on the next bar with a value.

Syntax

Pine Script
ta.cum(source: series int/float) -> series float

Arguments

NameTypeDefaultDescription
sourceseries int/floatrequiredThe series added up bar by bar into a running total that starts on the first bar.

Returns

series float: the cumulative sum of source, bar by bar.

Remarks

  • ta.obv and ta.accdist are cumulative sums of a per-bar term, and plotting ta.cum(volume) gives total volume traded on the loaded bars.
  • To total over a fixed window use math.sum.

Example

Pine ScriptCumulative volume delta proxyOpen in editor
//@version=6
indicator("Cumulative signed volume")
signed = close >= open ? volume : -volume
plot(ta.cum(signed), "Cumulative", color = color.blue)

See also

Runs on Sidechair