Skip to content
EliteChart

IndicatorPlugin\<Params, Output\>

Documentation


Documentation / @elitechart/core / IndicatorPlugin

Defined in: plugin/types.ts:112

An indicator plugin. compute is pure — same inputs, same outputs. It is safe to call from a Web Worker.

Example

code
import { defineIndicatorPlugin } from '@elitechart/core';
const sma20: IndicatorPlugin = defineIndicatorPlugin({
  id: 'sma20', name: 'SMA 20', pane: 'price',
  inputs: [{ key: 'period', label: 'Period', type: 'number' }],
  defaultParams: { period: 20 },
  compute: (bars, { period }) => sma(bars, period),
});

Extends

Type Parameters

Params

Params = Record<string, unknown>

Output

Output extends IndicatorOutput = IndicatorOutput

Properties

defaultParams

code
readonly defaultParams: Params;

Defined in: plugin/types.ts:122

Default parameter values.


id

code
readonly id: string;

Defined in: plugin/types.ts:54

Stable, globally unique id. Reverse-DNS or scope-prefixed recommended.

Inherited from

PluginMeta.id


inputs

code
readonly inputs: readonly IndicatorInputSpec[];

Defined in: plugin/types.ts:120

Input schema for the settings dialog.


kind

code
readonly kind: "indicator";

Defined in: plugin/types.ts:116

Declared plugin category.

Overrides

PluginMeta.kind


name

code
readonly name: string;

Defined in: plugin/types.ts:56

Human-readable display name.

Inherited from

PluginMeta.name


pane

code
readonly pane: "price" | "separate";

Defined in: plugin/types.ts:118

Overlay on the price pane ('price') or draw in a separate pane ('separate').


targets

code
readonly targets: {
  interfaceVersion: "1";
};

Defined in: plugin/types.ts:60

Plugin interface version the plugin targets.

interfaceVersion

code
readonly interfaceVersion: "1";

Inherited from

PluginMeta.targets

Methods

compute()

code
compute(bars, params): Output;

Defined in: plugin/types.ts:123

Parameters

bars

readonly Bar[]

params

Params

Returns

Output