Skip to content
Algo Trade Analytics Docs

array.new_line() - Pine Script Function

The function creates a new array object of line type elements.

array.new_line(size, initial_value) → array<line>
NameTypeDescription
sizeseries intInitial size of an array. Optional. The default is 0.

The ID of an array object which may be used in other array.*() functions.

  • An array index starts from 0.
//@version=6
indicator("array.new_line example")// draw last 15 linesvar a = array.new_line()array.push(a,
line.new(bar_index - 1, close[1], bar_index, close))
if array.size(a) > 15 ln =
array.shift(a) line.delete(ln)