math.sum() - Pine Script Function
math.sum()
Section titled “math.sum()”Overview
Section titled “Overview”The sum function returns the sliding sum of last y values of x.
Syntax
Section titled “Syntax”math.sum(source, length) → series floatParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| source | series int/float | Series of values to process. |
Returns
Section titled “Returns”Sum of source for length bars back.
Remarks
Section titled “Remarks”- na values in the source series are ignored; the function calculates on the length quantity of non-na values.