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.
OptionalhasThis indicator was written from code the host can show the user.
Its legend row then carries a source button beside the gear, and pressing
it emits indicatorSource with the same payload indicatorSettings
carries. The engine does not hold the code and does not want to: a
descriptor may be compiled from a script, generated, or written by hand in
the host's own bundle, and only the host knows which of those it can put in
front of somebody. So this says a button is worth offering, and the host
decides what the button opens.
Absent or false draws no button, which is every built-in study.
Registry key, e.g. 'macd'.
OptionalmarkerWhat aboveBar and belowBar are measured against.
'plot', the default, is this study's own first plot, which is right for a
mark that belongs to the line: an arrow on a moving average sits against
the average.
'price' is the instrument's candles, so above is above the high and below
is below the low. That is what a buy or sell signal on an overlay study
means, and anchoring one to the study's own column instead puts it wherever
that column happens to sit: a study that anchors its marks to a mid-body
line draws every "below" mark through the middle of the candle.
Ignored by a study in its own pane, which has no candles to measure
against, and ignored when the chart has no primary series yet. Both fall
back to the first plot rather than dropping the marker. It applies to the
marks that name no target; a study in its own pane sends a mark to the
candles with overlay: true on that mark.
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 (CVD, PCR, 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.
Return a list of IndicatorBackgroundSpec instead to shade somewhere else as well: each column can name the price pane or a plot (see IndicatorOutputTarget), one column per target, and a column naming none shades the indicator's pane exactly as the plain form does.
Runs after every calc. Return [] to clear the study's own shading and
release every targeted column.
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: trendlines between pivots, supply and
demand boxes, projection labels. Drawn in the indicator's pane unless a
shape names another pane or plot (see IndicatorOutputTarget). Runs
after every calc, like markers and table, and the returned list
replaces the previous one wholesale, so returning [] clears every 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 every layer. A mark
can name the price pane or a plot to anchor to instead of the default
(see IndicatorOutputTarget).
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.
OptionaltablesMultiple named grids, refreshed after each calculation. Stable IDs reuse
their grid; omitted IDs are removed. Return [] to remove all grids.
When provided, this hook takes precedence over the single table hook.
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.