Inputs
Inputs are the values your users edit from the chart's Settings dialog. Declaring an input returns its current value — your script never cares whether the user has opened the dialog…
Alerts
A ChartScript script talks to the alert system in two ways:
Bar States
barstate.* is a namespace of booleans that describe where the script currently is in the per-bar loop.
Chart Information
The runtime exposes everything the script knows about the chart it is running on through three namespaces: syminfo.*, chart.*, and timeframe.*.
Strings
Strings are 16-bit Unicode. Both 'single' and "double" quote delimiters work; both support the same escape sequences:
Time
All times inside ChartScript are expressed as epoch milliseconds, UTC — a 64-bit integer. Chart display formats are a presentation concern; the script works with raw numbers.
Timeframes
A timeframe names the bar size: "5" (5 minutes), "60" (1 hour), "D" (1 day), "W" (1 week), "M" (1 month), or seconds ("1S", "30S").
Sessions
A session is a time window within a trading day. ChartScript represents a session as a string in HHMM-HHMM form, optionally followed by a day-of-week filter :1234567 (1 = Sunday, 7 =…
Other Timeframes and Data
The request.* family lets a script reach outside its own symbol or timeframe: a higher-timeframe RSI on an intraday chart, a benchmark index's return, a stock's dividend / earnings…
Non-Standard Chart Data
ChartScript indicators run on whatever chart type the user has selected. On candle / bar / line charts the series values match the raw symbol data. On non-standard chart types…
Strategies
A strategy is an indicator that also places orders. The runtime maintains a position, matches entries against exits, applies commission and slippage, and feeds a backtest report.
Libraries
A library is a reusable module of exported functions, types, and enums. Scripts import a library by owner, name, and version — version-pinned so a library update never silently breaks…
Repainting
A script repaints when values displayed on a confirmed historical bar change *after* that bar has closed. Repainting is the main source of "my strategy was profitable in backtest but…