Skip to main content
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. A line takes glow and a fill a gradient (see Gradients and glow). 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.
  • showLast: 50 draws only the newest 50 bars of a plot.
  • indicator(name, { overlay: true, scale: 'own' }) draws the script’s price-pane plots on one hidden scale of their own, over the candles without moving the price scale.

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:

Cells inside bars

plot.cells draws bands of price inside each bar, each with a width, a colour and a number, as a footprint chart does. add({ low, high, weight, value }) adds one to the current bar; every run of a bar starts with none, so add all the cells the bar should show.
  • columns (1 to 4) splits each bar side by side, two for sold × bought; a cell picks one with column.
  • weight sets the width. With scale: 'bar' (the default) the bar’s largest weight fills its column; 'visible' scales to the bars in view, and 'unit' reads weights from 0 to 1.
  • align grows a cell from the column’s 'left' (the default), 'right' or 'center', and lines its number up there.
  • value is the number written in the cell. A cell too small for it drops decimals, then shortens it (3.21K), then writes none; a bar’s numbers step down together so they line up. format is 'compact', 'fixed' or 'percent'.
  • candles: 'side' draws the chart’s candle as a thin strip at the left of each bar, clear of the cells; 'hidden' draws none.
Cells are bands of price, so they need bars wide enough to read: zoom in. A bar holds up to 1,024 cells and a plot 250,000. Footprint cells is the whole script.

Footprints

plot.footprint is a footprint of the script’s own, drawn by the footprint chart type. A script adds amounts by price into up to 4 named lanes, and the chart offers it as a Script choice under Data, beside Bid × Ask. Everything the footprint does then applies to it: rows that follow the zoom, the shapes, the colours, the candle, the scales, the value area and POC, the statistics rows and the row readout. Five come with the chart: Opens and closes, Stopped out, Stopped vs profit, Open interest and Makers opening are under Positions in the chart-type menu, below Data. Picking one runs the example of the same name on the chart, without adding it to your scripts; any other Data choice stops it. They read who opened and who closed, which only Hyperliquid’s fills carry, so on Lighter they are greyed. To change one, add its example as a script and edit it: yours is a Script choice.
  • Lanes sit left or right of the candle, at most 2 a side; on each side the first declared sits nearest the candle. Each has its own colour, shaded by size, and measure: 'count' for amounts that are not sizes.
  • fp.add(lane, price, amount) is called from an event handler, such as onTrade, as a tally is (OX1111, OX2108): a forming bar’s onBar runs again, and would count its trades twice. Prices snap to the market’s step; 0 and na are left out, and an amount below 0 is an error, so a signed value goes into two lanes.
  • An empty lane draws nothing: no 0 and no dot.
  • Shapes, under Shape in the chart-type menu: Cells print each lane’s number in its own column; Profile draws each lane as a bar in its column, as long as its amount; Stacked draws each price as one bar, as long as its total and split into the lanes’ colours in the cells’ order, with the total at its end. Every footprint example shows Cells and Stacked.
  • Imbalances are marked only between the pairs in opposed, a left lane against a right one, at the same price (compare: 'row') or one row apart as Bid × Ask does ('diagonal'). With none, the footprint’s Imbalances choices are off for this data.
  • Statistics rows: stats lists the rows offered first under the bars, each lane summed over the bar or { net: [a, b], label }, one lane less another. The chart’s own rows (volume, delta) stay in the picker.
  • A bar the script’s trades do not wholly cover draws as a bar still loading. On a candle chart nothing is drawn, and the legend offers Switch to the footprint chart.
Opens and closes footprint, on the same bars in each shape: Opens and closes footprint as Cells: each lane's number in its own column Opens and closes footprint as Profile: each lane a bar in its column Opens and closes footprint as Stacked: each price one bar, split into the lanes' colours A script draws one footprint; switch between views with an input. A bar keeps up to 4,096 prices and a plot 1,000,000 values, the oldest bars losing theirs first. Opens and closes footprint uses all four lanes.

Heats

plot.heat is a heat of the script’s own: amounts by time and price, drawn behind the candles by the order book heatmap’s painter. A column is a bar, rows group the market’s step as you zoom, and the tone is the view’s own scale, so it reads on a quiet market as on a busy one.
  • Carry. A bar’s own trades sit inside its range, behind its candle, so the chart carries each value into later bars. carry: { fade: n } halves a value every n bars (1 to 200, 10 by default), so a level glows and cools. 'hold' keeps it whole until a later bar’s range covers its price, as levels price never went back to. 'none' draws each bar’s own values only. It is the heat’s default; the trader picks another in the heat’s settings, and nothing reruns.
  • One side or two. One side takes a label and, optionally, a color: without one it draws on the order book heatmap’s blue-to-gold ramp. Two take sides, each { id, label, color }, and heat.add(side, price, amount). combine: 'net' (the default) nets a row’s sides, so a balanced row is quiet; 'larger' draws the row’s total in its larger side’s colour. The first side is the negative one. A script’s own colours that land close in a theme are turned apart; the theme’s up and down stay.
  • heat.add is called from an event handler, as fp.add is (OX1111, OX2108). Prices snap to the market’s step and amounts at one price add up; 0 and na are left out, and an amount below 0 is an error.
  • measure: 'size' (the default) reads out in USD or coin, as the footprint’s unit is set; 'count' as counted.
  • The legend shows the carry in use and the scale’s ends; the heat’s settings (the script’s Heat tab) hold Carry, Opacity, the newest bar at the right edge, and Details on hover: each side’s value under the pointer, made in that bar or carried, and from when.
  • It draws on bars a fixed time apart up to a week, over the order book and liquidation heatmaps when they are on, under the candles and drawings. Not on trade, volume or range bars.
A script draws one heat, with the footprint’s limits: a bar keeps up to 4,096 prices and a heat 1,000,000 values. Tape speed heat, Stopped-out heat, Makers opening heat and Open interest heat are the examples.

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 box with border: null draws no border. 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:

Gradients and glow

A box’s or polyline’s fill, a linefill’s color and a plot.fill’s gradient take a gradient as well as a colour: { top, bottom } runs down the shape, { left, right } across it, and an end left out fades the other end’s colour to nothing. glow on a line, a polyline, a box’s or label’s border, or a plot.line draws a soft glow in the line’s own colour under it: true for 8px, or 1 to 24. Labels also take bold, padding (0 to 16px, 6 by default) and a border. A fill’s setGradient(top, bottom, topColor, bottomColor) shades one bar from a colour at one price to another at a second price, as a TradingView gradient fill does.

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, a tooltip, bold text and a meter, a rounded bar after the text filled to a value from 0 to 1; 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.

Graphs

Some reads have no place on a time axis: volume by hour of the day, the return after each RSI reading, venues side by side. graph(title, { axis }) makes a chart with an axis of its own, which shows in a Script panel of the workspace. The script’s legend on the chart opens it, from its Graphs button or its menu. Each graph holds up to 8 series, bars, line or points, set by key from the chart’s handlers. Setting a key again replaces its value, and a set made while the forming bar updates is rolled back with it, as a plot’s is.
format: 'percent' writes values with a % sign (set them in percent) and precision fixes their decimals. A value’s own colour, set(key, value, color.up), overrides the series’. stack: true stacks a graph’s bars, each key’s series on top of the one before, as shares of a whole are. Up to 8 graphs per script and 1,000 keys per series. Volume by hour and Return after RSI are whole scripts.

Panels

Some reads are not about one chart at all: twenty markets side by side, a ranking, where each market sits on a map. A panel script runs in a Script panel of its own instead of on a chart. indicator('Market Read', { panel: { market: 'BTC', interval: '1h' } }) names the market whose bars clock it and their interval; the panel’s settings change both. Adding one from a chart’s Indicators opens a Script panel, and the panel’s own menu picks any script that has panel blocks. A panel shows the script’s blocks in the order they were made, one or two columns wide: Blocks are made at the top level and set from the clock’s handlers, like plots; a set made while the forming bar updates is rolled back with it. Set them on the newest bar (chart.isLast) unless every bar’s value matters.
A scatter’s quadrants names the four corners about zero, top left, top right, bottom left, bottom right, each a label or { label, color }. Its axes are fitted to the points; scale: 'sqrt' spreads a cluster near zero. A point’s tail is up to 30 earlier [x, y] positions, oldest first, drawn fading behind it, as a relative rotation graph draws them. Up to 16 blocks per script, 1,000 rows each. Market Read is a whole panel script.

In lists

The watchlist and In play can show any script that reads only bars as a column: one value per market, which sorts like any other column. The reader picks the script from the Columns menu, then its plot, its timeframe and its inputs. A cell reads the last bar that closed; the watchlist also offers Live, the forming bar. A plot on the price scale shows how far price is from it (“vs EMA 200”, -4.92%), since a price cannot be compared across markets; a plot in a pane of its own shows its value. A script can keep a reading just for lists: a plot that is hidden and has legend: false is never drawn and never in the legend, and a column starts on it. Supertrend’s Direction counts the bars of the current trend, + up and - down, so a list sorts by how long each market has trended:
A cell takes its colour from the bar’s: color.up and color.down colour it, any other colour leaves it plain. A head reads the script’s short name and its first two number inputs (“Supertrend 10 3”), so a shortName keeps it short. A script that reads trades, the book, open interest or any other stream is not offered as a column yet.

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.
  • A plot’s colour in the settings’ Style tab, and a colour input’s, has an opacity slider: a reader can make any plot translucent, kept as #rrggbbaa.
  • color.none draws nothing, on the whole plot or on one bar. A plot declared with it, such as a fill’s edge, stays out of the settings’ Style tab. A value only for the legend is a plot set each bar in a clear colour, color.withAlpha(color.up, 0): the legend names it in that colour, opaque, and nothing is drawn.
  • A plot on the price chart shows its legend value as a price unless it sets precision; with one, it reads as a number with its unit, such as a lean of -12%.

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 31, 2026