import type { XYSeries, IXYSeriesDataItem } from "../../xy/series/XYSeries"; import type { StockLegend } from "../StockLegend"; import type { StockChart } from "../StockChart"; import type { DataItem } from "../../../core/render/Component"; import type { Color } from "../../../core/util/Color"; import { Container, IContainerSettings, IContainerPrivate, IContainerEvents } from "../../../core/render/Container"; import { MultiDisposer } from "../../../core/util/Disposer"; export interface IIndicatorEditableSetting { /** * Key of the indicator setting this field edits. */ key: string; /** * Label of the field in the settings modal. Consecutive fields with the * same name share one row. */ name: string; /** * Kind of input the settings modal shows for the setting. */ type: "color" | "number" | "dropdown" | "checkbox" | "text"; /** * Smallest value allowed for a `"number"` setting. * * @since 5.8.1 */ minValue?: number; /** * Largest value allowed for a `"number"` setting. * * @since 5.20.0 */ maxValue?: number; /** * Step of the number input. A step of `1` or more also makes the setting a * whole number: typed decimals are rounded. * * @since 5.20.0 */ step?: number; /** * Multiplier for showing the value in the settings modal: the input shows * the stored value times `scale` and divides it back on save. For example, * Acceleration Bands `factor` is stored in thousandths, so `scale: 1000` * shows `0.001` as `1`. * * The stored value, `minValue`, `maxValue` and `step` stay in stored units. * * @since 5.20.0 */ scale?: number; /** * Items of a `"dropdown"`: strings, or objects with a `value` and a `text`. * An option with `extTarget` (the key of a `"number"` field) sets that * field to `extTargetValue` when picked, and its limits to * `extTargetMinValue`, `extTargetMaxValue` and `extTargetStep`. */ options?: Array; } export interface IIndicatorSettings extends IContainerSettings { /** * The [[StockChart]] the indicator belongs to. */ stockChart: StockChart; /** * The series whose data the indicator is calculated from. */ stockSeries: XYSeries; /** * The volume series, for indicators that use volume. */ volumeSeries?: XYSeries; /** * A [[StockLegend]] to add the indicator to. */ legend?: StockLegend; /** * Number of data items each value is calculated over. */ period?: number; /** * Price to calculate from: `"open"`, `"close"`, `"low"`, `"high"`, or an * average such as `"hl/2"` (high and low) or `"ohlc/4"` (all four). */ field?: "open" | "close" | "low" | "high" | "hl/2" | "hlc/3" | "hlcc/4" | "ohlc/4"; /** * Name of the indicator, such as "Moving Average". */ name?: string; /** * Short name of the indicator, such as "MA", shown in the legend. */ shortName?: string; /** * Color of the indicator's series. */ seriesColor?: Color; /** * Opens the indicator's settings modal when the indicator is added from an * [[IndicatorControl]]. * * @default true * @since 5.10.6 */ autoOpenSettings?: boolean; } export interface IIndicatorPrivate extends IContainerPrivate { } export interface IIndicatorEvents extends IContainerEvents { } /** * Base class for [[StockChart]] indicators. * * @see {@link https://www.amcharts.com/docs/v5/charts/stock/indicators/} for more info */ export declare abstract class Indicator extends Container { static className: string; static classNames: Array; _settings: IIndicatorSettings; _privateSettings: IIndicatorPrivate; _events: IIndicatorEvents; _editableSettings: IIndicatorEditableSetting[]; series: XYSeries; protected _dataDirty: boolean; protected _sDP?: MultiDisposer; protected _vDP?: MultiDisposer; /** * Brings numeric settings back within the `minValue`, `maxValue` and `step` * of their `_editableSettings` entries, so an out-of-range value from the * modal, a config or the API never reaches `prepareData()` (a huge one can * freeze the page, as with Volume Profile). With `force`, checks every * setting; otherwise only changed ones. */ _clampSettings(force?: boolean): void; /** * Sets the numeric limits of an editable setting by key, for entries * inherited from a base indicator (such as overbought and oversold) whose * range differs per subclass. */ protected _setEditableSettingBounds(key: string, minValue?: number, maxValue?: number, step?: number): void; _prepareChildren(): void; protected _markDataDirty(): void; /** * Recalculates the indicator's data after the current frame. */ markDataDirty(): void; _updateChildren(): void; protected _dispose(): void; hide(duration?: number): Promise; show(duration?: number): Promise; protected _handleLegend(series: XYSeries): void; protected _updateSeriesColor(series?: XYSeries, color?: Color, contextName?: string): void; /** * Stores a value in the indicator series' `customData`, where text such as * a legend label can show it as `{name}`. * * @param name Key * @param value Value */ setCustomData(name: string, value?: any): void; /** * @ignore */ prepareData(): void; protected _getValue(dataItem: DataItem): number | undefined; /** * @ignore */ protected _getDataArray(dataItems: Array>): Array; /** * @ignore */ protected _getTypicalPrice(dataItems: Array>): Array; protected _sma(data: Array, period: number, field: string, toField: string): void; protected _wma(data: Array, period: number, field: string, toField: string): void; protected _ema(data: Array, period: number, field: string, toField: string): void; protected _dema(data: Array, period: number, field: string, toField: string): void; protected _tema(data: Array, period: number, field: string, toField: string): void; } //# sourceMappingURL=Indicator.d.ts.map