array.fill() - Pine Script Function
array.fill()
Section titled “array.fill()”Overview
Section titled “Overview”The function sets elements of an array to a single value. If no index is specified, all elements are set. If only a start index (default 0) is supplied, the elements starting at that index are set. If both index parameters are used, the elements from the starting index up to but not including the end index (default na) are set.
Syntax
Section titled “Syntax”array.fill(id, value, index_from, index_to) → voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id | any array type | An array object. |
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("array.fill example")a = array.new_float(10)array.fill(a, close)plot(array.sum(a))