Skip to content

Scripts

Read, author and validate indicator scripts.

Generated from the pinned chart source (04d191a). Descriptions are the exact text the model receives.

script_reference_query

Query script referenceRead-onlyChart coreSource

Read the indicator script reference before writing or changing a script. topic="guide" is the authoring guide: skeleton, series semantics, inputs, cross-bar state and common errors. Other topics list signatures, options and enum values.

Parameters

NameTypeRequiredConstraintsDescription
topicenumYesone of "guide", "runtime", "plot", "drawing", "ta", "enums"Reference topic id.

Minimal input · Required fields only; placeholders are derived from the schema.

{
  "topic": "guide"
}
JSON Schema
…

scripts_read

Read user scriptsRead-onlyChart coreSource

List or read user indicator scripts. Without scriptId it returns { scripts: [{ id, name }], folders: [{ path }] }. With scriptId it returns { script: { id, name, source } }. Built-in scripts and user libraries are not listed. Read the exact source before scripts_write update; never reconstruct a script from memory.

Parameters

NameTypeRequiredConstraintsDescription
scriptIdstring—min length 1Script id from scripts_read. Omit to list every user indicator script and the writable folders.

Minimal input · Required fields only; placeholders are derived from the schema.

{}
JSON Schema
…

scripts_write

Edit user scriptsModifies the chartChart coreSource

Create, update or delete a user indicator script. create: source plus an optional folder from scripts_read; the source is compiled and registered immediately, so a compile error is returned verbatim. update: scriptId plus the COMPLETE source; partial patches are not supported, so call scripts_read first. delete: scriptId; the chart instances of that script are removed with it. The source is the single source of truth: it must declare defineIndicator, the current indicator API version (version: 2), its name and position. Only indicator scripts are accepted; defineLibrary is rejected. A created script is registered but not added to the chart; call indicators_write add with its name afterwards.

Parameters

NameTypeRequiredConstraintsDescription
actionenumYesone of "create", "update", "delete"
scriptIdstring—min length 1update and delete: id returned by scripts_read.
folderstring——create only: folder path from scripts_read. Omit to place the script at the indicator root.
sourcestring—min length 1create and update: the COMPLETE script source, including defineIndicator and the indicator API version.

Minimal input · Required fields only; placeholders are derived from the schema.

{
  "action": "create"
}
JSON Schema
…

On this page