array.new_line() - Pine Script Function
array.new_line()
Section titled “array.new_line()”Overview
Section titled “Overview”The function creates a new array object of line type elements.
Syntax
Section titled “Syntax”array.new_line(size, initial_value) → array<line>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| size | series int | Initial size of an array. Optional. The default is 0. |
Returns
Section titled “Returns”The ID of an array object which may be used in other array.*() functions.
Remarks
Section titled “Remarks”- An array index starts from 0.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("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)