# Drawing commands reference

> All 26 drawing commands in AlgoBarsX, each with its parameters, defaults, ranges and an example: plot, fill, hline, mark, label, line, box, table, bar_color, background and 16 more.

Source: https://algobarsx.com/docs/ref-cmd-drawing/

### `plot <series> [options]`

Draw a series.

#### Arguments

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `series` | series<number> | required | Values to draw. |

#### Options

| Name | Type | Default | Range | What it is |
| --- | --- | --- | --- | --- |
| `style` | string | `line` |  | line, step, area, histogram, columns, circles or cross. |
| `color` | color | `blue` |  | Color. |
| `width` | int | `1` | 1 to 10 | Line width in pixels. |
| `pane` | string | `price` |  | price, new or a named pane. |

**Where it goes** At the top level of an indicator or strategy.

```algobarsx
plot ema(close, 20) as fast, color: green, width: 2
```

Works in: strategy, indicator. Since 1.0.

### `fill <a> <b> [options]`

Fill between two plots or levels.

#### Arguments

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `a` | series<number> | required | First edge. |
| `b` | series<number> | required | Second edge. |

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `color` | color | `blue` | Color. |

**Where it goes** At the top level of an indicator or strategy.

```algobarsx
fill ema(close, 20), ema(close, 50), color: green.fade(80)
```

Works in: strategy, indicator. Since 1.0.

### `hline <value> [options]`

Horizontal level.

#### Arguments

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `value` | price | required | Level. |

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `style` | string | `dashed` | solid, dashed or dotted. |
| `color` | color | `gray` | Color. |

**Where it goes** At the top level of an indicator or strategy.

```algobarsx
hline 70, style: dashed, color: red
```

Works in: strategy, indicator. Since 1.0.

### `mark <shape> [options]`

Marker on bars where a condition is true.

#### Arguments

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `shape` | string | required | Built-in shape, emoji or SVG path. |

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `at` | string \| price | `below` | above, below or a price. |
| `when` | bool | `true` | Where to draw. |
| `color` | color | `blue` | Color. |
| `size` | string | `small` | tiny, small, normal or large. |

**Where it goes** At the top level of an indicator or strategy.

```algobarsx
mark arrow_up, at: below, when: crosses_above(close, ema(close, 20))
```

Works in: strategy, indicator. Since 1.0.

### `label <text> [options]`

Text at a bar and price.

#### Arguments

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `text` | string | required | Text. |

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `at` | tuple<bar \| time, price> | required | Bar and price. |
| `style` | string | `normal` | Label style. |
| `color` | color | `blue` | Color. |

**Where it goes** Anywhere a drawing statement is allowed.

```algobarsx
label "Entry", at: (bar.index, high)
```

Works in: strategy, indicator. Since 1.0.

### `line [options]`

Trend line or ray.

#### Options

| Name | Type | Default | Range | What it is |
| --- | --- | --- | --- | --- |
| `from` | tuple<bar \| time, price> | required |  | Start point. |
| `to` | tuple<bar \| time, price> | required |  | End point. |
| `extend` | string | `none` |  | none, left, right or both. |
| `color` | color | `blue` |  | Color. |
| `width` | int | `1` | 1 to 10 | Line width in pixels. |

**Where it goes** Anywhere a drawing statement is allowed.

```algobarsx
line from: (bar.index - 20, low), to: (bar.index, low), extend: right
```

Works in: strategy, indicator. Since 1.0.

### `box [options]`

Rectangle or zone.

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `id` | string | `automatic` | Id for updating the same box later. |
| `from` | tuple<bar \| time, price> | required | One corner. |
| `to` | tuple<bar \| time, price> | required | Opposite corner. |
| `color` | color | `blue` | Color. |
| `border` | color | `none` | Border color. |

**Where it goes** Anywhere a drawing statement is allowed.

```algobarsx
box from: (bar.index - 10, high), to: (bar.index, low), color: blue.fade(85)
```

Works in: strategy, indicator. Since 1.0.

### `table [options]`

On-chart table.

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `position` | string | `top_right` | Corner or edge of the chart. |
| `rows` | list<list<string>> | required | Cell text by row. |

**Where it goes** At the top level of an indicator or strategy.

```algobarsx
table position: top_right, rows: [["RSI", "{rsi(close, 14):0}"]]
```

Works in: strategy, indicator. Since 1.0.

### `bar_color <color>`

Recolor price bars.

#### Arguments

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `color` | color | required | Bar color. |

**Where it goes** At the top level of an indicator or strategy.

```algobarsx
bar_color if close > open then green else red
```

Works in: strategy, indicator. Since 1.0.

### `background <color> [options]`

Shade the background.

#### Arguments

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `color` | color | required | Background color. |

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `when` | bool | `true` | Where to shade. |

**Where it goes** At the top level of an indicator or strategy.

```algobarsx
background red.fade(90), when: rsi(close, 14) > 70
```

Works in: strategy, indicator. Since 1.0.

### `pane <name> [options]`

Declare a named pane shared by several plots.

#### Arguments

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `name` | string | required | Pane name. |

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `height` | percent | `25%` | Share of the chart height. |

**Where it goes** At the top level of an indicator.

```algobarsx
pane "Oscillators", height: 30%
```

Works in: strategy, indicator. Since 1.0.

### `polygon [options]`

Closed shape.

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `points` | list<tuple<bar \| time, price>> | required | Corner points. |
| `fill` | color | `none` | Fill color. |
| `border` | color | `blue` | Border color. |

**Where it goes** Anywhere a drawing statement is allowed.

```algobarsx
polygon points: [(bar.index - 5, high), (bar.index, low), (bar.index - 5, low)], fill: blue.fade(80)
```

Works in: strategy, indicator. Since 1.0.

### `polyline [options]`

Open multi-segment line.

#### Options

| Name | Type | Default | Range | What it is |
| --- | --- | --- | --- | --- |
| `points` | list<tuple<bar \| time, price>> | required |  | Points in order. |
| `color` | color | `blue` |  | Color. |
| `width` | int | `1` | 1 to 10 | Line width in pixels. |

**Where it goes** Anywhere a drawing statement is allowed.

```algobarsx
polyline points: [(bar.index - 10, low), (bar.index - 5, high), (bar.index, low)]
```

Works in: strategy, indicator. Since 1.0.

### `curve [options]`

Smoothed curve through points.

#### Options

| Name | Type | Default | Range | What it is |
| --- | --- | --- | --- | --- |
| `points` | list<tuple<bar \| time, price>> | required |  | Points in order. |
| `smooth` | number | `0.5` | 0 to 1 | Smoothing from 0 to 1. |
| `color` | color | `blue` |  | Color. |

**Where it goes** Anywhere a drawing statement is allowed.

```algobarsx
curve points: [(bar.index - 10, low), (bar.index - 5, high), (bar.index, low)], smooth: 0.5
```

Works in: strategy, indicator. Since 1.0.

### `channel [options]`

Channel between two series with a fill.

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `upper` | series<price> | required | Upper edge. |
| `lower` | series<price> | required | Lower edge. |
| `fill` | fill | `blue.fade(85)` | Fill color or gradient. |

**Where it goes** At the top level of an indicator or strategy.

```algobarsx
channel upper: bollinger(close).upper, lower: bollinger(close).lower, fill: blue.fade(85)
```

Works in: strategy, indicator. Since 1.0.

### `profile [options]`

Horizontal histogram on the price axis (volume profile, market profile).

#### Options

| Name | Type | Default | Range | What it is |
| --- | --- | --- | --- | --- |
| `rows` | int | `24` | 2 to 1000 | Price rows. |
| `range` | string | `visible` |  | visible, session or fixed. |
| `side` | string | `right` |  | left or right. |
| `value_area` | percent | `70%` |  | Value area share. |

**Where it goes** At the top level of an indicator.

```algobarsx
profile rows: 24, range: session, side: right
```

Works in: strategy, indicator. Since 1.0.

### `heatmap [options]`

Price-by-time heatmap.

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `cells` | list<Cell> | required | Cells with bar, price and value. |
| `palette` | string | `"thermal"` | Color palette. |

**Where it goes** At the top level of an indicator.

```algobarsx
heatmap cells: liquidity_cells, palette: "thermal"
```

Works in: strategy, indicator. Since 1.0.

### `cells [options]`

Cell grid inside each bar (footprint style).

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `rows` | list<list<string>> | required | Cell text by row. |
| `columns` | int | `2` | Columns per bar. |

**Where it goes** At the top level of an indicator.

```algobarsx
cells rows: footprint_rows, columns: 2
```

Works in: strategy, indicator. Since 1.0.

### `candles [options]`

Custom candles in any pane.

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `open` | series<number> | required | Open. |
| `high` | series<number> | required | High. |
| `low` | series<number> | required | Low. |
| `close` | series<number> | required | Close. |
| `color` | color | `blue` | Color. |
| `pane` | string | `new` | price, new or a named pane. |

**Where it goes** At the top level of an indicator.

```algobarsx
candles open: open - close_of(GBPUSD), high: high - close_of(GBPUSD), low: low - close_of(GBPUSD), close: close - close_of(GBPUSD)
```

Works in: strategy, indicator. Since 1.0.

### `fib [options]`

Fibonacci retracement or extension.

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `from` | tuple<bar \| time, price> | required | Swing start. |
| `to` | tuple<bar \| time, price> | required | Swing end. |
| `levels` | list<number> | `[0.236, 0.382, 0.5, 0.618, 0.786]` | Levels to draw. |

**Where it goes** Anywhere a drawing statement is allowed.

```algobarsx
fib from: (bar.index - 50, lowest(low, 50)), to: (bar.index, highest(high, 50))
```

Works in: strategy, indicator. Since 1.0.

### `pitchfork [options]`

Andrews pitchfork.

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `points` | list<tuple<bar \| time, price>> | required | Three anchor points. |

**Where it goes** Anywhere a drawing statement is allowed.

```algobarsx
pitchfork points: [(bar.index - 30, low), (bar.index - 20, high), (bar.index - 10, low)]
```

Works in: strategy, indicator. Since 1.0.

### `arrow [options]`

Arrow between two points.

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `from` | tuple<bar \| time, price> | required | Tail. |
| `to` | tuple<bar \| time, price> | required | Head. |
| `color` | color | `blue` | Color. |

**Where it goes** Anywhere a drawing statement is allowed.

```algobarsx
arrow from: (bar.index - 5, high), to: (bar.index, close)
```

Works in: strategy, indicator. Since 1.0.

### `icon <name> [options]`

Icon glyph.

#### Arguments

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `name` | string | required | Icon name. |

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `at` | tuple<bar \| time, price> | required | Bar and price. |
| `color` | color | `blue` | Color. |

**Where it goes** Anywhere a drawing statement is allowed.

```algobarsx
icon "flag", at: (bar.index, high)
```

Works in: strategy, indicator. Since 1.0.

### `image <asset> [options]`

Small image uploaded with the script.

#### Arguments

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `asset` | string | required | Asset name. |

#### Options

| Name | Type | Default | Range | What it is |
| --- | --- | --- | --- | --- |
| `at` | tuple<bar \| time, price> | required |  | Bar and price. |
| `width` | int | `24` | 4 to 512 | Width in pixels. |

**Where it goes** Anywhere a drawing statement is allowed.

```algobarsx
image "logo", at: (bar.index, high), width: 24
```

Works in: strategy, indicator. Since 1.0.

### `tooltip <text> [options]`

Hover tooltip.

#### Arguments

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `text` | string | required | Tooltip text. |

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `at` | tuple<bar \| time, price> | required | Bar and price. |

**Where it goes** Anywhere a drawing statement is allowed.

```algobarsx
tooltip "Swing high", at: (bar.index, high)
```

Works in: strategy, indicator. Since 1.0.

### `dashboard [options]`

Panel pinned to the screen that stays put while the chart scrolls.

#### Options

| Name | Type | Default | What it is |
| --- | --- | --- | --- |
| `position` | string | `top_right` | Corner or edge of the screen. |
| `rows` | list<list<string>> | required | Cell text by row. |

**Where it goes** At the top level of an indicator or strategy.

```algobarsx
dashboard position: top_right, rows: [["Trend", "up"]]
```

Works in: strategy, indicator. Since 1.0.
