reference

Overview

Studies answer research questions over definition events you already Collected — frequency, forward returns, comparisons — then publish results you can read or pin on the chart.

They do not call ctx.emit and they do not run onBar. Lifecycle is onEvent (each matching event) then onFinish (aggregate and publish). Shared deps/session/budgets are under Shared runtime.

Covered in Shared runtime

Topic

Page

indicators.declare + empty values

Declaring indicator dependencies · Dependency outputs

Session buckets

Sessions

Budgets / lint

Budgets · Lint codes

Annotation helpers (different signatures)

Drawing on the chart

Unique to studies

Page

Covers

Study declarations

flows, results, dimensions (+ indicators)

onEvent and onFinish

Event lifecycle

Collect and publish

Scratch buckets → results

Results and stats

Result kinds, stat.*, candles

Study dependencies

Flow events + indicator reads

Chart pins

What in-terminal pins are (not hand-coded today)

Show studies on charts

Put on chart / Pin Studio product path

Studies do not call ctx.emit. Pins are created with Put on chart or the pin orchestrator — not the study authoring agent.

Minimal study

meta({ name: "Tick count", kind: "study" });
flows.declare({ slug: "tick-signal", as: "sig" });
results.declare({ id: "rows", kind: "table", title: "Rows" });

export function onEvent(ctx) {
  if (ctx.event.flow !== "sig") return;
  ctx.collect("rows", { time: ctx.event.time });
}

export function onFinish(ctx) {
  ctx.publish("rows", ctx.collected("rows"));
}

Next

  1. Study declarations

  2. Show studies on charts

  3. First study guide