Built-in names

Built-in names

The names a script can use. They are in scope without an import; an import { ... } from '@chartlabs/script-sdk' line is optional.

open / high / low / close / volume

The chart's price and volume Series. Also hl2, hlc3, ohlc4 and barTime (bar open time in unix seconds).

ReturnsSeries

indicator(name, { placement }, body)

The terse wrapper. placement is 'overlay' (on the candles, the default), 'subpane' (its own pane below) or 'widget'. The two-argument form indicator(name, body) also works.

ReturnsLab class

input.int / float / bool / string / color / source / session / text / time / timeframe

Settings shown in the indicator dialog. Each returns the current value (input.source returns a Series). input.string needs { options: [...] } and shows a dropdown.

const len = input.int('Length', 14, { min: 1, max: 200 });
ta.*

The indicator library: see "ta.* functions" below.

ReturnsSeries

plot / plotHist / plotShape / plotChar / plotCandle / hline / bgColor

The plot family. Call them unconditionally, in the same order every time the body runs.

label / line / box / table / fill / barColor

Drawing objects. Imperative: call them any number of times, even in a loop.

security(symbol, timeframe, expr, opts?)

A value from another timeframe or symbol, aligned to the chart. symbol null means the chart's own symbol.

ReturnsSeries

feed.orderFlow / footprint / funding / openInterest / longShortRatio / liquidations / orderBook / macro / options / prediction

Order flow, derivatives and liquidations per bar, the live order book, FRED macro series, BTC/ETH options and Polymarket odds. See "Market data (feed.*)".

alpha(colour, opacity) / mix(a, b, t)

Colour helpers: the same colour at an opacity from 0 to 1, or a blend of two colours.

Returnsstring

strategy.entry / exit / close / cancel / cancelAll

Orders for the backtester. See "strategy.* API" below.

Lab, bars, compute, draw, config

The class form: extend Lab, read bars.*, call compute.*, draw with draw.*, take settings with config.*.

Anything else

Only the names above (and the rest of the list in the editor's autocomplete) exist when a script runs. Importing any other name compiles but fails at run time with "<name> is not defined".