Lipi Reference
Lipi

Functions

array.fill()

Sets elements of the array to `value`. With no index arguments every element is set; `index_from` and `index_to` limit the change to a range, where `index_to` is not included.

Syntax

                array.fill(series array id, series <type of the array's elements> value, series int index_from, series int index_to) → void
              

Arguments

id required series array
value required series
index_from series int
index_to series int

Return Type

void

Example


          //@lipi=2
indicator("array.fill Example", overlay=true)
values = array.new<float>(5)
array.fill(values, 0.0)
// Set elements 1 and 2 to the close
array.fill(values, close, 1, 3)
plot(array.sum(values), title="Sum (2 x close)", color=color.blue)