feature

Study declarations

At the top of a study you declare what it reads and what it will publish — which definition (flows.declare), optional indicators, slice dimensions, and result ids.

If it is not declared, publish and lint will fail. This page is the study declare catalog; indicator deps reuse the shared Declaring indicator dependencies shape.

meta

meta({ name: "Forward return", kind: "study" });

kind is "study" (research). Trade studies use a separate product path.

flows.declare (study-only)

flows.declare({
  slug: "bull-bar",
  as: "bull",
  version: 2,
  settings: { /* optional */ },
});

as is the alias for ctx.event.flow and ctx.flows.<as>.

indicators.declare (shared)

Same shape as indicators and definitions — see Declaring indicator dependencies. Always pin version when you can.

dimensions.declare

dimensions.declare({
  id: "session",
  /* DimensionDeclareOpts — see IntelliSense */
});

Used with ctx.scopeEvent and indexed results (including pins).

results.declare

results.declare({
  id: "summary",
  kind: "metric", // or series, distribution, table, prose, popover_layout, …
  title: "Event count",
  indexedBy: ["session"], // optional
});

Declare every id you will publish. For Put on chart, see Show studies on charts. Pin layouts are not hand-authored in Code today.

Common mistakes

  • Publishing an undeclared result id

  • Using the definition name instead of slug in flows.declare

  • Asking the study agent to author pin_cell — wrong agent

Next

  1. onEvent and onFinish

  2. Declaring indicator dependencies