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

# box functions

> Reference for the 30 functions (31 entries with overloads) of the box namespace: box.all, box.copy, box.delete, box.get_bottom and 26 more, each with its definition and an example.

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

## `box` (library)

**Definition**

Functions for creating and mutating rectangular box drawings on the chart.

`box.new` text options use `size`, `textcolor`, `texthalign`, `textvalign`, `textwrap`, and `text_font_family`; setters keep the `box.set_text_*` names.

**Notes**

* A `box.<name>(b, ...)` function can also be called on the box as `b.<name>(...)`, for example `b.set_right(bar_index)`.

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box Library Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[20], talib.highest(high, 20), bar_index, talib.lowest(low, 20), bgcolor=color.new(color.blue, 0.15), border_color=color.blue, textcolor=color.white)
    box.set_text(b, "20-bar range")
}
```

## `box.all` (function)

**Definition**

Returns the array of all existing box objects (same as box.all).

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.all() → series array<box>
```

**Returns**

`series array<box>`

An array of box IDs, oldest to newest.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.all Example", overlay=true)
plot(array.length(box.all), title="Count")
```

## `box.copy` (function)

**Definition**

Creates a copy of a box.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.copy(series box id) → series box
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |

**Returns**

`series box`

The new box ID.

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.copy Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    c = box.copy(b)
}
```

## `box.delete` (function)

**Definition**

Deletes a box.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.delete(series box id) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.delete Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.delete(b)
}
```

## `box.get_bottom` (function)

**Definition**

Returns the bottom price of a box.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.get_bottom(series box id) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |

**Returns**

`series float`

Bottom y-coordinate.

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.get_bottom Example", overlay=true)
static box b = box(na)
if barstate.islast {
    b := box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
}
plot(na(b) ? na : box.get_bottom(b))
```

## `box.get_left` (function)

**Definition**

Returns the left x-coordinate of a box.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.get_left(series box id) → series int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |

**Returns**

`series int`

Left x-coordinate.

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.get_left Example", overlay=true)
static box b = box(na)
if barstate.islast {
    b := box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
}
plot(na(b) ? na : box.get_left(b))
```

## `box.get_right` (function)

**Definition**

Returns the right x-coordinate of a box.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.get_right(series box id) → series int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |

**Returns**

`series int`

Right x-coordinate.

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.get_right Example", overlay=true)
static box b = box(na)
if barstate.islast {
    b := box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
}
plot(na(b) ? na : box.get_right(b))
```

## `box.get_top` (function)

**Definition**

Returns the top price of a box.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.get_top(series box id) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |

**Returns**

`series float`

Top y-coordinate.

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.get_top Example", overlay=true)
static box b = box(na)
if barstate.islast {
    b := box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
}
plot(na(b) ? na : box.get_top(b))
```

## `box.new` (function, overload 1)

**Definition**

Creates a box from left/top/right/bottom coordinates, or from two chartPoint corners.

Text styling uses `size`, `textcolor`, `texthalign`, `textvalign`, `textwrap`, and `text_font_family` (typed `size` and `font` enums where noted).

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.new(series int left, series float top, series int right, series float bottom, series color border_color, series int border_width, series string border_style, series string extend, series string xloc, series color bgcolor, series string text, series size size, series color textcolor, series string texthalign, series string textvalign, series string textwrap, input font text_font_family, const bool force_overlay, series string text_formatting) → series box
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `left` | `series int` | yes | Left x-coordinate (bar index or time, depending on xloc). | | |
| `top` | `series float` | yes | Top price of the box. | | |
| `right` | `series int` | yes | Right x-coordinate (bar index or time, depending on xloc). | | |
| `bottom` | `series float` | yes | Bottom price of the box. | | |
| `border_color` | `series color` | no | Border color. Optional. Default is `#483D8B`. | | `#483D8B` |
| `border_width` | `series int` | no | Border width in pixels. Optional. | | `1` |
| `border_style` | `series string` | no | Border style (line.style\_\*). Optional. | `line.style_arrow_both`, `line.style_arrow_left`, `line.style_arrow_right`, `line.style_dashed`, `line.style_dotted`, `line.style_solid` | `line.style_solid` |
| `extend` | `series string` | no | Whether the box extends past its corners: extend.none, left, right, or both. | `extend.both`, `extend.left`, `extend.none`, `extend.right` | `extend.none` |
| `xloc` | `series string` | no | xloc.bar\_index or xloc.bar\_time. Default is bar\_index. | `xloc.bar_index`, `xloc.bar_time` | `xloc.bar_index` |
| `bgcolor` | `series color` | no | Background fill color of the box. Optional. Default is `#483D8B`. | | `#483D8B` |
| `text` | `series string` | no | Text drawn inside the box. Optional. | | `""` |
| `size` | `series size` | no | Text size inside the box (`size.auto`, `size.tiny` … `size.huge`). Optional. Default is `size.auto`. The old name `text_size` still compiles for now, with a deprecation warning. | | `size.auto` |
| `textcolor` | `series color` | no | Text color inside the box. Optional. Default is `#483D8B`. The old name `text_color` still compiles for now, with a deprecation warning. | | `#483D8B` |
| `texthalign` | `series string` | no | Horizontal text alignment: left, center, or right. Default is center. The old name `text_halign` still compiles for now, with a deprecation warning. | `text.align_left`, `text.align_center`, `text.align_right` | `text.align_center` |
| `textvalign` | `series string` | no | Vertical text alignment: top, center, or bottom. Default is center. The old name `text_valign` still compiles for now, with a deprecation warning. | `text.align_top`, `text.align_center`, `text.align_bottom` | `text.align_center` |
| `textwrap` | `series string` | no | Text wrap mode (`none` or `word`). Default is `none`. The old name `text_wrap` still compiles for now, with a deprecation warning. | `"none"`, `"word"` | `"none"` |
| `text_font_family` | `input font` | no | Font family for box text (`font.family_default` or `font.family_monospace`). Optional. Default is `font.family_default`. | | `font.family_default` |
| `force_overlay` | `const bool` | no | If true, draw on the main pane even when the script is not overlay. Default is false. | | `false` |
| `text_formatting` | `series string` | no | Text formatting (none, bold, italic). Optional. | `text.format_bold`, `text.format_italic`, `text.format_none` | `text.format_none` |

**Returns**

`series box`

The ID of the created box.

**Notes**

* The `size` argument takes a `size.*` constant (`size.auto`, `size.tiny`, `size.small`, `size.normal`, `size.large`, `size.huge`). A string such as "small" still compiles, with a deprecation warning: write the constant.
* The old names `text_color`, `text_halign`, `text_valign`, `text_size` and `text_wrap` still compile, with a deprecation warning that names the new spelling (`textcolor`, `texthalign`, `textvalign`, `size`, `textwrap`). Giving both spellings of one argument is an error. Write the new names.
* A string that is not a size name, such as "giant", stops the compiler with the error "internal validator error": write a `size.*` constant.
* The two forms have different default colors. Given `left`, `top`, `right` and `bottom`, `border_color`, `bgcolor` and `textcolor` default to `#483D8B`. Given two chartPoint corners, `border_color` and `bgcolor` default to `color.blue` and `textcolor` to `color.white`.

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.new Example", overlay=true)
if barstate.islast {
    box.new(bar_index[10], high, bar_index, low, bgcolor=color.new(color.blue, 0.8), border_color=color.blue, textcolor=color.white)
}
```

## `box.new` (function, overload 2)

**Definition**

Creates a box from left/top/right/bottom coordinates, or from two chartPoint corners.

Text styling uses `size`, `textcolor`, `texthalign`, `textvalign`, `textwrap`, and `text_font_family` (typed `size` and `font` enums where noted).

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.new(series chartPoint top_left, series chartPoint bottom_right, series color border_color, series int border_width, series string border_style, series string extend, series string xloc, series color bgcolor, series string text, series size size, series color textcolor, series string texthalign, series string textvalign, series string textwrap, input font text_font_family, const bool force_overlay, series string text_formatting) → series box
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `top_left` | `series chartPoint` | yes | Top-left corner as a chartPoint (alternative to left/top). | | |
| `bottom_right` | `series chartPoint` | yes | Bottom-right corner as a chartPoint (alternative to right/bottom). | | |
| `border_color` | `series color` | no | Border color. Optional. Default is `color.blue`. | | `color.blue` |
| `border_width` | `series int` | no | Border width in pixels. Optional. | | `1` |
| `border_style` | `series string` | no | Border style (line.style\_\*). Optional. | `line.style_arrow_both`, `line.style_arrow_left`, `line.style_arrow_right`, `line.style_dashed`, `line.style_dotted`, `line.style_solid` | `line.style_solid` |
| `extend` | `series string` | no | Whether the box extends past its corners: extend.none, left, right, or both. | `extend.both`, `extend.left`, `extend.none`, `extend.right` | `extend.none` |
| `xloc` | `series string` | no | xloc.bar\_index or xloc.bar\_time. Default is bar\_index. | `xloc.bar_index`, `xloc.bar_time` | `xloc.bar_index` |
| `bgcolor` | `series color` | no | Background fill color of the box. Optional. Default is `color.blue`. | | `color.blue` |
| `text` | `series string` | no | Text drawn inside the box. Optional. | | `""` |
| `size` | `series size` | no | Text size inside the box (`size.auto`, `size.tiny` … `size.huge`). Optional. Default is `size.auto`. The old name `text_size` still compiles for now, with a deprecation warning. | | `size.auto` |
| `textcolor` | `series color` | no | Text color inside the box. Optional. Default is `color.white`. The old name `text_color` still compiles for now, with a deprecation warning. | | `color.white` |
| `texthalign` | `series string` | no | Horizontal text alignment: left, center, or right. Default is center. The old name `text_halign` still compiles for now, with a deprecation warning. | `text.align_left`, `text.align_center`, `text.align_right` | `text.align_center` |
| `textvalign` | `series string` | no | Vertical text alignment: top, center, or bottom. Default is center. The old name `text_valign` still compiles for now, with a deprecation warning. | `text.align_top`, `text.align_center`, `text.align_bottom` | `text.align_center` |
| `textwrap` | `series string` | no | Text wrap mode (`none` or `word`). Default is `none`. The old name `text_wrap` still compiles for now, with a deprecation warning. | `"none"`, `"word"` | `"none"` |
| `text_font_family` | `input font` | no | Font family for box text (`font.family_default` or `font.family_monospace`). Optional. Default is `font.family_default`. | | `font.family_default` |
| `force_overlay` | `const bool` | no | If true, draw on the main pane even when the script is not overlay. Default is false. | | `false` |
| `text_formatting` | `series string` | no | Text formatting (none, bold, italic). Optional. | `text.format_bold`, `text.format_italic`, `text.format_none` | `text.format_none` |

**Returns**

`series box`

The ID of the created box.

**Notes**

* The `size` argument takes a `size.*` constant (`size.auto`, `size.tiny`, `size.small`, `size.normal`, `size.large`, `size.huge`). A string such as "small" still compiles, with a deprecation warning: write the constant.
* The old names `text_color`, `text_halign`, `text_valign`, `text_size` and `text_wrap` still compile, with a deprecation warning that names the new spelling (`textcolor`, `texthalign`, `textvalign`, `size`, `textwrap`). Giving both spellings of one argument is an error. Write the new names.
* A string that is not a size name, such as "giant", stops the compiler with the error "internal validator error": write a `size.*` constant.
* The two forms have different default colors. Given `left`, `top`, `right` and `bottom`, `border_color`, `bgcolor` and `textcolor` default to `#483D8B`. Given two chartPoint corners, `border_color` and `bgcolor` default to `color.blue` and `textcolor` to `color.white`.

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.new Example", overlay=true)
if barstate.islast {
    box.new(chartPoint.from_index(bar_index[10], high), chartPoint.from_index(bar_index, low), border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
}
```

## `box.set_bgcolor` (function)

**Definition**

Sets a box's background color.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_bgcolor(series box id, series color color) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |
| `color` | `series color` | yes | Color value. |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_bgcolor Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_bgcolor(b, color.new(color.green, 0.8))
}
```

## `box.set_border_color` (function)

**Definition**

Sets a box's border color.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_border_color(series box id, series color color) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |
| `color` | `series color` | yes | Color value. |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_border_color Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_border_color(b, color.black)
}
```

## `box.set_border_style` (function)

**Definition**

Sets a box's border style.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_border_style(series box id, series string style) → void
```

**Parameters**

| Name | Type | Required | Description | Values |
| - | - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. | |
| `style` | `series string` | yes | Style constant for this drawing type. | `line.style_arrow_both`, `line.style_arrow_left`, `line.style_arrow_right`, `line.style_dashed`, `line.style_dotted`, `line.style_solid` |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_border_style Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_border_style(b, line.style_dashed)
}
```

## `box.set_border_width` (function)

**Definition**

Sets a box's border width in pixels.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_border_width(series box id, series int width) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |
| `width` | `series int` | yes | Width in pixels. |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_border_width Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_border_width(b, 2)
}
```

## `box.set_bottom` (function)

**Definition**

Sets a box's bottom price.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_bottom(series box id, series float bottom) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |
| `bottom` | `series float` | yes | Bottom price of the box. |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_bottom Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_bottom(b, low)
}
```

## `box.set_bottom_right_point` (function)

**Definition**

Sets a box's bottom-right corner from a chartPoint.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_bottom_right_point(series box id, series chartPoint point) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |
| `point` | `series chartPoint` | yes | A chartPoint. |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_bottom_right_point Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_bottom_right_point(b, chartPoint.from_index(bar_index, low))
}
```

## `box.set_extend` (function)

**Definition**

Sets whether a box extends past its corners.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_extend(series box id, series string extend) → void
```

**Parameters**

| Name | Type | Required | Description | Values |
| - | - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. | |
| `extend` | `series string` | yes | extend.none, left, right, or both. | `extend.both`, `extend.left`, `extend.none`, `extend.right` |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_extend Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_extend(b, extend.none)
}
```

## `box.set_left` (function)

**Definition**

Sets a box's left x-coordinate.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_left(series box id, series int left) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |
| `left` | `series int` | yes | Left x-coordinate of the box. |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_left Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_left(b, bar_index[5])
}
```

## `box.set_lefttop` (function)

**Definition**

Sets a box's left x-coordinate and top price.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_lefttop(series box id, series int left, series float top) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |
| `left` | `series int` | yes | Left x-coordinate of the box. |
| `top` | `series float` | yes | Top price of the box. |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_lefttop Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_lefttop(b, bar_index[5], high)
}
```

## `box.set_right` (function)

**Definition**

Sets a box's right x-coordinate.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_right(series box id, series int right) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |
| `right` | `series int` | yes | Right x-coordinate of the box. |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_right Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_right(b, bar_index)
}
```

## `box.set_rightbottom` (function)

**Definition**

Sets a box's right x-coordinate and bottom price.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_rightbottom(series box id, series int right, series float bottom) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |
| `right` | `series int` | yes | Right x-coordinate of the box. |
| `bottom` | `series float` | yes | Bottom price of the box. |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_rightbottom Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_rightbottom(b, bar_index, low)
}
```

## `box.set_text` (function)

**Definition**

Sets a box's text.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_text(series box id, series string text) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |
| `text` | `series string` | yes | Text string. |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_text Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_text(b, "Zone")
}
```

## `box.set_text_color` (function)

**Definition**

Sets a box's text color.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_text_color(series box id, series color color) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |
| `color` | `series color` | yes | Color value. |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_text_color Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_text_color(b, color.white)
}
```

## `box.set_text_font_family` (function)

**Definition**

Sets a box's text font family.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_text_font_family(series box id, input font family) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |
| `family` | `input font` | yes | Font family (`font.family_default` or `font.family_monospace`). |

**Returns**

`void`

void

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_text_font_family Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, bgcolor=color.new(color.blue, 0.8))
    box.set_text_font_family(b, font.family_default)
}
```

## `box.set_text_formatting` (function)

**Definition**

Sets a box's text formatting.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_text_formatting(series box id, series string formatting) → void
```

**Parameters**

| Name | Type | Required | Description | Values |
| - | - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. | |
| `formatting` | `series string` | yes | Text formatting: `text.format_none`, `text.format_bold` or `text.format_italic`. | `text.format_bold`, `text.format_italic`, `text.format_none` |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_text_formatting Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_text_formatting(b, "bold")
}
```

## `box.set_text_halign` (function)

**Definition**

Sets a box's horizontal text alignment.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_text_halign(series box id, series string align) → void
```

**Parameters**

| Name | Type | Required | Description | Values |
| - | - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. | |
| `align` | `series string` | yes | Horizontal text alignment: `text.align_left`, `text.align_center` or `text.align_right`. | `text.align_left`, `text.align_center`, `text.align_right` |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_text_halign Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_text_halign(b, "center")
}
```

## `box.set_text_size` (function)

**Definition**

Sets a box's text size.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_text_size(series box id, series size size) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |
| `size` | `series size` | yes | Text size: a `size.*` constant. A string such as "small" still compiles, with a deprecation warning. |

**Returns**

`void`

void

**Notes**

* The `size` argument takes a `size.*` constant (`size.auto`, `size.tiny`, `size.small`, `size.normal`, `size.large`, `size.huge`). A string such as "small" still compiles, with a deprecation warning: write the constant.

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_text_size Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_text_size(b, size.normal)
}
```

## `box.set_text_valign` (function)

**Definition**

Sets a box's vertical text alignment.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_text_valign(series box id, series string align) → void
```

**Parameters**

| Name | Type | Required | Description | Values |
| - | - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. | |
| `align` | `series string` | yes | Vertical text alignment: `text.align_top`, `text.align_center` or `text.align_bottom`. | `text.align_top`, `text.align_center`, `text.align_bottom` |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_text_valign Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_text_valign(b, "center")
}
```

## `box.set_text_wrap` (function)

**Definition**

Sets whether a box's text wraps.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_text_wrap(series box id, series string wrap) → void
```

**Parameters**

| Name | Type | Required | Description | Values |
| - | - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. | |
| `wrap` | `series string` | yes | Text wrap mode (`none` or `word`). | `"none"`, `"word"` |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_text_wrap Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_text_wrap(b, "auto")
}
```

## `box.set_top` (function)

**Definition**

Sets a box's top price.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_top(series box id, series float top) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |
| `top` | `series float` | yes | Top price of the box. |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_top Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_top(b, high)
}
```

## `box.set_top_left_point` (function)

**Definition**

Sets a box's top-left corner from a chartPoint.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_top_left_point(series box id, series chartPoint point) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. |
| `point` | `series chartPoint` | yes | A chartPoint. |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_top_left_point Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_top_left_point(b, chartPoint.from_index(bar_index[10], high))
}
```

## `box.set_xloc` (function)

**Definition**

Sets whether a box's x-coordinates are bar indexes or times.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box.set_xloc(series box id, series int left, series int right, series string xloc) → void
```

**Parameters**

| Name | Type | Required | Description | Values |
| - | - | - | - | - |
| `id` | `series box` | yes | Drawing object to modify or query. | |
| `left` | `series int` | yes | Left x-coordinate of the box. | |
| `right` | `series int` | yes | Right x-coordinate of the box. | |
| `xloc` | `series string` | yes | xloc.bar\_index or xloc.bar\_time. | `xloc.bar_index`, `xloc.bar_time` |

**Returns**

`void`

void

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box.set_xloc Example", overlay=true)
if barstate.islast {
    b = box.new(bar_index[10], high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.8), textcolor=color.white)
    box.set_xloc(b, bar_index[10], bar_index, xloc.bar_index)
}
```


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