Skip to main content

Writing an indicator

A TypeScript module in the desk that Taji runs for the chart, the same way for every client. Types come from references/taji.d.ts (declare module "@taji/indicators"): point your editor's paths at it and type-check before you write, because Taji only strips types and never checks them.

The loop is call verb/desk/<id>/indicators/write {name, source, test?}, then call verb/desk/<id>/chart/<pane>/add_indicator {definition: "<name>", params: {}} (params is required; {} takes the defaults), then read it back (read get/indicators). Each route's body is describe {route}'s schema, its codes refusals.

The model​

  • setup({inputs}) runs once per instance and returns the state. Create every ta.* handle here; ta throws anywhere else.
  • next(bar, s, {inputs, ctx, log}) runs for each bar and returns {<plot>: number}. Return NaN or leave a plot out for na. A script may have no plots and only draw (§ Drawings and tables).
  • A tick runs next from the state committed by the bar before, so a forming bar can run many times and each run starts clean. Only a close commits.
  • bar.time is UTC seconds of the bar's open (Pine's time is milliseconds).
  • Input, data and plot names share one namespace: never give a plot an input's name. calc, calc_closes, offset, origin and style are reserved input names (the binding's own settings), colors a reserved plot name.
  • A name is [a-z][a-z0-9_]*, at most 64 characters, and no registered indicator's. A write is refused for a TypeScript enum, a namespace, a constructor parameter property, an import of anything but @taji/indicators, more than 32 inputs or more than 8 data entries.
  • plot.levels([...]) draws fixed horizontal lines and is not returned from next.
  • series.eq ne gt ge lt le compare as Pine's operators do (within 1e-10 is equal; NaN is na), series.round, series.tostring (a pattern rounds half up and % multiplies, no format is the shortest form to 10 decimals, "percent" is not multiplied), series.format ({n}, {n,number,<pattern>} half even, {n,date|time,<pattern>} in UTC), series.nz, series.na and series.fixnan are Pine's math.round, str.tostring, str.format, nz, na and fixnan; "mintick", "percent" and "volume" are its format.*. ctx.syminfo is the chart symbol's {tickerid, type, currency, mintick, pointvalue, timezone, session} as Pine's syminfo.* names them, frozen, a field Taji does not know null (an equity's type, a future's timezone); "mintick" pads to ctx.syminfo.mintick unless the third argument is given. % is JavaScript's, not Pine's: Pine floors the quotient (-1 % 100 is 99), JavaScript's follows the dividend (-1), so a port writes a - b * Math.floor(a / b).

Plots and colour​

plot.<kind>({title?, color?, width?}), kind one of Pine's plot styles, or one of its other plot calls:

kinddrawsPine
line, line_breaksa line; line_breaks gaps where a value is naplot.style_line, style_linebr
step, step_breaks, step_diamondsa step line; step_diamonds a diamond at each valuestyle_stepline, _linebr, _diamond
area, area_breaksa line with the area under it filledstyle_area, style_areabr
histogramthin bars from zerostyle_histogram
columnswide bars from zero (MACD's histogram)style_columns
circlesa dot per valuestyle_circles
crossa cross per value (Parabolic SAR)style_cross
char(c, {at})the one character c just above or below its value, or on it (at above default, below, value): return the bar's high or low to sit over or under the barplotchar
arrowan arrow up for a positive value, down for a negative one, its length by magnitude among the served rows; off the price scaleplotarrow
candle, bara candle or an OHLC bar: next returns {open, high, low, close}, served as four columns <plot>.open … <plot>.closeplotcandle, plotbar
bgcolorthe pane's background over each bar with a number, in its palette's colour; off the price scalebgcolor
barcolorrecolours the chart's candles over each bar with a number; off the price scalebarcolor

title (1 to 64 characters) names the plot's Style row, else its name does. color is #rrggbb or #rrggbbaa, hex in any case; none on a script's plot serves #2962ff (TradingView's rendered default for a new drawing, not Pine's color.blue). width is 1 to 4. plot.marker({shape, at}) draws a shape where next returns a number. A script holds at most 32 columns (a candle or a bar is four).

A plot with colors: [...] (1 to 8 words, instead of color) is painted: next also returns colors: {<plot>: slot}, an index into that palette for this bar, and the kernel serves it per row. A slot that is not an integer inside the palette, or NaN or absent, draws nothing for the bar. A painted line's segment takes the colour of the bar it ends on; a candle's or bar's slot colours all four parts. color.rgb(r, g, b, transp = 0) and color.new(c, transp) build a word as Pine does: transp 0 gives #rrggbb, else #rrggbbaa (transp 100 is clear); a bad channel or colour throws.

A plot or fill with colors: "computed" (instead of color or a palette) takes its colour per bar from next's colors: {<name>: word}, any #rrggbb[aa] or null for none; Style offers it no swatch. color.from_gradient(value, bottom, top, bottom_color, top_color) is Pine's: the alpha and the alpha-premultiplied channels interpolated and floored, the end colours at and beyond [bottom, top]; a null end colour is clear black (a null bottom keeps the top's red, green and blue, its alpha rising from 0), and a NaN value or bound, or a clear result, is null. color.r/g/b(c) read a channel 0 to 255 and color.t(c) the transparency 0 to 100 ((255 − alpha) × 100 / 255 rounded, so color.new(c, 50) reads 50); null reads 0, 0, 0 and 100, as Pine's na colour.

fills: {<name>: fill(a, b, {title?, color? | colors?, alpha?})} in the definition shades between a and b, each a plot's name (not an arrow, candle, bar, bgcolor, barcolor or levels), a level's value, or a constant, with at least one plot or level; alpha 0 to 1 (default 1). Up to 16, their names in the plots' namespace. A painted fill's slot comes from next's colors: {<fill>: slot} as a plot's does, its rows on the fill's first plot.

MACD's histogram in four colours (above or below zero, then rising or falling):

plots: {
macd: plot.line({ title: "MACD" }),
signal: plot.line({ title: "Signal line" }),
hist: plot.columns({ title: "Histogram", colors: ["#26a69a", "#b2dfdb", "#ffcdd2", "#ff5252"] }),
},
setup: () => ({ /* the ta handles, */ prev: NaN }),
// in next, `hist` this bar's histogram and s.prev the last one:
const slot = hist !== hist ? NaN : (hist >= 0 ? 0 : 2) + (hist > s.prev ? 0 : 1);
s.prev = hist;
return { macd, signal, hist, colors: { hist: slot } };

Drawings and tables​

line.new, label.new, box.new, polyline.new, table.new, card and bars are callable in next only. They are state: committed on a close and restored on a tick, so a tick's new, set or cell is undone at the next tick and redone from the last close, and a recompute starts empty and rebuilds. Keep the handles in setup's state, and make every drawing from the bar's own data so a replay and live end alike.

  • Every drawing's x is in its xloc: "bar_index" (the default, Pine's) a ctx.index, from 10,000 bars before the bar it is written on to 500 after; "bar_time" a bar.time, any instant, the future included. Either is served as a time, a bar index off the series on the end bar's spacing, with its bars off the series beside it. A y is a price; NaN draws nothing.
  • line.new({x1, y1, x2, y2, xloc?, extend?, color?, width?, style?}): defaults #2962ff, width 1, solid (dashed, dotted, arrow_left, arrow_right, arrow_both, a head at x1, x2 or both), extend none (right a ray from x1 through x2, left from x2 through x1, both).
  • label.new({x, y, text?, xloc?, yloc?, color?, style?, textcolor?, size?, textalign?, tooltip?}): TradingView's rendered defaults (label_down in #2962ff, white text, normal); style Pine's label.style_* without the prefix; yloc abovebar/belowbar sits it on its bar's high or low. Text at most 40960 UTF-16 units, as Pine's str.length counts.
  • box.new({left, top, right, bottom, xloc?, extend?, border_color?, border_width?, border_style?, bg?, text?, text_color?, text_size?, text_halign?, text_valign?}): border and bg #2962ff (null for none), extend as a line's.
  • polyline.new({points: [{x, y}], xloc?, curved?, closed?, line_color?, fill_color?, line_style?, line_width?}): up to 10,000 points joined in order (curved by a smooth curve through them), closed back to the first, fill_color inside; it has no set.
  • Each returns a handle: set(partial) (not a polyline), get() the record as written (null once deleted or evicted), delete(). The handles whose get is not null are Pine's line.all and the like. The definition's max_lines, max_labels, max_boxes and max_polylines (1 to 500, polylines 1 to 100, default 50) cap each kind as Pine's: a kind holds up to its cap plus 5, and the next deletes its oldest down to the cap (Taji's measured behaviour, as TradingView's lines and polylines show it; labels and boxes by analogy).
  • table.new(position, columns, rows, {bg?, frame?, frame_width?, border?}): 1 to 20 columns, 1 to 100 rows, one table per position (top_left top_center top_right middle_left middle_center middle_right bottom_left bottom_center bottom_right); a new one at a held position replaces the old. It returns a Table: cell(column, row, {text, color?, bg?, halign?, size?}) (from 0; text at most 40960 UTF-16 units, as Pine's str.length counts: an emoji is two; frame_width px of frame outside the cells, 0 by default; defaults colour #363a45, no bg, center, normal; sizes tiny small normal large huge), clear(), delete().
  • card(position, {values, pill?, caption?, estimate?}) or card(position, null): 1 to 12 values {label, value, unit, signed?} (label 1 to 64 characters; value a number, NaN or infinite drawn "—"; unit price usd shares contracts ratio percent count, which the window formats, so pass numbers, never series.tostring text); pill {text 1 to 32, tone} (positive negative neutral); caption at most 128; estimate adds "estimate" to the head. One table or one card per position, the newest wins; null removes the card there. Fill it on ctx.last.
  • bars({categories, unit, signed?, caption?, estimate?}) or bars(null): one signed bar per category {label 1 to 32, sub? at most 32, value}, 1 to 50 in order, a NaN value drawing no bar. It draws in the binding's own pane, which it takes whole: the definition needs pane: "own" and no plots, or the call throws. One panel a binding, a call replaces it.
  • ctx.last is true on history's last bar and on every live bar: fill a table or a card there, not on every bar.

A zig-zag sketch: one leg line, redrawn as the live bar moves.

import { indicator, input, line, type Line } from "@taji/indicators";

export default indicator({
name: "Zig Zag", pane: "price",
inputs: { deviation: input.float(5, { min: 0.01 }) },
setup: () => ({ dir: 0, ext: NaN, ext_time: NaN, leg: null as Line | null }),
next(bar, s, { inputs }) {
const d = inputs.deviation / 100;
if (s.dir === 0) { s.dir = 1; s.ext = bar.high; s.ext_time = bar.time; return; }
const up = s.dir === 1;
const farther = up ? bar.high > s.ext : bar.low < s.ext;
const turned = up ? bar.low <= s.ext * (1 - d) : bar.high >= s.ext * (1 + d);
if (farther) {
s.ext = up ? bar.high : bar.low; s.ext_time = bar.time;
s.leg?.set({ x2: s.ext_time, y2: s.ext });
} else if (turned) {
const y2 = up ? bar.low : bar.high;
s.leg = line.new({ x1: s.ext_time, y1: s.ext, x2: bar.time, y2, xloc: "bar_time" });
s.dir = -s.dir; s.ext = y2; s.ext_time = bar.time;
}
},
});

Reading it back, and the look​

GET /get/indicators serves the numeric outputs as row keys in output order, then a <plot>:color column per painted plot and a fill:<k> column per painted fill (that bar's slot or null; a computed one's UInt32 0xRRGGBBAA, 0 for none). fields is each column's own metadata: an output's kind, title, color, colors, width, line, price_line, offset (only when not 0), visible (only when hidden), a char plot's char and at, a marker's shape and at, computed on a computed output, a slot column's of. meta.drawings is the whole current set of drawings and tables ({lines, labels, boxes, polylines, tables}, plus cards and bars while held, each record as written with every x a time, the full shape in describe {route: "get/indicators", prose: true}), absent while a script holds none; Pivot Points serve their levels' lines and labels there. A script with no plots has rows of start_dt alone and no fields.

The binding's params.style changes the look and never recomputes: update_indicator {id, params: {…inputs, style: {plots: {hist: {colors: [...], width: 2}}, show: {values: false}, precision: 2, visibility: {minutes: [5, 59], days: false}}}}. params replace wholesale, so send the whole style each time. Its keys: plots.<output> {visible, color (an unpainted one), colors (a painted one, the palette's length), neither on a computed one, width 1 to 4, kind (line, line_breaks, step, step_breaks, step_diamonds, histogram, cross, area, area_breaks, columns, circles: Pine's plot styles), price_line, line (solid, dashed, dotted)}; fills[k] {visible, colors, alpha 0 to 1} and levels[k] {visible, color, line, value} (value moves the level; the served level also carries its title), null for one left alone; a colour may end in an alpha (#rrggbbaa), which on a fill's colors entry replaces alpha for the bars in that slot; show {values, inputs, scale_labels, lines, boxes, labels, tables}; precision 0 to 8; visibility {minutes, hours, days, weeks, months}, each [lo, hi] or false to hide that unit; the full contract is the style property of the row at desk/<id>/catalog/<name>, and add_indicator's params in its describe. A refusal is invalid_params starting style: .

Rules​

  • State is plain data (numbers, strings, booleans, arrays, plain objects) or ta handles. A function, a class instance or a Map is refused.
  • No Math.random, Date.now or argument-less new Date(): each throws not deterministic. No module-level mutable state, which would differ between a replay and live.
  • ta.rsi, ta.ema, ta.rma and ta.sma are the built-ins' own code, so the same length gives the same numbers.
  • A source or anchor input is per bar: reading inputs.<name> in setup throws. Read it in next.
  • Nothing refuses an unknown name at run time: a key next returns that no plot names is ignored, and a plot option beyond title, color, colors, width and unit is dropped (offset, precision and visibility belong to the binding). Only a type check against taji.d.ts catches them.

What a write checks​

indicators/write compiles source (a 422 compile lists diagnostics with lines), then runs it over a fixed fixture and reports per plot the na count, first bar, min, max and last, plus logs and ms. Three invariants must hold, each failing with the first differing row:

  • determinism: a second fresh instance gives bitwise the same rows.
  • prefix: the history over the first half equals the first half of the full run.
  • ticks_then_close: ticks of a forming bar, then its close, give the close alone.

If test is given it runs too: a module importing only @taji/indicators whose default export maps names to (t: T) => void, T from import type { T } from "@taji/indicators".

import type { T } from "@taji/indicators";

export default {
"a flat series is flat"(t: T) {
const r = t.run({ length: 14 }, Array(40).fill(10));
t.assert(r.rsi.length === 40, "one row per bar");
t.near(r.rsi[r.rsi.length - 1], 100, 1e-9, "no losses");
},
};
  • t.run(params?, closes?) answers {time, <plot>} as arrays. closes makes bars with open = high = low = close and volume 0, 900 s apart; without it the fixture runs. Over closes only source inputs are fed (a field word reads the close, volume 0): a script with an anchor or data input runs t.run() on the fixture, or the test fails run(closes) cannot feed anchor or data inputs.
  • A test cannot feed another indicator's plot: a source param of {binding, plot} fails input <name>: a test cannot read another indicator's plot.
  • t.assert(ok, message); t.near(a, b, tol, message).
  • A throw fails that one test. The file is stored beside the source and indicators/test reruns it.

A refused write stores nothing: read the 422 report, fix, write again. indicators/check runs the same checks without storing.

Faults and budgets​

A script that throws, runs past its budget or past memory is a fault, not a crash: its rows clear, the legend shows a red ! with the message and the bar time, and GET /get/indicators carries meta fault as JSON {kind, message, at, line, column} (kind threw, budget, memory or compile; at the bar's UTC seconds; each absent where unknown). Fix the source and write again; a bound indicator following the bare name picks up the new version. A budget fault means the script computed past its allowance (50 ms of CPU for setup or one step, 1 s for compile, history, or one test), counted on the script's own thread, so a busy machine does not cause it. The lane runs in the kernel's process: it bounds a script's CPU and memory, it does not contain a hostile script.

  • History: 1 s for compile and the whole run.
  • A tick: 50 ms.
  • Memory: a 256 MB heap, and 256 MB of array buffers apart from it; past either faults memory.

Limits​

A write refuses, naming the limit:

  • name: [a-z][a-z0-9_], at most 64 characters, no built-in's; source and test at most 256 KiB each.
  • The definition's name (its legend title): 1 to 64 characters.
  • At most 32 inputs, 8 data entries, 32 columns (a candle or a bar is four) and 16 fills.
  • Every input, data, plot and fill name: [a-z_][a-z0-9_]{0,63}, each used once across all four.

A write, check or test holds the kernel's turn while it runs: four history runs of the fixture at 1 s each, 80 tick and close steps at 50 ms each, and 1 s per test, so the wait is bounded.

Versions​

Every distinct write is the next version, immutable: <name>@1, @2. add_indicator {definition: "<name>", params: {}} follows the latest, "<name>@N" pins one. A write whose source and test equal the latest version's answers that version and stores nothing.

Inputs​

inputs: { <name>: input.<kind>(default, options?) }. Every kind takes a trailing options object, Pine's keys beside the kind's own: title (the row's label), group (a heading over consecutive rows), inline (inputs sharing an id share a row, and must be declared together), tooltip (the ⓘ text), active (the name of a bool input that enables this one), confirm (time and price only, below). Strings of 1 to 64 characters, a tooltip to 1024. title falls back to the input's name in words.

kindoptionsreaches next asthe dialog draws
input.int(d, {min?, max?}), input.float(d, {min?, max?})boundsnumbera number field
input.bool(d)booleana checkbox
input.choice(d, {options})the wordsstringa select
input.text(d)stringa text field
input.color(d)#rrggbb or #rrggbbaastringa colour swatch
input.session(d)HHMM-HHMM, e.g. 0930-1600stringtwo time fields
input.interval(d)an interval word: 5m, 1h, D, W, 3Mstringthe interval menu
input.symbol(d)non-emptystringa text field
input.time(d?, {confirm?})UTC milliseconds, as Pine's input.time; no default only with confirmnumbera date and a time field in the display timezone
input.price(d?, {confirm?})no default only with confirmnumbera number field stepping by the instrument's tick
input.source(d), input.anchor(d, {at?})per bar (below)a select

confirm: true, Pine's interactive mode: adding the indicator in the window asks the user to click the chart for each confirm input (a time takes the clicked bar's open, a price the clicked price; a time and a price sharing an inline id, the only pair on it, are one click), and Escape adds nothing. Over MCP set them in add_indicator's params; a binding leaving a confirm input with no default unset is refused set <names>: no default; …. A time compares with bar.time * 1000.

A write refuses a malformed default, an active naming a missing or non-bool input and a split inline row, naming the input; a bound value breaking the same rules is refused naming it.

Inputs from the kernel​

The manifest declares them; the kernel feeds them per bar.

  • source: input.source("close") is a number in next, inputs.source: the bar field the binding's source names (open high low close volume hl2 hlc3 ohlc4 hlcc4) or another indicator's plot on the same pane ({binding, plot}, the other's id). An alert's indicator operand takes the same {binding, plot} source, a binding on a chart of the alert's Desk on its symbol and interval: it reads that chart's instance, and still fires with the Desk off screen.
  • anchor: input.anchor("session") is {starts, period_start} in next: starts true on the bar the period starts and on the first bar, period_start its calendar start as yyyymmdd (the session's day, a week's Monday, the 1st of a month, quarter or year: it may be a holiday). Periods: session week month quarter year decade century, and time with at naming a time input (input.anchor("time", { at: "start" })): one period from the first bar opening at or after that instant, never reset, period_start that bar's bar.time; before it starts is false and period_start NaN. A write refuses an at naming no time input.
  • data: { htf: data.bars({ interval: "1h" }) } gives data.htf.last ({time, open, high, low, close, volume}), the newest 1h bar closed by this bar's close, as Pine's lookahead_off on history (on an extended-hours equity chart a D or coarser read turns at the day's extended close, not the regular close; its bar is the regular session's), and data.htf.changed, true when last is a different bar than on the bar before. Its fields are NaN before the first closes. Without interval it is the interval the indicator computes on (the chart's, or calc); symbol defaults to the chart's.
  • data.bars({ interval, depth: 3 }) adds data.htf.at(k), the k-th closed bar before last (at(0) is last), NaN beyond history; depth is 1–500 (default 1, a write refuses more) and an at(k) past it throws. asof: "open" makes last the bar closed by this bar's open, Pine's request.security(sym, tf, expr[1], lookahead = barmerge.lookahead_on): it differs from the default exactly on the bar whose close completes a higher bar.
  • data.htf.forming is the higher bar in progress as of this bar's close, the chart's own bars since its open folded ({time, open, high, low, close, volume}, time its open). It exists only where the chart's bars nest in the series' by the instrument's calendar (one symbol; 5m in 1h, not 7m in 1h; a regular-hours chart in D, not an extended-hours one); elsewhere reading it throws data.<n>.forming: the chart's bars do not nest in <interval>. History serves each bar's fold, as a replay of request.security(sym, tf, close) shows it; reading it marks the binding repaints.
  • data: { ltf: data.bars({ interval: "1m" }) } with an interval below the one the indicator computes on gives data.ltf.intrabars: a frozen array of that interval's bars inside this bar ({time, open, high, low, close, volume}), oldest first, Pine's request.security_lower_tf; on a forming bar the ones closed so far and the forming one. Only where they nest in its bars by the instrument's calendar (one calendar: 1m or 5m in 1h, 1m in D, not 2m in 5m), else the binding faults. The newest 200,000 intrabars at most are served, and only whole: earlier bars, the bar holding the first held intrabar unless an intraday bar opens on it, and bars the store holds none for read an empty array. .last, .changed, .at(k) and .forming on such an entry throw data.<n>.<read>: <interval> is finer than the interval it computes on: read data.<n>.intrabars; .intrabars on any other throws.
  • data: { divs: data.events("dividends") } gives data.divs.last, the newest event knowable by this bar's close ({date, ...}, date as yyyymmdd; NaN before the first), and data.divs.changed, true on the bar last becomes a different event. Fields: dividends amount; splits ratio_from, ratio_to; earnings eps_estimate, eps_actual, eps_surprise, eps_surprise_pct (NaN where the source holds none). A dividend or split is served from the first bar of its ex date (it is announced ahead and trades ex at that open); an earnings report only once out: from 09:30 New York on its report date before the open, else from the next session, however early the row was fetched. So for an after-close report data.er.last moves a session after the Earnings anchor, which marks the report date's own bar. The binding waits with reading corporate actions or reading earnings until the read lands; the write's fixture holds no events.
  • data: { lv: data.product("taji-gex.levels", { lens: "vanna" }) } reads a plugin's product, or one of the hub's trades, option_flow, quotes, index_daily, statistics, imbalance and status (symbol defaults to the chart's): data.lv.last is its newest row knowable by this bar's close (every number NaN before one), .changed is true when it is a different row, and .rows the rows that became knowable inside this bar, oldest first, the newest 4,096 when more did. A row serves its number, decimal, instant (UTC seconds), date (yyyymmdd), bool and number-list columns and never a string. A word the product does not declare, a value out of its range, chains and depth (snapshots, many rows an instant) and a product with no knowable or time column are refused at write. statistics takes stat, one of open, high, low, close, settlement, open_interest, cleared_volume, auction_open, auction_close, indicative, luld_upper, luld_lower, hv, iv, fee_rate, short_interest, short_volume, high_52w, low_52w, vwap, high_limit, low_limit, call_volume, put_volume, call_oi, put_oi, put_call_volume, put_call_oi, iv_rank, iv_percentile, iv_high_52w, iv_low_52w (another is refused), and its figure is .last.price; option_flow serves call, side, premium, strike, price, size and the rest of its numbers. A plugin script declares what it reads in its [[kernel.indicators]] row's needs. Types: Products and Product in taji.d.ts.
  • data: ({ inputs }) => ({ htf: data.bars({ interval: inputs.tf }) }) computes the entries from a binding's params, once per instance: a source input is its word or its {binding, plot}, an anchor input its period word, not the per-bar values next sees.
  • Every indicator, built-in or yours, takes calc (an interval word at or above the chart's: it computes on that series and shows on the chart's) and origin (UTC seconds: it computes from the first bar at or after) in add_indicator's params. They are not manifest inputs. With calc, calc_closes true (the default: wait for timeframe closes) serves a calc bar's value only on the chart bar that closes it and null elsewhere; false serves the newest closed calc bar on every chart bar and the forming one on the live bar. A script's drawings under calc are served on the chart's bars: an x at a calc bar's time on the chart bar at that time, one past the calc series counted in chart bars.

Faults on the binding, the message of GET /get/indicators' meta fault: data needs a live chart (a custom with data on a frozen pane), daily bars need a live chart (Prior Day Levels on a frozen pane), data <n>: interval <w>: … (a bad data interval), data <n>: <w> does not nest in the <w> it computes on, data <n>: <symbol> trades on another calendar than <symbol> (a finer interval on another calendar), calc <w> is below the chart's <w>, source: … (a plot source naming no indicator or plot on the pane, a cycle, or a source that faulted), no indicator <definition> (no plugin registers it and its Desk holds no such custom) and <plugin> is disabled: <reason>. The last two keep the binding and its saved record; it computes again on the pass after its definition returns.

The write's fixture feeds data too, but only D, W, M, Y and intraday intervals; an interval below its 15m holds no intrabars (an empty .intrabars on every bar) and must tile 15m (data <n>: interval <w>: does not nest in the fixture's 15m); a symbol reads the fixture itself.

Not built​

Heikin Ashi and other non-standard bars (bars: chart), past and ta.hist (keep a value's history in state), drawn label tooltips (tooltip is stored and served), and any ta.* beyond sma ema rma rsi change crossUp crossDown (write it by hand, as references/pine.md says). Do not rely on them.

Worked example​

call verb/desk/<id>/indicators/write {name: "rsi_ma_cross", source} with:

import { indicator, input, plot, ta } from "@taji/indicators";

export default indicator({
name: "RSI MA cross",
pane: "own",
inputs: { length: input.int(14), ma_length: input.int(9) },
plots: { rsi: plot.line(), ma: plot.line(), up: plot.marker({ shape: "triangle-up", at: "below" }) },
setup: ({ inputs }) => ({ rsi: ta.rsi(inputs.length), ma: ta.sma(inputs.ma_length), up: ta.crossUp() }),
next(bar, s) {
const rsi: number = s.rsi.next(bar.close);
const ma: number = s.ma.next(rsi);
return { rsi, ma, up: s.up.next(rsi, ma) ? rsi : NaN };
},
});