Indicators
API reference for the indicator menu, favorites, indicator templates, and the Pine Script® library resolver.
This page documents the indicator menu, favorite indicator storage, indicator templates and their storage port, and the resolver interface for import statements in Pine Script®.
Import symbols on this page from @luxalgo/vela-pro. Related guides: Indicator menu, Indicator templates, Pine Script® with PineTS.
Feature enablers for this area (enableIndicatorLibrary, enableIndicatorTemplates, enablePineEngine) are documented on Enablers and options.
Functions
applyTemplate
Apply a template: remove the chart's indicators, switch to the saved market (when the template has one and the target can), then add the template's indicators with their settings. Removals first, so the outgoing set is not recomputed over the new market.
function applyTemplate(
target: TemplateTarget,
template: Pick<IndicatorTemplate, 'symbol' | 'timeframe' | 'indicators'>,
): voidSee also: IndicatorTemplate, TemplateTarget.
applyTemplateWithScope
Apply a template: on a grid, after asking which charts it goes to.
function applyTemplateWithScope(ctx: WidgetContext, template: IndicatorTemplate): voidSee also: IndicatorTemplate. From @luxalgo/vela/plugin: WidgetContext.
captureIndicators
The chart's indicators as template entries (a script by its source, a built-in by its type).
function captureIndicators(chart: Chart): TemplateIndicator[]
// Unexported supporting type referenced above
type Chart = WidgetContext['chart'];See also: TemplateIndicator. From @luxalgo/vela/plugin: WidgetContext.
chartTarget
Another chart of the grid: its indicators only (its market is its own).
function chartTarget(chart: Chart): TemplateTarget
// Unexported supporting type referenced above
type Chart = WidgetContext['chart'];See also: TemplateTarget. From @luxalgo/vela/plugin: WidgetContext.
indicatorFavorites
The page's favorite-indicators store: created on first use with the localStorage adapter when the enabler installed none.
function indicatorFavorites(): IndicatorFavoritesStoreSee also: IndicatorFavoritesStore.
indicatorTemplatesController
function indicatorTemplatesController(): IndicatorTemplatesController | nullSee also: IndicatorTemplatesController.
localIndicatorFavoritesStorage
The zero-wiring default (and the dev-page adapter): favorites under one localStorage key. Quota/privacy failures degrade to session-only silently.
function localIndicatorFavoritesStorage(key?: string): IndicatorFavoritesStorageDefault: key = 'vela-pro-indicator-favorites'.
See also: IndicatorFavoritesStorage.
newTemplateName
The typed name, or New template, New template 2…: whichever is free.
function newTemplateName(typed: string, existing?: readonly string[]): stringopenManageTemplatesDialog
Every template: apply, rename, delete, and what each holds.
function openManageTemplatesDialog(ctx: WidgetContext, c: IndicatorTemplatesController): voidSee also: IndicatorTemplatesController. From @luxalgo/vela/plugin: WidgetContext.
openSaveTemplateDialog
Save the active chart's indicators as a template.
function openSaveTemplateDialog(ctx: WidgetContext, c: IndicatorTemplatesController): voidSee also: IndicatorTemplatesController. From @luxalgo/vela/plugin: WidgetContext.
pineLibraryResolver
An import resolver reading each library from a URL. A 404 means the server does not have that library (the script then fails to prepare, naming the import); any other failed response throws. A library is fetched once per resolver, and a failed fetch is tried again the next time a script imports it.
function pineLibraryResolver(opts: PineLibraryResolverOptions): (path: string, library: PineLibraryImport) => Promise<string | null>See also: PineLibraryResolverOptions. From @luxalgo/vela-pinets: PineLibraryImport.
shellTarget
The shell's active chart: market switches and adds go through the shell (undo-recorded).
function shellTarget(ctx: WidgetContext): TemplateTargetSee also: TemplateTarget. From @luxalgo/vela/plugin: WidgetContext.
templateMeta
BTC-USD · 1h · 3 indicators.
function templateMeta(t: Pick<IndicatorTemplate, 'symbol' | 'timeframe' | 'indicators'>): stringSee also: IndicatorTemplate.
templateWithName
The template a save under name would overwrite: same name, ignoring case and spacing.
function templateWithName<T extends { name: string }>(
templates: readonly T[],
name: string,
): T | undefinedClasses
IndicatorFavoritesStore
class IndicatorFavoritesStore {
constructor(storage: IndicatorFavoritesStorage);
list(): readonly IndicatorFavorite[];
has(id: string): boolean;
toggle(fav: IndicatorFavorite): boolean;
subscribe(listener: () => void): () => void;
}| Member | Type | Description |
|---|---|---|
constructor | (storage: IndicatorFavoritesStorage) | |
list() | () => readonly IndicatorFavorite[] | |
has() | (id: string) => boolean | |
toggle() | (fav: IndicatorFavorite) => boolean | Flip one favorite; returns the NEW state (true = now a favorite). |
subscribe() | (listener: () => void) => () => void |
See also: IndicatorFavorite, IndicatorFavoritesStorage.
IndicatorTemplatesController class
The page's templates: one list every shell's button reads, kept by the storage port.
class IndicatorTemplatesController {
constructor(storage: IndicatorTemplatesStorage, canCreate?: () => boolean);
readonly ready: Promise<void>;
readonly canCreate: () => boolean;
list(): IndicatorTemplate[];
onChange(cb: () => void): () => void;
reload(): Promise<void>;
save(template: IndicatorTemplate): Promise<void>;
rename(id: string, name: string): Promise<void>;
remove(id: string): Promise<void>;
}| Member | Type | Description |
|---|---|---|
constructor | (storage: IndicatorTemplatesStorage, canCreate?: () => boolean) | canCreate: Asked before every save; false stops it (a plan's cap: the host shows why). Default: canCreate = () => true. |
ready | Promise<void> | |
canCreate | () => boolean | |
list() | () => IndicatorTemplate[] | |
onChange() | (cb: () => void) => () => void | |
reload() | () => Promise<void> | |
save() | (template: IndicatorTemplate) => Promise<void> | |
rename() | (id: string, name: string) => Promise<void> | |
remove() | (id: string) => Promise<void> |
See also: IndicatorTemplate, IndicatorTemplatesStorage.
LibraryClient
class LibraryClient {
constructor(opts?: LibraryClientOptions);
query(q?: LibraryQuery): Promise<LibraryPage>;
indicatorBySlug(slug: string): Promise<LibraryIndicatorSummary | null>;
concepts(): Promise<LibraryConcept[]>;
script(pineScriptCodeId: string): Promise<string>;
scriptBySlug(slug: string): Promise<{ name: string; code: string }>;
}
// Unexported supporting type referenced above
interface LibraryConcept {
id: string;
slug: string;
name: string;
family: string;
cluster: string | null;
aliases: readonly string[];
isFringe?: boolean;
}| Member | Type | Description |
|---|---|---|
constructor | (opts?: LibraryClientOptions) | |
query() | (q?: LibraryQuery) => Promise<LibraryPage> | Filtered/paginated published indicators (the checkout-grid query endpoint). |
indicatorBySlug() | (slug: string) => Promise<LibraryIndicatorSummary | null> | One published indicator by slug, or null when none exists (many concepts share a slug with their catalog script; a 404 is the usual miss, not an outage). |
concepts() | () => Promise<LibraryConcept[]> | The Financial Genome catalog (id, slug, name, family, aliases). One payload, no server-side text filter: the menu searches it locally. |
script() | (pineScriptCodeId: string) => Promise<string> | Pine source by code id: the code-only endpoint (no session required). |
scriptBySlug() | (slug: string) => Promise<{ name: string; code: string }> | Pine source by slug: detail first (it may inline the code), then the code-id hop (the live API returns pineScriptCode: null on detail and serves code by id only). |
See also: LibraryClientOptions, LibraryIndicatorSummary, LibraryPage, LibraryQuery.
LocalIndicatorTemplatesStorage
class LocalIndicatorTemplatesStorage implements IndicatorTemplatesStorage {
constructor(key?: string);
list(): IndicatorTemplate[];
save(template: IndicatorTemplate): void;
remove(id: string): void;
}| Member | Type | Description |
|---|---|---|
constructor | (key?: string) | Default: key = 'velapro.indicatorTemplates'. |
list() | () => IndicatorTemplate[] | |
save() | (template: IndicatorTemplate) => void | Create or overwrite (same id). |
remove() | (id: string) => void |
See also: IndicatorTemplate, IndicatorTemplatesStorage.
MemoryIndicatorTemplatesStorage
class MemoryIndicatorTemplatesStorage implements IndicatorTemplatesStorage {
list(): IndicatorTemplate[];
save(template: IndicatorTemplate): void;
remove(id: string): void;
}| Member | Type | Description |
|---|---|---|
list() | () => IndicatorTemplate[] | |
save() | (template: IndicatorTemplate) => void | Create or overwrite (same id). |
remove() | (id: string) => void |
See also: IndicatorTemplate, IndicatorTemplatesStorage.
Interfaces and types
BuiltinIndicator
interface BuiltinIndicator {
name: string;
slug: string;
}| Member | Type | Description |
|---|---|---|
name | string | |
slug | string | Published library slug the Pine source is fetched under. |
IndicatorFavorite
One favorite, self-sufficient for rendering: id is the stable key (native:<type> / slug:<library-slug> / source:<hash>), name what the Favorites tab shows without refetching any catalog. script is the Pine source for source: favorites: enough to re-add without a library fetch.
interface IndicatorFavorite {
id: string;
name: string;
script?: string;
}IndicatorFavoritesStorage
The persistence seam: implement it against your backend and hand it to enableIndicatorLibrary({ favorites }). load runs once at construction; save receives the full list after each (debounced) change.
interface IndicatorFavoritesStorage {
load(): Promise<readonly IndicatorFavorite[]> | readonly IndicatorFavorite[];
save(favorites: readonly IndicatorFavorite[]): Promise<void> | void;
}See also: IndicatorFavorite.
IndicatorMenuItem
One row of a host section: id is the section-local stable key (e.g. a backend record id), name what the row shows.
interface IndicatorMenuItem {
id: string;
name: string;
}IndicatorMenuSection
One host-supplied tab of the indicator menu (the enabler's sections option): list() names the items (called afresh on every menu open) and source(id) resolves one item's script when its row is clicked.
interface IndicatorMenuSection {
id: string;
label: string;
group?: 'library';
language?: string;
list(): Promise<readonly IndicatorMenuItem[]> | readonly IndicatorMenuItem[];
source(id: string): Promise<string> | string;
}| Member | Type | Description |
|---|---|---|
id | string | |
label | string | The rail tab's label. |
group? | 'library' | Where the tab sits: right after Favorites by default, 'library' at the end of the Library group. A search lists the section's matches in the same place. |
language? | string | The engine source(id)'s text runs on: the key it is registered under in the shells' engines option. Pine by default. |
list() | () => Promise<readonly IndicatorMenuItem[]> | readonly IndicatorMenuItem[] | |
source() | (id: string) => Promise<string> | string |
See also: IndicatorMenuItem.
IndicatorTemplate
interface IndicatorTemplate {
id: string;
name: string;
symbol: string | null;
timeframe: string | null;
indicators: TemplateIndicator[];
updatedAt: number;
}| Member | Type | Description |
|---|---|---|
id | string | |
name | string | |
symbol | string | null | The market it carries, applied with it: null leaves the chart's market alone. |
timeframe | string | null | |
indicators | TemplateIndicator[] | |
updatedAt | number |
See also: TemplateIndicator.
IndicatorTemplatesStorage
Where templates are kept. Every method may answer synchronously or with a promise.
interface IndicatorTemplatesStorage {
list(): IndicatorTemplate[] | Promise<IndicatorTemplate[]>;
save(template: IndicatorTemplate): void | Promise<void>;
remove(id: string): void | Promise<void>;
}| Member | Type | Description |
|---|---|---|
list() | () => IndicatorTemplate[] | Promise<IndicatorTemplate[]> | |
save() | (template: IndicatorTemplate) => void | Promise<void> | Create or overwrite (same id). |
remove() | (id: string) => void | Promise<void> |
See also: IndicatorTemplate.
LibraryClientOptions
interface LibraryClientOptions {
baseUrl?: string;
fetchImpl?: typeof fetch;
}| Member | Type | Description |
|---|---|---|
baseUrl? | string | Origin (plus optional path prefix) in front of /api/library/**. |
fetchImpl? | typeof fetch |
LibraryFamily
interface LibraryFamily {
key: string;
name: string;
blurb: string;
}| Member | Type | Description |
|---|---|---|
key | string | The key the library's endpoints and concepts carry. |
name | string | |
blurb | string | One line on what the family covers. |
LibraryIndicatorSummary
One published indicator as the query endpoint lists it (the fields the menu uses).
interface LibraryIndicatorSummary {
id: string;
name: string | null;
slug: string;
pineScriptCodeId: string | null;
family: string | null;
imageUrl?: string | null;
creationDateDisplayed?: string | null;
description?: string | null;
}| Member | Type | Description |
|---|---|---|
id | string | |
name | string | null | |
slug | string | |
pineScriptCodeId | string | null | The code-only fetch key (/api/library/pinescript/{id}); null = no source. |
family | string | null | |
imageUrl? | string | null | Preview screenshot on the library CDN; null/absent when the row has none. |
creationDateDisplayed? | string | null | Publication date as YYYY-MM-DD: the LuxAlgo catalog sorts by this, newest first. |
description? | string | null | What the script does, a few sentences (the menu's detail pane and row summaries). |
LibraryPage
interface LibraryPage {
indicators: LibraryIndicatorSummary[];
count: number;
}| Member | Type | Description |
|---|---|---|
indicators | LibraryIndicatorSummary[] | |
count | number | Total matches across all pages. |
See also: LibraryIndicatorSummary.
LibraryQuery
interface LibraryQuery {
text?: string;
family?: string;
concept?: string;
creator?: string;
sort?: 'name' | 'creationDateDisplayed';
pageIndex?: number;
pageQuantity?: number;
}| Member | Type | Description |
|---|---|---|
text? | string | Free-text filter (server-side). |
family? | string | Concept-family key (see the library's Financial Genome roster). |
concept? | string | Concept slug: indicators tagged with that concept (related-by-concept). |
creator? | string | Creator slug: the route defaults to luxalgo when omitted. |
sort? | 'name' | 'creationDateDisplayed' | Server-side order: by name (A–Z) or by date (newest first). Absent = the library's own order. |
pageIndex? | number | |
pageQuantity? | number |
PineLibraryResolverOptions
Options for pineLibraryResolver.
interface PineLibraryResolverOptions {
url: string | ((library: PineLibraryImport) => string);
headers?: Record<string, string>;
fetch?: typeof fetch;
}| Member | Type | Description |
|---|---|---|
url | string | ((library: PineLibraryImport) => string) | Where a library's Pine source lives: a URL template with {user}, {name} and {version} placeholders (/pine-libraries/{user}/{name}/{version}.pine), or a function building the URL from the import. |
headers? | Record<string, string> | Request headers, e.g. an authorization header. |
fetch? | typeof fetch | The fetch to use; the global one by default. |
From @luxalgo/vela-pinets: PineLibraryImport.
TemplateIndicator
type TemplateIndicator =
| { kind: 'script'; name: string; script: string; inputs?: Record<string, unknown>; props?: Record<string, unknown> }
| { kind: 'native'; name: string; type: string; inputs?: Record<string, unknown> };TemplateTarget
What applying needs from a chart: the chart, and the shell's recorded seams where it has them.
interface TemplateTarget {
chart: Chart;
setSymbol?(symbol: string): void;
setTimeframe?(timeframe: string): void;
addIndicator(entry: { name: string; script: string; language: string; inputs?: Record<string, InputValue>; props?: Record<string, InputValue> }): void;
addNativeIndicator(type: string): void;
}
// Unexported supporting type referenced above
type Chart = WidgetContext['chart'];From @luxalgo/vela/plugin: InputValue, WidgetContext.
Constants
BASIC_INDICATORS
const BASIC_INDICATORS: readonly BuiltinIndicator[];See also: BuiltinIndicator.
DEFAULT_LIBRARY_API_URL
The public LuxAlgo app origin serving /api/library/**.
const DEFAULT_LIBRARY_API_URL: 'https://app.luxalgo.com';INDICATOR_MENU_ACTION_ID
The contributed topbar action's id. The shell's 'indicators' SLOT, taken over: registering under the built-in id replaces the native button in place and inherits the slot's whole surface (the mobile stop and the / shortcut route here, and the built-in picker dialog is not constructed). Hosts need no option: the historical indicatorPicker: false becomes redundant (kept harmless until its 0.7.0 removal).
const INDICATOR_MENU_ACTION_ID: 'indicators';INDICATOR_TEMPLATES_ACTION_ID
const INDICATOR_TEMPLATES_ACTION_ID: 'vela-pro.indicator-templates';LIBRARY_FAMILIES
const LIBRARY_FAMILIES: readonly LibraryFamily[];See also: LibraryFamily.
ORDERFLOW_NATIVE_TYPES
The Orderflow tab's native roster. Mostly Pro-registered order-flow indicators; also includes Vela's core Visible Range Volume Profile (vpvr), which belongs with the other volume-profile tools rather than under Basic.
const ORDERFLOW_NATIVE_TYPES: readonly string[];Re-exports
The following symbols are re-exported from the listed import path and documented on their primary reference page or in their upstream package.
| Export | Kind | Exported from | Documented in |
|---|---|---|---|
PineLibraryImport | interface | @luxalgo/vela-pro | Owned by @luxalgo/vela-pinets |
PineLibraryResolver | type | @luxalgo/vela-pro | Owned by @luxalgo/vela-pinets |