UtilityPine Script v6

ta.cum()Cumulative Sum

Cumulative (total) sum of source. In other words it is a sum of all elements of source.

TradingView language reference

Syntax

Syntax
ta.cum(source) → series float

Arguments

ParameterTypeDescription
sourceseries int/floatSeries to accumulate.

Returns

Total sum series.

Code Examples

Pine Script v6 Example
//@version=6
indicator("ta.cum")
plot(ta.cum(close - open), title="Cumulative (close-open)")

Trading Applications

Calculate running totals of any series

Build custom cumulative indicators

Create volume-weighted cumulative metrics

Use as a building block for complex indicators

Related Functions

math.sum

Frequently Asked Questions

ta.cum(source) returns a running sum: each bar adds the current source value to the cumulative total from prior bars.

ta.cum(source) accumulates across the available bar history. math.sum(source, length) instead calculates a rolling window sum; array.sum(array) sums array elements. A cumulative total depends on where the loaded history begins.

Running totals of volume, signed returns, on-balance style constructions, or integrating a custom flow series over time.

Generate ta.cum() Code with AI

Draft Pine Script using ta.cum() with Pineify's AI Coding Agent, then review the arguments and test the result on your chart. Usage depends on your plan and available credits.