vike
Research

vike-cli indicators

Print the indicators a Rhai strategy can actually call — the bound set, never the registry — with their parameters, their defaults and your own files listed beside them.

indicators prints the indicator functions a Rhai strategy can call, grouped by category, each with its parameters and the defaults you get by leaving them out. It is offline: no store, no settings, no credential.

It exists as a command rather than a sentence in a README because the claim cannot be written down. The scaffolded user_data/strategies/rhai/README.md tells you the host binds the whole vike-indicators catalog; on a release install there is no source tree to check that against, and a roster written into prose is wrong the first time an indicator is added. So the roster is printed off the same derived list the host binds from.

Flags

flagmeaning
--name NAMEjust this one — or, if it is not callable, why not
--category NAMEonly this category, matched case-insensitively; built-ins only
--jsonmachine-readable rows instead of the grouped listing
-h, --helpthe usage text, on stdout, exit 0

--name and --category ask different questions and are mutually exclusive — passing both is a usage error rather than one of them being silently ignored. An unknown --category is an error that names the categories this build has, because an empty answer to a typo is indistinguishable from "this build binds nothing in that family".

It prints the bound set, never the registry

Every row is a name vike_script::RHAI_INDICATORS carries — what crates/vike-script/src/engine.rs's register_indicators actually registers — joined onto its vike_indicators::registry() metadata for the label, the parameters and the output lines. crates/vike-cli/src/cmd/indicators.rs's bound_metas is that filter, and it also admits an indicator reachable only through a per-line accessor: bollinger's bare name is refused because line 0 is the upper band, but bollinger_mid(20) is callable, and a roster omitting it would say a band indicator is unreachable when it is not.

A name this command does not print is not callable — and it still compiles

Rhai resolves a function name when the line runs. A script naming an unbound indicator therefore compiles, raises on every bar, and self-disables after the consecutive-error cap — mounted, and silently never trading. That is why --name on a missing name exits non-zero and separates the two ways a name can miss: "not in the registry at all" versus "a real indicator this host does not bind", the second carrying the host's own reason from vike_script::unbound_reason rather than a paraphrase. An exit 0 would make not callable indistinguishable from a successful lookup to anything scripting this command.

The call form is the whole point of a row

Each row prints name(param=default, …) with every parameter spelled out. The host registers one form per argument count, from zero up to the full list, so a row is simultaneously the widest call and the answer to what do the ones I leave out become. Rows are grouped by category in first-appearance order, so the registry's curated grouping survives, and a row names its output line only when that differs from the indicator's own name. The footer counts what was printed — the only number this feature states, and it is stated nowhere in prose.

Your own indicators

user_data/indicators/*.rhai are callable from the same script by the same spelling, and they are listed in their own block under your own (user_data/indicators). Listing only the built-ins told an author their own indicator did not exist — the same a name this command does not print is not callable reading, pointed at the one indicator they are surest about.

The block is derived from vike_script::installed_user_indicators, joined to installed_user_indicator_params for the knobs and to installed_user_bare_call and installed_user_line_accessors for the spellings that resolve. It reads process state, not a directory: the dispatcher already did the I/O, and a listing that re-scanned the folder could print an indicator this process never installed and therefore cannot call.

your own (user_data/indicators)
  my_ema(period=20, scale=1.5)
  my_flag()
  my_bands_mid(width=2)          -> mid

The bare name is printed only when it binds. A file declaring fn outputs() whose line 0 is not its namesake has no bare name — the same refusal bollinger carries — and printing one anyway would print a call that raises on every bar. The line accessors are printed instead, so the block always names a way in. A file declaring no param() renders name(), with the empty parentheses, because a bare name would read as a value rather than a call.

--category never matches one of yours, and that is the honest answer rather than a gap: a user indicator has no category, so no category can contain one. --name does resolve one, and searches them first.

--json

Both keys are always emitted, indicators and user_indicators, including as empty arrays — a consumer that has to test for a key before reading it is one --name away from a crash. A built-in row carries name, pretty, category, params, outputs, accessors and bare_call. A user row carries name, params, accessors, bare_call and source, and deliberately no category, pretty or outputs — spelling those as empty would tell a consumer the fields exist and happen to be blank.

One declared residual

--name matches the file's or indicator's own name, not a per-line accessor. --name bollinger_mid reads "no indicator named", which is wrong about a spelling this command's own --json output carries. It is narrower for a user indicator, whose block names every accessor one screen away.

See also

On this page