Skip to content
Algo Trade Analytics Docs

math.sum() - Pine Script Function

The sum function returns the sliding sum of last y values of x.

math.sum(source, length) → series float
NameTypeDescription
sourceseries int/floatSeries of values to process.

Sum of source for length bars back.

  • na values in the source series are ignored; the function calculates on the length quantity of non-na values.