array.sum() - Pine Script Function
array.sum()
Section titled “array.sum()”Overview
Section titled “Overview”The function returns the sum of an array’s elements.
Syntax
Section titled “Syntax”array.sum(id) → series floatParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id | array<int/float> | An array object. |
Returns
Section titled “Returns”The sum of the array’s elements.
Remarks
Section titled “Remarks”- Returns na if the id array is empty.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("array.sum example")a = array.new_float(0)for i = 0 to 9array.push(a, close[i])plot(array.sum(a))