OptionalalertsOptionalcategoryGrouping for a picker UI ('Trend', 'Momentum', 'Volume', 'Volatility').
OptionalfillsShaded bands between pairs of plots — the Ichimoku cloud, a Bollinger channel. A pair of lines is not the same picture as a filled region: the fill is what makes "price is above the cloud" readable at a glance, and which side leads is itself the signal, hence the two colours.
Registry key, e.g. 'macd'.
Display name, e.g. 'MACD'.
'onchart' overlays the price pane; 'pane' gets its own pane.
OptionalattachOptional per-instance lifecycle, for indicators whose data is not derived from the chart's bars (open interest, CVD, an external feed). Called once when the instance is created; return a teardown function.
Fetch into ctx.store, then call ctx.requestRecompute() — calc runs
again and reads what you stored.
OptionalbackgroundOptional per-bar shading behind everything else in the indicator's pane: a
full-height column per bar, null where nothing should be shaded.
A regime study answers "which state is the market in right now", and that is a property of the whole bar, not a price. Drawn as a plot it would need a value to sit at and would fight the pane's autoscale; as a column behind the candles it reads at a glance and costs the scale nothing.
Runs after every calc. Return [] to clear the layer.
OptionalbarOptional recolouring of the main price candles, one entry per bar,
null to leave that bar with its own colour.
Distinct from a plot's colorBy, which paints the indicator's own series: a
trend filter, a volatility regime or a higher-timeframe bias is a statement
about the price bars themselves, and drawing it as a second series beside
them says something weaker.
Only one indicator's colours can be on the candles at a time; the most
recent publisher wins, and publishers run in addIndicator order, so the
winner is the same one from frame to frame. Removing it, or hiding it,
restores the bars' own colours.
Full recompute over every bar. Must return arrays the same length as
bars (use null for warmup gaps — the line renderer breaks across them
and autoscale skips them).
Tier-1 indicators are pure functions of (bars, settings) and ignore
store. Tier-2 indicators — the ones with their own data — read the
external series their attach lifecycle put in store.
Optionalctx: IndicatorCalcContextOptionalcalcOptional incremental path, called instead of calc when only the tail
changed (a live tick). Return values for indices [fromIndex, bars.length)
— the runtime splices them onto the previous result — or null to fall
back to a full calc.
Without it every tick costs a full recompute. That is a few hundred microseconds for one indicator over 50k bars, but it is O(n) per tick per indicator, so implement this for anything meant to run in a busy live pane.
Optionalctx: IndicatorCalcContextOptionaldrawsOptional free-standing shapes drawn in the indicator's pane: trendlines
between pivots, supply and demand boxes, projection labels. Runs after
every calc, like markers and table, and the returned list replaces the
previous one wholesale, so returning [] clears the layer.
OptionallevelsOptional horizontal reference levels drawn in the indicator's pane.
Recomputed after every calc, so a level derived from the data (the
previous day's high) tracks it. See IndicatorLevelContext for why the
argument still reads as a settings bag.
OptionalmarkersOptional bar-anchored signal markers — a named "Buy"/"Sell" plate, an arrow
at a crossover. Runs after every calc, so it reads the values it just
produced rather than recomputing anything.
A plot cannot express this: a plot is a column of prices drawn as a line or
histogram, whereas a signal is a discrete event with a label. Returning []
(when a showLabels-style input is off, say) clears the layer.
OptionalrangeOptional fixed price range for the indicator's own pane (RSI 0..100). Applied only when the indicator creates its pane — two indicators sharing a pane would otherwise fight over it.
OptionaltableOptional summary grid pinned to a corner of the pane.
Some studies are not a value per bar at all: a seasonality heatmap is a
matrix of monthly returns, a scoreboard is a handful of statistics. Those
have no place in calc, whose contract is one column per plot aligned to
the bars, so they come back through here instead. Runs after every calc.
Return null (or a zero-row grid) to draw nothing, which is how a
showTable-style input should switch it off.
Optional conditions the runtime watches on the descriptor's behalf, emitted as
'indicator:alert'on the chart's event bus with an IndicatorAlertPayload. See IndicatorAlertSpec.