interface IndicatorPlot {
    colorKey?: string;
    key: string;
    ohlc?: { close: string; high: string; low: string; open: string };
    overlay?: boolean;
    priceFormat?: PriceFormat;
    priceScaleId?: PriceScaleId;
    style?: SeriesStyle;
    title: string;
    type: SeriesType;
    colorBy(
        ctx: {
            index: number;
            settings: IndicatorSettings;
            value: number;
            values: IndicatorValues;
        },
    ): undefined
    | string;
}

Properties

colorKey?: string

Settings key holding this plot's color, so a settings change restyles the series without a full rebuild.

key: string

Key into the calc result.

ohlc?: { close: string; high: string; low: string; open: string }

Four calc keys to draw this plot as bar-shaped elements instead of one value per bar: candles, hollow candles, OHLC bars, high-low.

A single column cannot express those at all, and the alternative (a second result shape for calc) would fork the contract every descriptor and every helper is written against. Naming four columns inside the same IndicatorValues keeps one shape: a smoothed Heikin-Ashi overlay, a higher-timeframe candle, a synthetic spread instrument each return four ordinary columns and point at them from here.

The named columns must all exist and be bar-aligned, or addIndicator throws. key stays the series identity and the legend reading falls back to the close column.

overlay?: boolean

Draw this one plot on the price pane even though the indicator owns a pane of its own. An oscillator that also wants a signal band or a stop line sitting on the candles is the case: the study belongs in its own pane, one of its columns belongs on price, and splitting it into two indicators would make the user configure the same inputs twice.

Ignored for an 'onchart' descriptor, which is already on the price pane.

priceFormat?: PriceFormat

Value formatting for the axis and crosshair tag of the scale this plot maps to: percent for a ratio study, volume for a cumulative one, custom for anything else.

Like style.precision, this is a property of the price scale, not of the series, so it belongs to a plot that owns its pane. Setting it on an 'onchart' plot reformats the instrument's own axis, which is almost never what a study wants.

percent suffixes the value as it stands and does not scale it, so a study returning a 0..1 fraction should keep returning it and read 0.62%. Scaling inside calc to make the axis read better changes the plotted value, and the legend, the crosshair and every downstream calculation with it.

priceScaleId?: PriceScaleId

Price axis for this plot. Defaults to 'right'.

style?: SeriesStyle

Style overrides merged onto the chart type's defaults.

title: string

Legend title.

Registered chart type used to draw it ('line', 'histogram', 'area', ...).

Methods

  • Per-bar colour, for plots whose meaning changes bar to bar — a MACD histogram is four colours by sign and direction, a conditional study two. Return undefined to fall back to the plot's own colour.

    Reaches the renderer as Bar.color, so every Family-A plot type honours it: histogram, column, candles, OHLC bars, line, step and area.

    Parameters

    Returns undefined | string