The chart's editor is where most Indicators start: Build on the chart toolbar opens it, New indicator seeds a TypeScript file, Run compiles it in your browser and draws it on the chart, and Publish puts a version on the registry. kScript (legacy) scripts open in the same editor under New kScript (legacy) and keep running on the chart's own engine; this page is the Indicator side of it.
Open it
- On the chart toolbar, open Indicators. The dialog opens on the Indicators tab, the packages you can add straight to the chart; the kScript (legacy) tab holds My Scripts, Community and Marketplace, the scripts that run on the kScript engine.
- Build opens the editor. In its sidebar, New indicator starts a TypeScript Indicator; New kScript (legacy) starts a kScript.
- A kScript row with a proven Indicator port shows a New engine badge: adding it mounts the Indicator, and Use kScript engine on the row keeps the kScript version.
New indicator: nine templates
New indicator opens the sma-codefirst template, a complete moving
average with a comment on every statement. The same nine starting points
scaffold from om indicator templates on your machine:
| Template | What it seeds |
|---|---|
sma-codefirst | the moving average, declarations in the source, a comment on every statement |
sma-box | the same average with a box shading a band around it |
sma | the metadata-first form: the same average with a hand-written sheet |
vp-buy-share-codefirst | a celled volume-profile input with a per-bar text renderer |
polymarket-odds | a Polymarket probability as an input, pinned or bound per use |
conviction-score, event-asset-divergence, escalation-risk | event odds combined with price and funding |
hud-terminal | a terminal-style readout drawn with anchored, left-aligned label handles |
The first line of every Indicator tab is the language marker, and it is how the editor tells an Indicator tab from a kScript one (the CLI does not need it; everything you write goes under it):
//@lang=wrun-tsRun
Run compiles the file in a worker inside your browser with the compiler
the kit pins, AssemblyScript 0.27.37, the same version om indicator build
runs, so both hosts emit the same bytes. The built module mounts on the
chart as an overlay, or in its own pane when the first drawn output declares
lower. Nothing is sent anywhere to compute, and the forming bar
re-evaluates on every tick. Change a line, press Run again: write, run,
look at the chart, repeat.
Every param(...) is a setting in the overlay's settings dialog: change it
there and the outputs recompute without recompiling. To change what the
setting offers (its default or range), edit the declaration and Run again.
On the chart every input reads the chart's own market and interval;
symbol, exchange and interval pins are honored on your machine, not
on the chart yet (Execution model).
The Problems lane
If Run stops before the chart changes, the message is in the Problems lane, tagged with the stage that produced it, and one problem hides the ones behind it:
| Stage | What it checked | Typical message |
|---|---|---|
declarations | the param / input / output / shape statements, read from the text | option 'top' takes an output handle, not a string literal |
lint | raw positional slot literals in your source | raw positional slot literals silently rebind |
metadata | the derived sheet against the schema | outputs.0.color_by: color_by needs 'colors' with at least 2 entries |
compile | the AssemblyScript compiler | ERROR AS200: Conversion from type 'f64' to 'i32' requires an explicit cast. |
validate | the built module against the four-export contract | WRUN export 'finalize' has signature () -> f64 |
Fix the first one, Run again. On your machine om indicator build prints
the same messages and exits non-zero; every one of them is listed with its
fix in Common errors. A run that reaches the
chart and draws nothing is usually not an error at all: state() returning
0 on every bar, an output declared none, or a source the chart's market
does not serve, which the chart names (Debugging).
Save, download, publish
Save keeps the file under My Scripts, beside your kScript scripts.
Download package hands you <name>-<version>.tgz once the Indicator
compiles cleanly: the built module, its sheet (wrun/metadata.json,
derived from your declarations) and the manifest (om-package.json),
exactly what the registry and the om CLI consume. Publish opens the
registry in a popup: a package name (/name), a version
(MAJOR.MINOR.PATCH), a visibility, a description. A published version is
permanent (bump the version to revise), and it is what unlocks everything
beyond the draft: other people add it from the Indicators tab, an alert can
watch it (an alert on a draft is refused with "Publish the Indicator before
adding an alert"), and om install /name puts it on any machine
(Publishing).
The same file on your machine
A downloaded package installs as it is, and the source scaffolds into a workspace where the same build runs from a terminal (The CLI):
om indicator create @you/my-sma ./my-sma --template sma-codefirst
om indicator build ./my-sma
om indicator install ./my-sma --replace