array.sort() - Pine Script Function
array.sort()
Section titled “array.sort()”Overview
Section titled “Overview”The function sorts the elements of an array.
Syntax
Section titled “Syntax”array.sort(id, order) → voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id | array<int/float/string> | An array object. |
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("array.sort example")a = array.new_float(0,0)for i = 0 to 5array.push(a, high[i])array.sort(a, order.descending)if barstate.islastlabel.new(bar_index, close, str.tostring(a))