cumsum

Running total from start of data

cumsum(source)

Parameters

Name Type Description
source field Data series to accumulate (can be any numeric expression)

Formula

```
cumsum[n] = source[0] + source[1] + source[2] + ... + source[n]

where source[0] is the oldest bar in the series
```

Examples

// lifetime volume exceeds 1 billion shares
cumsum(volume) > 1B;
// more lifetime gains than losses (long-term uptrend)
cumsum(gain(close)) > cumsum(loss(close));
// stocks with at least 100 bullish days in history
cumsum(cond(close > open, 1, 0)) >= 100;
// net change from first recorded price
cumsum(change(close, 1)) > 0;

Returns

Float (running total from start of available data) ## Notes **Warning:** This function scans the entire price history for each symbol, making it computationally expensive. Use additional filters (price, volume, exchange) to limit the symbol universe, or the scan may time out. - Unlike sum(source, n) which uses a rolling window of N bars, cumsum() has no period parameter and always accumulates from the start of data - The result grows continuously; for monotonic series like volume, cumsum is always increasing - Combine with cond() to count occurrences of any boolean condition