Public handle returned by chart.addIndicator(...).

interface IndicatorApi {
    id: string;
    indicatorId: string;
    name: string;
    paneIndex: number;
    barSource(): IndicatorBarSource;
    dataStatus(): null | Readonly<IndicatorDataStatus>;
    legend(): null | PaneLegend;
    plotPriceScaleId(plotKey: string): null | PriceScaleId;
    plotPriceScaleIds(): Readonly<Record<string, PriceScaleId>>;
    policy(): Readonly<IndicatorPolicy>;
    priceScaleId(): null | PriceScaleId;
    remove(options?: IndicatorEditOptions): boolean;
    retryData(): void;
    series(plotKey: string): undefined | SeriesApi;
    setBarSource(
        source: IndicatorBarSource,
        options?: IndicatorEditOptions,
    ): boolean;
    setPlotPriceScales(
        assignments: Readonly<Record<string, null | PriceScaleId>>,
        options?: IndicatorEditOptions,
    ): boolean;
    setPolicy(policy: null | IndicatorPolicy): void;
    setPriceScale(
        scaleId: null | PriceScaleId,
        options?: IndicatorEditOptions,
    ): boolean;
    setSettings(
        patch: Readonly<IndicatorSettings>,
        options?: IndicatorEditOptions,
    ): boolean;
    settings(): IndicatorSettings;
    setVisible(on: boolean): void;
    subscribeDataStatus(
        listener: (status: Readonly<IndicatorDataStatus>) => void,
    ): () => void;
    updateLegendValues(index?: number): void;
    values(): IndicatorValues;
    visible(): boolean;
}

Properties

id: string

Unique instance id (several instances of one indicator can coexist).

indicatorId: string

The descriptor id, e.g. 'macd'.

name: string

Display name.

paneIndex: number

Pane the indicator drew into.

Methods

  • Compute on the bars the chart draws ('chart', the default) or the bars the host feeds ('underlying'), whose values are then read at the bar each drawn element was completed on. The two are the same bars on a chart with no transform. False when unchanged, or for a study that is not configurable unless options.force is set; any other value throws.

    Parameters

    Returns boolean

  • Refresh the legend readings for a bar index; omit for the latest bar.

    Parameters

    • Optionalindex: number

    Returns void