Inputs: what an indicator reads
This page lists everything an indicator's next can read, and what declaring each thing gets you. An indicator reads nothing it did not declare. Its definition names every value that reaches next: the settings a person or agent tunes, the values the kernel computes per bar, and every other series it reads. Because each one is declared, the kernel can check it before anything runs, key the instance by it, fetch it before the first bar and share it with every other reader.
Your first indicator showed the shape: inputs: { length: input.int(9, { min: 2 }) }, then inputs.length in setup. This page explains what happens between those two lines, and what else an indicator can read.
What reaches next?
Read it from the left. A binding's params, the values set for this one indicator on this one chart, decide the instance key and reach both setup and next as inputs. Everything else reaches next alone, one bar at a time: the bar itself, a source input read from a bar field or another indicator's plot, an anchor input computed from the instrument's calendar, and each declared data entry, lined up with the indicator's bars by that same calendar.
What does an anchored input look like?
Period open draws, over the price, the value its source had on the first bar of each period. By default that is the open of each month's first bar:
import { indicator, input, plot } from "@taji/indicators";
export default indicator({
name: "Period open",
pane: "price",
inputs: {
period: input.anchor("month"),
src: input.source("open"),
},
plots: { start: plot.step({ title: "Period open" }) },
setup: () => ({ start: NaN }),
next(_bar, s, { inputs }) {
if (inputs.period.starts) s.start = inputs.src;
return { start: s.start };
},
});

period: input.anchor("month")declares an anchor. Innext,inputs.periodis{starts, period_start}for the bar being computed.src: input.source("open")declares a source. Innext,inputs.srcis a number: this bar's open, unless the binding names another field or plot.plotsdeclares one step line, which holds its level until the next value.setupkeeps the level in state. It reads no input: a source or an anchor exists only per bar.nextstores the source's value on the bar where a period starts, and returns the stored level on every bar.
The newest ten rows, from a daily SPY chart:
[
{
"start_dt": "2026-11-19T00:00:00+00:00",
"start": 133.57
},
{
"start_dt": "2026-11-20T00:00:00+00:00",
"start": 133.57
},
{
"start_dt": "2026-11-23T00:00:00+00:00",
"start": 133.57
},
{
"start_dt": "2026-11-24T00:00:00+00:00",
"start": 133.57
},
{
"start_dt": "2026-11-25T00:00:00+00:00",
"start": 133.57
},
{
"start_dt": "2026-11-27T00:00:00+00:00",
"start": 133.57
},
{
"start_dt": "2026-11-30T00:00:00+00:00",
"start": 133.57
},
{
"start_dt": "2026-12-01T00:00:00+00:00",
"start": 139.8
},
{
"start_dt": "2026-12-02T00:00:00+00:00",
"start": 139.8
},
{
"start_dt": "2026-12-03T00:00:00+00:00",
"start": 139.8
}
]
- Each row is keyed by the bar's open time,
start_dt, with one column per plot:start. - Every November row holds 133.57, the open of November's first bar. On 2026-12-01, December's first bar,
inputs.period.startsis true, and the level steps to that bar's open, 139.80. - The legend reads
Period open month open: the binding took both defaults. Set itsperiodparam toweekand it is another instance, stepping on each week's first bar.
Captured 2026-12-04 on a headless kernel reading a made-up daily series for SPY.
What does one setting become?
input.int(9, { min: 2 }) names a kind, a default and how the settings dialog draws the input. The kernel makes three things of that one declaration:
| It becomes | How |
|---|---|
| Part of the instance key | A binding's params are resolved against the inputs (every input present, defaults filled, each value typed and in bounds) into one canonical string that is part of the instance's key. Two bindings of one version with equal params on one series share an instance; a changed value is another instance, computed from the start. |
| The settings dialog | The kernel turns the inputs into a JSON Schema whose x-order, x-group, x-inline, x-active and x-tooltip keys the window draws as rows. Nobody writes the dialog. |
| The agent's schema | The same schema is the catalog row your agent reads, so the agent and the dialog offer the same choices within the same bounds. |
setup and next both receive the resolved values as inputs: a number, a boolean or a string, by kind. A time input is UTC milliseconds, while bar.time is UTC seconds, so compare it with bar.time * 1000.
The options title, group, inline, tooltip and active only shape the dialog's rows. confirm, on a time or price input, has the window ask the person to click the chart for it as the indicator is added. Your agent sets the same input in add_indicator's params. Every kind and option is listed in the reference's Inputs.
Why is a source or an anchor a value per bar?
Most inputs are read once. A source and an anchor change with every bar, so the kernel computes them and hands next the value for the bar it is on. Neither exists in setup: reading one there throws inputs.<name> is a per-bar value: read it in next.
A source input is a number per bar. Its setting names a bar field (open, high, low, close, volume, hl2, hlc3, ohlc4 or hlcc4) or a plot of another indicator on the same pane, {binding, plot}. A plot source makes the other indicator an upstream. The script's instance is keyed by the upstream's key, never its binding id, so identical compositions share one computation. Each pass computes upstreams first, so the value the script reads for a bar already exists when its next runs. A pane's sources form a graph, and a cycle is refused (source: cycle).
An anchor input is {starts, period_start} per bar. Its setting is a period: session, week, month, quarter, year, decade or century.
startsis true on the first bar, and on each bar whose trading day falls in a new period. The kernel decides that from the bar's trading day, so a week whose Monday is a holiday starts on Tuesday's bar.period_startis the calendar start of the period holding this bar's trading day, asyyyymmdd: the day itself for a session, the Monday of a week, the first of a month, quarter or year. It is a calendar date, so it can be a holiday.
A script never computes a boundary from timestamps: holidays, daylight-saving shifts and short sessions make a fixed duration wrong.
The time anchor is different: input.anchor("time", { at: "start" }) names a time input, and its one period runs from the first bar opening at or after that instant, never reset. Before that bar starts is false and period_start NaN; from it, period_start is that bar's bar.time.
How does a script read another series?
data names every other series the script reads:
data: {
htf: data.bars({ interval: "1h" }),
ltf: data.bars({ interval: "1m" }),
divs: data.events("dividends"),
},
Because each entry is declared, it is known before the first bar. The kernel fetches it, computes it as an instance of its own that every reader of that series shares, and aligns it to the indicator's bars by the instrument's calendar. Which higher bar a bar's close completes, and which finer bars lie inside a bar, come from the calendar, never from an open plus a fixed duration, for the same holidays and short sessions.
| Entry | next reads |
|---|---|
A higher interval, data.bars({ interval: "1h" }) | .last, the newest bar of that series closed by this bar's close, and .changed, true when .last is a different bar than on the bar before. depth adds .at(k), the k-th closed bar before .last. Its fields are NaN until one closes. |
A lower interval, data.bars({ interval: "1m" }) | .intrabars, the finer bars inside this bar, oldest first; on a forming bar, those closed so far and the one forming. |
Events, data.events("dividends") | .last, the newest dividend, split or earnings report knowable by this bar's close, and .changed. |
A product, data.product("taji-gex.levels", { lens: "vanna" }) | .last, its newest row knowable by this bar's close, .changed, and .rows, the rows that became knowable inside this bar. |
data.product also reads the hub's trades, quotes, index_daily, statistics, imbalance, status and option_flow, one row an instant of the chart's symbol or another's. A bar's net premium bought, calls less puts, is for (const r of data.flow.rows) if (!Number.isNaN(r.side) && !Number.isNaN(r.premium)) n += r.side * r.premium * (r.call ? 1 : -1), for data: { flow: data.product("option_flow") }; a row whose side or premium is unknown reads NaN and adds nothing. A read serves what the hub holds: option_flow is served by Massive, and Databento's is metered, so a script's read never buys it.
An underlying's option statistics are statistics rows, one figure a row, and stat keeps one of them: data: { rank: data.product("statistics", { stat: "iv_rank" }), pc: data.product("statistics", { stat: "put_call_volume" }) } reads IV rank and the put/call volume ratio, each as data.rank.last.price. Each figure comes from the best-ranked linked provider stating or deriving it, and its row's provider names that provider. A daily row is knowable after its session's close. Where the provider does not state a figure, Taji derives it from that provider's own figures alone, and the row's computed names price: the ratio from the day's put and call volume (put_call_oi from open interest), and IV rank as where the day's iv sits between the provider's 52-week IV low and high, else between the lowest and highest of its daily iv over the past 252 sessions (iv_percentile is the share of those sessions below the day's). With under 252 sessions of iv there is no row. A plugin script that reads a product declares it in its [[kernel.indicators]] row's needs (the manifest reference), with the figures it reads as fields (fields = ["iv_rank"]), and the Indicators list says whether your providers serve it.
stat is 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 and iv_low_52w; any other word is refused at write, naming this list.
A script reads a row's numeric and boolean columns and its number lists, never a string: a number, a decimal and an instant (UTC seconds) a number, a date yyyymmdd, an unknown cell NaN. Of the two products above:
| Product | A script reads | Not served (strings) |
|---|---|---|
statistics | price (the figure), quantity, ts_event, ts_init, ts_ref | stat, update_action, provider, computed |
option_flow | call (true for a call), expiry, strike, price, size, bid, ask, side (1 bought, -1 sold), multiplier, premium, delayed, ts_event, ts_init, ts_utc | symbol, contract, side_by, exchange, conditions |
The refusals at write: chains and depth are snapshots, many rows an instant, and data.product reads one row an instant; a product with no knowable or time column, a word the product does not declare, a value out of its range, and a product that is not one of a plugin's or the hub's trades, option_flow, quotes, index_daily, statistics, imbalance and status. .rows holds the newest 4,096 rows that became knowable inside a bar when more did.
symbol reads another instrument; without it, an entry reads the chart's. data may also be a function of the inputs, evaluated once per instance, so an interval can be a setting: data: ({ inputs }) => ({ htf: data.bars({ interval: inputs.tf }) }).
What do bar and ctx hold?
| Field | Holds |
|---|---|
bar.open, high, low, close, volume | The bar's prices and volume |
bar.hl2, hlc3, ohlc4 | The derived prices |
bar.time | UTC seconds of the bar's open |
bar.session | date, the trading day as yyyymmdd, and phase: 0 premarket, 1 regular, 2 postmarket |
ctx.index, ctx.first | The bar's position from 0, and whether it is the first |
ctx.closed | False on a tick of the forming bar |
ctx.live | False while history is computed |
ctx.last | True on history's last bar and on every live bar |
ctx.syminfo | The chart symbol's ticker, type, currency, tick size, point value, timezone and session word, null where Taji holds none |
How ticks and closes reach next is How an indicator executes.
Why can no read see the future?
Every read is as of this bar's close. .last has closed by then, and an event is served only once it is knowable. A dividend or split is served from the first bar of its ex date, because it is announced ahead and trades ex at that date's open. An earnings report is served only once it is out: from 09:30 New York on its report date when it came before the open, else from the next session.
Two reads move that cut, each on purpose:
asof: "open"moves it earlier..lastbecomes the bar closed by this bar's open. It differs from the default on one chart bar per higher bar: the one whose close completes it..formingreads the higher bar in progress as of this bar's close, the chart's bars since its open folded together. That bar has not closed, so reading it marks the bindingrepaintsin its served metadata. It exists only where the chart's bars nest in the higher interval by the calendar (5m in 1h, not 7m in 1h; a regular-hours chart inD, not an extended-hours one); elsewhere reading it throws.
Finer bars exist only where they nest, too. .intrabars exists only where the finer interval tiles the bar on one calendar (1m or 5m in 1h, not 2m in 5m); elsewhere the binding faults. A finer entry serves only .intrabars, and any other entry everything but .intrabars: the wrong read throws.
Which settings does every indicator take?
Every indicator, built-in or custom, takes calc, calc_closes, offset, origin and style in its binding's params. They belong to the binding, not the definition: the kernel splits them off before resolving the inputs, and the catalog's schema lists them after your inputs. calc and origin decide what is computed (How an indicator executes); offset and style only how outputs are drawn (Outputs). A built-in that reads a source also takes source this way; a script declares its own input.source.
That is why the five names are reserved: an input named calc, calc_closes, offset, origin or style is refused, as is a plot or fill named colors.
When does Taji check an input?
Twice, so a bad value never reaches next:
- At write, against the declaration. A write refuses, naming the input, a malformed default, an
activenaming a missing or non-boolinput, aconfirmon another kind, atimeorpricewith neither a default norconfirm, an anchor'satnaming notimeinput, and aninlinerow split by another input. - At bind, against the binding's params. An unknown input, a wrong type or a value out of bounds is refused naming it, and so is a
confirminput left unset.
Input, data, plot and fill names share one namespace: no two may be equal.
What can an indicator not read?
- Anything undeclared. No call in a script fetches a series, an event or another indicator's values; a
dataentry or asourceinput is the only way in. dataon a frozen pane. A frozen pane is never fed, so a script withdatathere faultsdata needs a live chart.- What is not served. Financial and economic series, currency conversion and non-standard bars are not inputs; the reference's Not built lists what is planned.
The limits a write enforces:
| Limit | Value |
|---|---|
| Inputs | 32 at most |
data entries | 8 at most |
An input, data, plot or fill name | [a-z_][a-z0-9_]{0,63} |
A title, group or inline id | 1 to 64 characters |
A tooltip | 1 to 1024 characters |
depth | 1 to 500 closed bars |
| Intrabars | The newest 200,000, each bar's served whole or not at all: before that window a bar reads an empty .intrabars, never a partial one |
The faults a binding carries for its data (an interval that is malformed, does not nest, or trades on another calendar) are listed in the reference's Inputs from the kernel; where faults surface is How an indicator executes.
See also
- Your first indicator: write, bind and test one.
- How an indicator executes: ticks, closes, recomputes and faults.
- Outputs: plots, colour, drawings and what the window draws.
- Indicator reference: every input kind, option and
dataword. taji.d.ts: the types your source checks against.