> ## 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.

# yloc constants

> Reference for the 3 constants of the yloc namespace: yloc.abovebar, yloc.belowbar and yloc.price, each with its definition and an example.

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

## `yloc` (library)

**Definition**

Named constants for how label y-coordinates are interpreted: price, above the bar, or below the bar.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("yloc Example", overlay=true)
if barstate.islast {
    label.new(bar_index, high, "above", xloc=xloc.bar_index, yloc=yloc.abovebar)
    label.new(bar_index, low, "below", xloc=xloc.bar_index, yloc=yloc.belowbar)
    label.new(bar_index, close, "price", xloc=xloc.bar_index, yloc=yloc.price)
}
```

## `yloc.abovebar` (constant)

**Definition**

Vertical text alignment constant that places a label above the bar.

**Type**

`const string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("yloc.abovebar Example", overlay=true)
if barstate.islast {
    // The y value is ignored: the label sits above the bar
    label.new(bar_index, na, text="Above", yloc=yloc.abovebar, style=label.style_label_down)
}
```

## `yloc.belowbar` (constant)

**Definition**

Vertical text alignment constant that places a label below the bar.

**Type**

`const string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("yloc.belowbar Example", overlay=true)
if barstate.islast {
    // The y value is ignored: the label sits below the bar
    label.new(bar_index, na, text="Below", yloc=yloc.belowbar, style=label.style_label_up)
}
```

## `yloc.price` (constant)

**Definition**

Vertical location constant that places a label at a specific price level.

**Type**

`const string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("yloc.price Example", overlay=true)
if barstate.islast {
    label.new(bar_index, close, text="At the close", yloc=yloc.price)
}
```


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