> ## Documentation Index
> Fetch the complete documentation index at: https://gocharting.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# order constants

> Reference for the 2 constants of the order namespace: order.ascending and order.descending, each with its definition and an example.

> [!NOTE]
>
> Language version: 2 · Reference version: 2.7 · Date: 2026-10-25 · Compiler build: df7b3b14 · Namespace: order · Entries: 3

## `order` (library)

**Definition**

The two sort orders, `order.ascending` and `order.descending`, for `array.sort` and `array.sort_indices`.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("order Library Example", overlay=true)
prices = array.from(open, high, low, close)
array.sort(prices, order.descending)
plot(array.get(prices, 0), title="Highest of OHLC", color=color.green)
```

## `order.ascending` (constant)

**Definition**

Sort order from the smallest value to the largest, for `array.sort` and `array.sort_indices`.

**Type**

`const string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("order.ascending Example", overlay=false)
values = array.from(3.0, 1.0, 2.0)
array.sort(values, order.ascending)
plot(array.get(values, 0), title="Smallest (1)", color=color.blue)
```

## `order.descending` (constant)

**Definition**

Sort order from the largest value to the smallest, for `array.sort` and `array.sort_indices`.

**Type**

`const string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("order.descending Example", overlay=false)
values = array.from(3.0, 1.0, 2.0)
array.sort(values, order.descending)
plot(array.get(values, 0), title="Largest (3)", color=color.blue)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.