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

# Fills and levels

> Drawing fixed levels with hline and shading between two plots or two levels with fill, with a plain color or a gradient.

`hline` draws a horizontal line at a price that is fixed for the whole run. `fill` shades the space between two plots or two
levels. Both stand at the top level of the script (see [Plotting](https://gocharting.com/docs/scripting/chart-output/plotting.md)).

## Levels

`hline(price, title, color, linewidth, style, display, format)`: `price` is required and is an `input` value, so a number, an
`input.*` result or a constant, never a series. `color` is `input` too, so a level cannot change color by bar. `style` is
`hlineStyle.solid`, `dashed` or `dotted`. `hline` has no `force_overlay`.

```lipi-invalid theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Moving level")
hline(close)
```

The compiler says: Cannot call `hline` with argument `price`=`close`. An argument of `series float` type was used but a `input float` is expected.

A line that follows the data is a `plot`, or a `line` drawing (see [Plots or drawings](https://gocharting.com/docs/scripting/chart-output/plots-or-drawings.md)).
`hline` returns an hline value that `fill` accepts. For a level that starts at a bar and runs on, draw `line.new(..., extend=extend.right)`, and shade between two such lines with `linefill.new` (see [Lines, labels, boxes and polylines](https://gocharting.com/docs/scripting/chart-output/drawings.md)).

## Fill between two plots

Keep both `plot` results in variables and pass them to `fill`. The arguments are `fill(p1, p2, title, color, fillgaps, display)`.

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Range band")
top = plot(high, title="High", color=color.new(color.blue, 0.8))
bottom = plot(low, title="Low", color=color.new(color.blue, 0.8))
fill(top, bottom, title="Range", color=color.new(color.blue, 0.85))
```

The `color` may be a series, so the band changes color by bar. A fill keeps a plot offset only when both plots have the same one. It follows its plots into their pane and has no `force_overlay`.

## Fill between two levels

The two-level form puts the color third and the title fourth: `fill(h1, h2, color, title, fillgaps, display)`. Name the arguments
and the order stops mattering.

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Overbought zone")
rsi = talib.rsi(close, 14)
plot(rsi, title="RSI")
upper = hline(70, title="Upper", color=color.red, style=hlineStyle.dashed)
lower = hline(30, title="Lower", color=color.green, style=hlineStyle.dashed)
fill(upper, lower, color=color.new(color.gray, 0.9), title="Band")
```

## Gradient fills

Both forms have a gradient version: `fill(p1, p2, top_value, bottom_value, top_color, bottom_color, title, display, fillgaps,
editable)` for plots (the first two names are `plot1` and `plot2` if you name them) and the same with `h1`, `h2` for levels. The
four of `top_value`, `bottom_value`, `top_color` and `bottom_color` are required; the values are numbers, the colors are series.
`editable` (default `true`) is stored with the fill. The terminal does the shading.

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Gradient band")
p = plot(high, title="High")
q = plot(low, title="Low")
fill(plot1=p, plot2=q, top_value=high, bottom_value=low, top_color=color.new(color.green, 0.6), bottom_color=color.new(color.red, 0.6))
```

## What fill does not accept

`fill` joins plot or hline results, never series and never one of each:

```lipi-invalid theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Mixed fill")
p = plot(close)
h = hline(50)
fill(p, h)
```

The compiler says: Cannot call `fill` with argument `h1`=`p`. An argument of `series plot` type was used but a `series hline` is expected. For a band between a plot and a price, plot the price with `plot(50)`.

`display` on `fill` takes only `display.none` and `display.all`. The editor accepts `display.pane`; adding the script to the chart
refuses it with: `fill()` display argument only supports display.none and display.all.


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