feature
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: "direction",
role: "scope", // optional — default "scope"
title: "Rotation direction",
description: "Known on the clicked event.",
values: ["bullish", "bearish"],
});
dimensions.declare({
id: "next_regime",
role: "report",
title: "Next-day regime",
description: "Measured from the following session.",
});role | Default |
| pin scope |
|---|---|---|---|
| yes (when omitted) | Required when collecting | Allowed |
| no | Forbidden | Forbidden |
Use role: "report" for measured-later outcome axes (contingency tables, transition matrices). Report indexedBy may be wider than pin indexedBy.
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 authored by the Forward insight agent / rewrite agent — not the study authoring agent.
Common mistakes
Publishing an undeclared result id
Using the definition name instead of slug in
flows.declarePutting report-role dims in
ctx.scopeEventAsking the study agent to author
pin_cell— wrong agent
