Skip to content

Tea Script

Tea Script is Longsurf’s Pine-inspired authoring language for chart indicators and strategy prototypes. It is not a Pine compatibility layer by contract. The language is designed first around Longsurf and TSGraph capabilities.

Tea Script source is the default production frontend for current indicator authoring. The compatibility TypeScript frontend still exists as a fallback path, but current authoring assets, validation, editor diagnostics, and generated capability metadata are Tea Script-owned projections.

The current compiler path is:

Tea Script source
-> Tea Script parser
-> Tea Script AST
-> semantic analysis
-> TSGraph semantic IR
-> physical IR and executor
  • indicator("Name") declarations for indicators.
  • strategy("Name") declarations for current strategy-effect prototypes.
  • Top-level assignments and tuple assignment.
  • Number, string, boolean, NaN, and Infinity literals.
  • Built-in OHLCV source identifiers: open, high, low, close, volume.
  • Arithmetic, comparison, boolean, ternary, and lookback expressions.
  • Optimized input.*, ta.*, math.*, draw.*, log.*, plot, output, alert, and strategy capabilities listed in the generated capability reference.

Tea Script v0 does not expose TypeScript, CommonJS, imports, exports, classes, arbitrary functions, arbitrary loops, ambient ctx, or module.exports. Unsupported programming-language features are rejected at the authoring boundary until the grammar and semantic rules own them.