feature

Study dependencies

A study’s inputs are upstream definition events (and optional indicator values at those event times).

This page covers the study-side wiring: matching ctx.event.flow to your as alias, reading payloads/labels, and guarding empty indicator outputs. Shared declare rules are under Declaring indicator dependencies.

Flow events

flows.declare({ slug: "london-open-drive", as: "lod", version: 4 });

export function onEvent(ctx) {
  if (ctx.event.flow !== "lod") return;
  const label = ctx.event.payload._displayLabel || ctx.event.label;
  ctx.collect("labels", label);
}

Events may carry label / _displayLabel from Collect. Studies never emit — missing events are upstream Collect / definition issues.

Indicator deps

Use the shared declare + guard pattern: Declaring indicator dependencies · Dependency outputs.

indicators.declare({ slug: "atr", as: "atr", version: 3 });

export function onEvent(ctx) {
  const atr = ctx.indicators.atr?.atr;
  if (atr == null) return;
  ctx.collect("atr", atr);
}

Visual accessors

const marks = ctx.flows.lod.marks(/* query */);
const atrMarks = ctx.indicators.atr?.marks?.(/* query */);

Flow accessors: events, hlines, marks, ranges, plots, trendlines, lifecycle.

MTF

Studies have no ctx.security. Use ctx.candles.forward / window and align run settings with upstream runOnMulti-timeframe and runOn.

Agent note

Study authoring must not author pin_cell / popover_layout for Put on chart.

Next

  1. Collect and publish

  2. Study authoring agent