UtilityPine Script v6

ta.cum()Cumulative Sum

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

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() produces a time-series running total across bars. math.sum() typically sums explicit values or arrays in an expression rather than building a cumulative series over chart history.

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.