Show what a script found. Plots are declared at the top and set in the chart’s handlers; drawings and tables are objects a handler creates and changes.
Plots
set(value, color) sets the current bar; a plot not set on a bar is na there, and a line breaks across it unless it says join: true. A colour left out, or null, follows the theme’s study palette. Up to 64 plots.
Panes and scales
An overlay script (indicator(name, { overlay: true })) draws on the price pane; any other draws in a pane of its own. A plot can choose with pane: 'price', 'own', or a name, which gives the script another pane.
autoscale: false draws a plot at its values without stretching the scale, for levels far from the price.
range: { min: 0, max: 100 } fixes the scale, as an RSI’s.
band: { top: 0.84, bottom: 0 } draws the plot on a hidden scale in a slice of the pane, such as volume at its foot.
offset shifts a plot by whole bars, -500 to 500: positive draws into the space past the newest bar, like Ichimoku’s leading spans.
Shapes and markers
plot.shape draws a shape, a label or a character on the bars where set(condition) is true, at a fixed location. plot.markers adds any number of markers to a bar, each with its own position, shape, text and colour:
Drawings
draw.line, draw.box, draw.label, draw.polyline and draw.linefill place objects at times or bar numbers and prices, up to 500 bars into the future. They are made in the chart’s handlers, and a drawing made while the forming bar updates is rolled back with it. Each kind is capped, 50 by default and at most 500 (maxLines and the others in indicator’s options), with the oldest removed first.
A common pattern draws only on the newest bar, with the cap set to what one bar draws, so each bar’s drawings replace the last’s:
Tables
draw.table({ position, columns, rows }) puts a table in one of nine positions of the script’s pane, clear of the legend and the price axis; it may be made at the top. cell(column, row, text, options) writes a cell, with colours, size, alignment and a tooltip; merge spans cells. Write the cells on the newest bar only (chart.isLast). Text is shown as text: no markup, links or images, at most 500 characters. Up to 9 tables.
Text and colour
fmt.price(x) writes a price to the market’s precision; fmt.usd(x) writes $1.2M; fmt.pct(0.0123) writes 1.23%; fmt.num and fmt.compact the rest.
color.up, color.down, color.neutral and color.panel are the theme’s, and color.study(i) its study palette, so a script follows the reader’s theme. color.withAlpha(c, a), color.mix(a, b, t) and color.rgb make others.
Alerts
alert(name, { message }) declares an alert at the top, which the reader arms on the chart; fire(condition, message) fires it from a handler. An alert fires at most once per bar, only on live data, and by default only when a bar closes; onForming: true also fires on the forming bar, which repaints. Alerts fire in the browser while the chart is open.
Next step
Give a script settings with inputs. Last modified on October 16, 2026