array.copy() - Pine Script Function
array.copy()
Section titled “array.copy()”Overview
Section titled “Overview”The function creates a copy of an existing array.
Syntax
Section titled “Syntax”array.copy(id) → array<type>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id | any array type | An array object. |
Returns
Section titled “Returns”A copy of an array.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("array.copy example")length = 5a = array.new_float(length, close)b = array.copy(a)a := array.new_float(length, open)plot(array.sum(a) / length)plot(array.sum(b) / length)