# Vex reference: Drawing

| Name | What |
| --- | --- |
| [`name`](#name) | Names the script (the legend and menus show it). where = chooses the price chart or its own pane; without it, Vex decides. |
| [`plot`](#plot) | Draws a value. The color may be a formula, picking one per bar. offset = n draws it n bars ahead (past the newest bar) or back (negative). |
| [`level`](#level) | Grey dashed horizontal lines at fixed values (numbers or settings). |
| [`fill`](#fill) | Fills between two lines: up color where a is above b, down below, unless a color is given. The color may be a formula, one per bar (a ribbon). opacity is how solid it is (default 12); a #rrggbbaa color keeps its own. |
| [`mark`](#mark) | Marks the bars where a yes/no is true. Add "and closed" to mark finished bars only. at = price puts it at a price (a label); {name} in the text shows a value; offset = -n draws it n bars back. |
| [`alert`](#alert) | Alerts when a bar closes with the condition true, while a chart running the script is open (your alert settings decide sound and notifications). {name} puts a value in the message. |
| [`bar_color`](#bar-color) | Colors the chart's candles per bar (none leaves a bar as it is). |
| [`background`](#background) | Colors behind each bar; use a see-through color (#rrggbbaa). |

## name

```vex
name("title", where = chart|pane)
```

Names the script (the legend and menus show it). where = chooses the price chart or its own pane; without it, Vex decides.

**In Pine Script:** `indicator(title, overlay = true)`

**Example**

```vex
name("EMA 21", where = chart)
plot(ema(close, 21))
```

## plot

```vex
plot(value, "title", color = c, width = 1-4, style = line|bars|dots|steps, offset = n)
```

Draws a value. The color may be a formula, picking one per bar. offset = n draws it n bars ahead (past the newest bar) or back (negative).

**In Pine Script:** `plot(series, title, color, linewidth, style, offset)`

**Example**

```vex
plot(rsi(close, 14), "RSI", color = blue, width = 2)
plot(volume, "Volume", style = bars, color = close > open ? up : down)
```

See also: [Drawing](/documentation/vex/drawing), [Colors](/documentation/vex/colors)

## level

```vex
level(a, b, ...)
```

Grey dashed horizontal lines at fixed values (numbers or settings).

**In Pine Script:** `hline(price)`

**Example**

```vex
plot(rsi(close, 14))
level(70, 50, 30)
```

## fill

```vex
fill(a, b, color = c, opacity = 0-100, offset = n)
```

Fills between two lines: up color where a is above b, down below, unless a color is given. The color may be a formula, one per bar (a ribbon). opacity is how solid it is (default 12); a #rrggbbaa color keeps its own.

With a color formula the fill is a ribbon: each stretch takes the color of the bar it starts from, as the lines do.

opacity sets how solid it is, 0 to 100 (default 12); it is also a setting on the Style tab. A #rrggbbaa color keeps its own transparency.

**In Pine Script:** `fill(plot1, plot2, color)`

**Example**

```vex
name("Ribbon", where = chart)

fast = ema(close, 9)
slow = ema(close, 21)
plot(fast)
plot(slow)
fill(fast, slow, color = fast > slow ? green : red, opacity = 35)
```

See also: [Colors](/documentation/vex/colors)

## mark

```vex
mark(condition, "text {name}", where = above|below, shape = arrow|dot, color = c, at = price, offset = -n)
```

Marks the bars where a yes/no is true. Add "and closed" to mark finished bars only. at = price puts it at a price (a label); {name} in the text shows a value; offset = -n draws it n bars back.

`at = price` puts the mark at that price: a label. `{name}` in its text shows the value on that bar, as alert messages do (up to 40 characters). `offset = -n` draws it n bars back, so a pivot found `right` bars later is labelled on its own bar.

**In Pine Script:** `plotshape(condition, text, location, style, color); label.new(x, y, text)`

**Example**

```vex
fast = ema(close, 9)
slow = ema(close, 21)
plot(fast)
plot(slow)
mark(crosses_above(fast, slow) and closed, "B", where = below)
mark(crosses_below(fast, slow) and closed, "S", where = above, shape = dot, color = orange)
```

See also: [Marks, finished bars and alerts](/documentation/vex/marks-finished-bars-and-alerts)

## alert

```vex
alert(condition, "message {name}")
```

Alerts when a bar closes with the condition true, while a chart running the script is open (your alert settings decide sound and notifications). {name} puts a value in the message.

**In Pine Script:** `alertcondition(condition, title, message)`

**Example**

```vex
fast = ema(close, 9)
slow = ema(close, 21)
plot(fast)
plot(slow)
alert(crosses_above(fast, slow), "Fast crossed above slow at {close}")
```

See also: [Marks, finished bars and alerts](/documentation/vex/marks-finished-bars-and-alerts)

## bar_color

```vex
bar_color(color)
```

Colors the chart's candles per bar (none leaves a bar as it is).

**In Pine Script:** `barcolor(color)`

**Example**

```vex
bar_color(close > ema(close, 50) ? up : down)
```

## background

```vex
background(color)
```

Colors behind each bar; use a see-through color (#rrggbbaa).

**In Pine Script:** `bgcolor(color)`

**Example**

```vex
background(rsi(close, 14) > 70 ? #ef444420 : none)
```
