Docs·TapeScript

Drawing

Draw TapeScript output on the tick heatmap — lines in price space or a pane under it, labelled markers, shaded zones and horizontal levels.

A script draws lines with series, markers with marker, shaded zones with box and horizontal levels with hline. All of them are positioned by time and price and move with the heatmap when you scroll or zoom.

series()

JavaScript
const vwapLine = series("VWAP", { color: "#D4A60A" })
const cvdLine  = series("CVD",  { pane: "bottom", color: "#0ECB81" })

function onInterval(time) {
  vwapLine.add(time, vw.value)
  cvdLine.add(time, cvd)
}

series(name, options) creates a line. line.add(time, value) adds a point. Lines must be created at the top level; calling series() in a callback is an error.

OptionValuesDefault
pane"main": on the heatmap, value is a price. "bottom": in the script's pane under the heatmap."main"
color"#RRGGBB", "#RRGGBBAA", "rgb(…)", "rgba(…)"Chart accent color

Use "main" for prices (VWAP, bands). Use "bottom" for other values (delta, ratios, equity).

Add points in time order. A point earlier than the previous one starts the line again.

Script pane

A script that draws a "bottom" line gets its own pane under the heatmap. Each script has a separate pane and Y axis. All "bottom" lines of a script share its pane. The pane shows each line's name and latest value.

ActionResult
Drag the top edge of the paneResize; the height is saved per script
Mouse wheel or drag on the pane's Y axisZoom or scroll the Y axis
Double-click the paneReset the Y axis to auto-fit

The pane is removed when the script stops or is hidden.

marker()

JavaScript
marker(time, price, "ABS")
marker(time, price, "S 12.5", "#F6465D")

marker(time, price, text, color) draws a diamond at the given time and price with a label above it. The label is cut to 24 characters. color is optional. Use "" for no label.

box()

JavaScript
box(start, low, time, high, "ABSORB", "rgba(14, 203, 129, 0.18)")

box(time1, price1, time2, price2, text, color) shades the area between two times and two prices. The corners can be given in any order. text is optional and is shown in the top-left corner when the box is large enough.

The box is filled only, without an outline. Its color, including the alpha in rgba(…) or #RRGGBBAA, sets how strong the shade is. Without a color the box uses a light shade of the chart accent.

To shade one row of the heatmap, use book.tick for its height:

JavaScript
box(time, price - book.tick / 2, time + 250, price + book.tick / 2, "", "rgba(240, 70, 93, 0.35)")

hline()

JavaScript
// @input minWall: float = 200 "Min wall size"

let wall = null

function onDepth(side, price, size, time) {
  if (side === BID && size >= input.minWall && !wall) wall = hline(price, "WALL " + size)
  if (wall && price === wall.price && size === 0) { wall.stop(); wall = null }
}

hline(price, text, color) draws a horizontal line that starts at the current time and runs to the right edge of the heatmap while the market moves. It returns a line:

MemberResult
line.pricePrice of the line
line.activetrue while the line still runs to the right edge
line.move(price)Moves the line to another price
line.stop(time)Ends the line at time (now if omitted). The line stays on the chart.
line.remove()Deletes the line from the chart

A script can have up to 200 running lines at once. A stopped line does not count. When a script draws many lines over time, the oldest stopped ones are removed from the chart first.

Long sessions

The oldest points, markers, zones and lines are removed from the chart as new ones are added. To reduce the number of points, add them from onInterval instead of on every trade.

Hide and remove

  • A run started from the widget: Stop removes its drawings.
  • A released script: the eye icon in the legend hides its drawings and pane; the X removes it from the chart. See Release as an indicator.