Skip to content
Algo Trade Analytics Docs

array.sum() - Pine Script Function

The function returns the sum of an array’s elements.

array.sum(id) → series float
NameTypeDescription
idarray<int/float>An array object.

The sum of the array’s elements.

  • Returns na if the id array is empty.
//@version=6
indicator("array.sum example")
a = array.new_float(0)
for i = 0 to 9
array.push(a, close[i])
plot(array.sum(a))