Lipi Reference
Lipi

Functions

array.copy()

Returns a new array with the same elements. Changing the copy does not change the original.

Syntax

                array.copy(series array id) → series array
              

Arguments

id required series array

Return Type

series array

Example


          //@lipi=2
indicator("array.copy Example", overlay=false)
original = array.from(3.0, 1.0, 2.0)
sorted = array.copy(original)
array.sort(sorted, order.ascending)
// original is unchanged: 3.0, 1.0, 2.0
plot(array.get(original, 0) - array.get(sorted, 0), title="3 - 1", color=color.blue)