Getting Started
Tea Script files for user-authored indicators live under custom/**/*.ts in
the indicator library repo. Built-in indicators live under builtin/*.ts and
are read-only from the authoring surface.
Minimal Indicator
Section titled “Minimal Indicator”indicator('Simple Moving Average');
period = input.int(20);value = ta.sma(close, period);
output('value', value);plot(value, 'SMA');This script declares one integer input, computes a moving average over the bound chart close series, persists the value as an output, and plots the same series on the chart.
Authoring Rules
Section titled “Authoring Rules”- Start with one declaration:
indicator("Name")orstrategy("Name"). - Use assignment statements for intermediate values.
- Emit at least one value with
output(...)orplot(...). - Use
input.int(...)orinput.float(...)for user-configurable parameters. - Use the capability reference for the accepted function and effect surface.
Local Validation
Section titled “Local Validation”The sandbox validator is generated from TSGraph-owned authoring assets. It accepts a script path and prints JSON diagnostics:
node validate-tea-script.mjs custom/simple-moving-average.tsInside the OpenChart repo, the same validation contract is checked by the authoring asset generator and merge gate:
bun run check:authoringbun run --cwd packages/tsgraph check:authoring