Returns the running total of source from the first bar to the current one.
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
ta.cum(source: series int/float) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| source | series int/ | required | The 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.obvandta.accdistare cumulative sums of a per-bar term, and plottingta.cum(volume)gives total volume traded on the loaded bars.- To total over a fixed window use
math.sum.
Example
//@version=6
indicator("Cumulative signed volume")
signed = close >= open ? volume : -volume
plot(ta.cum(signed), "Cumulative", color = color.blue)See also
Runs on Sidechair