array.reverse() - Pine Script Function
array.reverse()
Section titled “array.reverse()”Overview
Section titled “Overview”The function reverses an array. The first array element becomes the last, and the last array element becomes the first.
Syntax
Section titled “Syntax”array.reverse(id) → voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id | any array type | An array object. |
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("array.reverse example")a = array.new_float(0)for i = 0 to 9array.push(a, close[i])plot(array.get(a, 0))array.reverse(a)plot(array.get(a, 0))