Sum
The Sum node computes the total of all non-null values in the rolling window. Unlike CumSum (which accumulates from the start of the series), Sum uses a sliding window that moves forward with each bar. It is used to accumulate volume over periods, build custom oscillators based on bar counts, and as the first step in any custom mean computation.
Algorithm
- ▸vals = non-null values in window
- ▸output = Σ vals
- ▸Returns null when no non-null values exist
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| period | number | 20 | Rolling window size. |
Inputs & Outputs
| Port | Type | Description |
|---|---|---|
| Inputs | ||
| input | number[] | Source numeric array |
| Outputs | ||
| values | number | null | Computed value at each bar; null before the warmup period completes |
| timestamps | number[] | Bar timestamps (UNIX ms), aligned 1-to-1 with values |
Use Cases
Volume Accumulation
Sum of volume over N bars measures total participation in a recent price move — high volume sum during a breakout confirms institutional involvement.
Custom Mean
Divide Sum by Count over the same period to build a custom mean that handles partial-null windows more transparently than the Average node.
Custom Oscillator
Sum of Sign(close − open) over N bars gives a count of bullish bars minus bearish bars — a simple breadth-style oscillator.