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

# linefill functions

> Reference for the 6 functions of the linefill namespace: linefill.all, linefill.delete, linefill.get_line1, linefill.get_line2 and 2 more, each with its definition and an example.

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

## `linefill` (library)

**Definition**

Functions for filling the region between two line drawings. One fill per ordered line pair; creating another fill on the same pair replaces the previous one. Deleting a line also deletes fills that use it.

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("linefill Library Example", overlay=true)
if barstate.islast {
    upper = line.new(bar_index[20], talib.highest(high, 20), bar_index, talib.highest(high, 20), color=color.green)
    lower = line.new(bar_index[20], talib.lowest(low, 20), bar_index, talib.lowest(low, 20), color=color.red)
    linefill.new(upper, lower, color.new(color.gray, 0.2))
}
```

## `linefill.all` (function)

**Definition**

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

**Syntax**

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

**Returns**

`series array<linefill>`

An array of linefill IDs, oldest to newest.

**Example**

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

## `linefill.delete` (function)

**Definition**

Deletes a linefill. Does not delete the two lines it was attached to. Deleting either line also deletes attached fills.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series linefill` | yes | Linefill object to delete. |

**Returns**

`void`

void

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("linefill.delete Example", overlay=true)
if barstate.islast {
    l1 = line.new(bar_index[10], high[10], bar_index, high)
    l2 = line.new(bar_index[10], low[10], bar_index, low)
    f = linefill.new(l1, l2, color.new(color.blue, 0.7))
    linefill.delete(f)
}
```

## `linefill.get_line1` (function)

**Definition**

Returns the first line used when the fill was created.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series linefill` | yes | Linefill object. |

**Returns**

`series line`

The first line object, or na if the fill or line no longer exists.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("linefill.get_line1 Example", overlay=true)
if barstate.islast {
    l1 = line.new(bar_index[10], high[10], bar_index, high)
    l2 = line.new(bar_index[10], low[10], bar_index, low)
    f = linefill.new(l1, l2, color.new(color.blue, 0.7))
    line.set_color(linefill.get_line1(f), color.green)
}
```

## `linefill.get_line2` (function)

**Definition**

Returns the second line used when the fill was created.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series linefill` | yes | Linefill object. |

**Returns**

`series line`

The second line object, or na if the fill or line no longer exists.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("linefill.get_line2 Example", overlay=true)
if barstate.islast {
    l1 = line.new(bar_index[10], high[10], bar_index, high)
    l2 = line.new(bar_index[10], low[10], bar_index, low)
    f = linefill.new(l1, l2, color.new(color.blue, 0.7))
    line.set_color(linefill.get_line2(f), color.red)
}
```

## `linefill.new` (function)

**Definition**

Creates a fill between two lines. If a fill already exists for this ordered pair (line1, line2), the previous fill is deleted and replaced. (line2, line1) is a different pair.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
linefill.new(series line line1, series line line2, series color color) → series linefill
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `line1` | `series line` | yes | First line object. The fill tracks this line's current points. | |
| `line2` | `series line` | yes | Second line object. The fill tracks this line's current points. | |
| `color` | `series color` | no | Fill color. Optional. Default is na. | `na` |

**Returns**

`series linefill`

The ID of the created linefill, or na if either line is invalid.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("linefill.new Example", overlay=true)
if barstate.islast {
    l1 = line.new(bar_index[20], high[20], bar_index, high, color=color.green)
    l2 = line.new(bar_index[20], low[20], bar_index, low, color=color.red)
    f = linefill.new(l1, l2, color.new(color.blue, 0.7))
}
```

## `linefill.set_color` (function)

**Definition**

Sets the fill color of an existing linefill.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series linefill` | yes | Linefill object. |
| `color` | `series color` | yes | New fill color. |

**Returns**

`void`

void

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("linefill.set_color Example", overlay=true)
if barstate.islast {
    l1 = line.new(bar_index[10], high[10], bar_index, high)
    l2 = line.new(bar_index[10], low[10], bar_index, low)
    f = linefill.new(l1, l2, color.new(color.blue, 0.7))
    linefill.set_color(f, color.new(color.orange, 0.7))
}
```


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