Skip to content
Algo Trade Analytics Docs

array.fill() - Pine Script Function

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.

array.
fill(id, value, index_from, index_to) → void
NameTypeDescription
idany array typeAn array object.
//@version=6
indicator("array.fill example")
a = array.new_float(10)array.
fill(a, close)
plot(array.sum(a))