array.from() - Pine Script Function
array.from()
Section titled “array.from()”Overview
Section titled “Overview”The function takes a variable number of arguments with one of the types: int, float, bool, string, label, line, color, box, table, linefill, and returns an array of the corresponding type.
Syntax
Section titled “Syntax”array.from(arg0, arg1, ...) → array<type>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| arg0 | — | — |
| arg1 | — | — |
| … | <arg…_type> | Array arguments. |
Returns
Section titled “Returns”The array element’s value.
Remarks
Section titled “Remarks”- This function can accept up to 4,000 ‘int’, ‘float’, ‘bool’, or ‘color’ arguments. For all other types, including user-defined types, the limit is 999.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("array.from_example", overlay = false)arr = array.from("Hello", "World!") // arr (array<string>) will contain 2 elements: {Hello}, {World!}.plot(close)