declare class ScaleManager { private static readonly VERTICAL_PADDING_PX; xToPixel(index: number, viewport: Viewport, chartWidth: number): number; pixelToBarIndex(x: number, viewport: Viewport, chartWidth: number): number; candleBodyWidth(viewport: Viewport, chartWidth: number): number; yToPixel(price: number, range: PriceRange, chartHeight: number): number; pixelToPrice(y: number, range: PriceRange, chartHeight: number): number; volumeToPixel(volume: number, maxVolume: number, volumePanelHeight: number): number; } interface DrawingToolbarUiConfig { /** Icon button size (width = height) in px */ iconBtnSize: number; /** Font size for unicode icons inside category buttons */ iconFontSize: string; /** Font family for icon buttons */ iconFontFamily: string; /** Font size for tool-name labels inside the category flyout */ flyoutLabelFontSize: string; /** Font family for flyout tool labels */ flyoutLabelFontFamily: string; /** Font size for keyboard shortcut hints in flyout rows */ shortcutFontSize: string; /** Font size for "soon" badges in flyout rows */ soonBadgeFontSize: string; /** Font size for the category-group header inside flyouts */ flyoutHeadingFontSize: string; /** Letter-spacing for flyout group headings */ flyoutHeadingLetterSpacing: string; /** Height of the scroll-up / scroll-down indicator buttons in px */ scrollBtnHeight: number; /** Font size for scroll indicator arrow glyphs */ scrollBtnFontSize: string; /** Horizontal padding inside the sidebar bar in px */ barPadding: number; /** Gap between icon buttons in the grid in px */ btnGap: number; /** Container width (px) below which LeftBar switches to mobile layout */ mobileBreakpoint: number; } interface TopBarUiConfig { /** Height of the top bar strip */ height: string; /** Font size for series / timeframe / indicator dropdown buttons */ dropBtnFontSize: string; /** Font family for dropdown buttons */ dropBtnFontFamily: string; /** Size (width = height) of the drawing-mode toggle button */ drawBtnSize: string; /** Font size for the icon inside the drawing toggle button */ drawBtnIconFontSize: string; /** Size (width = height) of icon-only buttons (settings, fullscreen) — desktop */ iconBtnSize: string; /** Size (width = height) of icon-only buttons — mobile override */ mobileIconBtnSize: string; /** SVG icon dimension inside the drawing toggle button — mobile override */ mobileDrawBtnIconSize: string; /** Font size for flyout list rows */ flyoutRowFontSize: string; /** Font family for flyout list rows */ flyoutRowFontFamily: string; /** Font size for flyout group-category headers */ flyoutCategoryFontSize: string; /** Letter-spacing for flyout category headers */ flyoutCategoryLetterSpacing: string; /** Checkmark icon font size inside flyout active rows */ flyoutCheckFontSize: string; /** Diameter of the stream-status dot indicator */ streamDotSize: string; } interface BottomBarUiConfig { /** Height of the bottom bar strip */ height: string; /** Font size for duration selector buttons (1D, 5D, 1M …) */ btnFontSize: string; /** Font family for duration buttons */ btnFontFamily: string; } interface PriceAxisUiConfig { /** Font size for price tick labels */ fontSize: string; /** Font family for price tick labels */ fontFamily: string; } interface TimeAxisUiConfig { /** Font size for time tick labels */ fontSize: string; /** Font family for time tick labels */ fontFamily: string; } interface CrosshairUiConfig { /** Height of the price-tag label drawn on the Y-axis in px */ labelHeight: number; /** Horizontal padding inside the price-tag label in px */ labelPaddingX: number; /** Font size for price and time labels */ fontSize: string; /** Font family for price and time labels */ fontFamily: string; } interface IndicatorOverlayUiConfig { /** Font size for inline indicator pill labels */ pillFontSize: string; /** Font family for inline indicator pills */ pillFontFamily: string; /** Font size for the colour-dot glyph inside pills */ dotFontSize: string; /** Font size for gear ⚙ and remove ✕ icons inside inline pills */ pillIconFontSize: string; /** Font size for the "N indicators" collapse toggle button */ collapseBtnFontSize: string; /** Font family for the collapse toggle button */ collapseBtnFontFamily: string; /** Font size for rows inside the collapsed dropdown panel */ dropdownRowFontSize: string; /** Font family for dropdown rows */ dropdownRowFontFamily: string; /** Font size for gear ⚙ and remove ✕ icons inside dropdown rows */ dropdownIconFontSize: string; } interface TradeButtonUiConfig { /** Button diameter (px) — desktop */ size: number; /** Button diameter (px) — mobile override */ mobileSize: number; /** SVG icon dimension (px) — desktop */ iconSize: number; /** SVG icon dimension (px) — mobile override */ mobileIconSize: number; } interface UiConfig { drawingToolbar: DrawingToolbarUiConfig; topBar: TopBarUiConfig; bottomBar: BottomBarUiConfig; priceAxis: PriceAxisUiConfig; timeAxis: TimeAxisUiConfig; crosshair: CrosshairUiConfig; indicatorOverlay: IndicatorOverlayUiConfig; tradeButton: TradeButtonUiConfig; } declare const DEFAULT_DRAWING_TOOLBAR_CONFIG: DrawingToolbarUiConfig; declare const DEFAULT_TOP_BAR_CONFIG: TopBarUiConfig; declare const DEFAULT_BOTTOM_BAR_CONFIG: BottomBarUiConfig; declare const DEFAULT_PRICE_AXIS_CONFIG: PriceAxisUiConfig; declare const DEFAULT_TIME_AXIS_CONFIG: TimeAxisUiConfig; declare const DEFAULT_CROSSHAIR_CONFIG: CrosshairUiConfig; declare const DEFAULT_INDICATOR_OVERLAY_CONFIG: IndicatorOverlayUiConfig; declare const DEFAULT_TRADE_BUTTON_CONFIG: TradeButtonUiConfig; declare const DEFAULT_UI_CONFIG: UiConfig; type DeepPartial$1 = { [K in keyof T]?: T[K] extends object ? DeepPartial$1 : T[K]; }; /** * Merge a deep-partial user override on top of a full default config. * Only the top-level keys of `UiConfig` are merged — component configs * are replaced as a whole unit if provided (shallow merge per component). */ declare function resolveUiConfig(override?: DeepPartial$1): UiConfig; interface TopBarLabels { /** Dropdown label for each series (chart) type. */ series: { candlestick: string; hollow: string; ohlc: string; line: string; area: string; heikinashi: string; volumecandles: string; linemarkers: string; step: string; hlcarea: string; baseline: string; columns: string; highlow: string; }; /** Timeframe dropdown button labels. */ timeframes: Record; /** Indicators button text when no indicators are active. */ indicatorsBtn: string; /** Indicators button text when one or more indicators are active. * Use `{count}` as a placeholder for the active count. */ indicatorsBtnActive: string; /** Tooltip on the drawing-toolbar toggle button. */ toggleDrawingTitle: string; /** Tooltip on the fullscreen button when in normal mode. */ toggleFullscreenTitle: string; /** Tooltip on the fullscreen button when already in fullscreen. */ exitFullscreenTitle: string; /** Tooltip on the chart-settings button. */ settingsTitle: string; /** Tooltip on the TFC (Trade from Charts) toggle button. */ tfcToggleTitle: string; } interface BottomBarLabels { /** Duration selector button labels. */ durations: Record; } interface DrawingToolbarLabels { /** Category flyout heading labels. */ categories: { trendLines: string; fibonacci: string; shapes: string; measurements: string; pitchforks: string; volume: string; annotations: string; patterns: string; elliott: string; brushes: string; advanced: string; priceProjection: string; }; /** Individual drawing tool names (used in flyout rows). */ tools: Record; /** Action button tooltips at the bottom of the toolbar. */ actions: { undo: string; redo: string; deleteSelected: string; clearAll: string; showAll: string; hideAll: string; lockAll: string; unlockAll: string; /** Tooltip for the combined actions button in mobile layout. */ moreActions: string; }; /** Badge text shown on drawing tools that are not yet implemented. */ soonBadge: string; /** Tooltip for the scroll-up indicator button. */ scrollUp: string; /** Tooltip for the scroll-down indicator button. */ scrollDown: string; } interface OhlcLabels { /** Label shown before the open price. */ open: string; /** Label shown before the high price. */ high: string; /** Label shown before the low price. */ low: string; /** Label shown before the close price. */ close: string; /** Label shown before the volume value. */ volume: string; } interface TradeLabels { /** Buy side label (trade button, order popover). */ buy: string; /** Sell side label. */ sell: string; /** Limit order type label. */ limit: string; /** Stop order type label. */ stop: string; /** Market order type label. */ market: string; /** Separator word between order descriptor and price (e.g. "at"). */ at: string; /** Quantity input label in the draft-order input. */ qty: string; /** Tooltip on the floating trade button (⊕). */ placeOrderTitle: string; } interface DialogLabels { /** Chart Settings dialog. */ settings: { /** Dialog title bar text. */ title: string; /** Section header for Trade from Charts settings. */ tfcSection: string; /** Label for the trade-display-filter radio group. */ showLabel: string; /** Label for the position render-style radio group. */ positionStyleLabel: string; /** Radio option — show all levels. */ showAll: string; /** Radio option — show positions only. */ showPositions: string; /** Radio option — show pending orders only. */ showOrders: string; /** Radio option — hide all trade levels. */ showNone: string; /** Radio option — render positions as full horizontal lines. */ styleLine: string; /** Radio option — render positions as dots on the price axis. */ styleDot: string; /** Reset-to-defaults button label. */ resetBtn: string; }; /** Indicator Settings dialog. */ indicator: { /** Appended to the indicator name in the dialog title bar. * Rendered as "{indicator name} {titleSuffix}". */ titleSuffix: string; /** Message shown when an indicator has no configurable parameters. */ noParams: string; }; } interface ChartMiscLabels { /** Overlay text shown while data is being fetched. */ loading: string; /** Overlay text shown when a completed fetch returned zero bars. */ noData: string; /** Tooltip on the "jump to live edge" button. */ scrollToLatest: string; /** Collapse button text in the indicator overlay when more than 2 indicators * are active. Use `{count}` as a placeholder for the count. */ nIndicators: string; } interface ChartLabels { topBar: TopBarLabels; bottomBar: BottomBarLabels; drawingToolbar: DrawingToolbarLabels; ohlc: OhlcLabels; trade: TradeLabels; dialogs: DialogLabels; chart: ChartMiscLabels; } declare const DEFAULT_LABELS: ChartLabels; /** * Deep-merges a partial labels override on top of `DEFAULT_LABELS`. * Only keys you provide are overridden; all others fall back to the defaults. * * @example * const labels = resolveLabels({ * trade: { buy: 'Acheter', sell: 'Vendre' }, * }); */ declare function resolveLabels(override?: DeepPartial$1): ChartLabels; type DeepPartial = { [K in keyof T]?: T[K] extends object ? DeepPartial : T[K]; }; /** Accent and interactive-state colors shared across all UI components. */ interface ChartThemeUi { /** Primary accent color — active borders, highlights (e.g. #2196f3 blue) */ accent: string; /** Text color on accented (active) elements */ accentText: string; /** Light semi-transparent fill for active list rows / buttons */ accentBg: string; /** Slightly stronger semi-transparent fill (drawing-toolbar active icons) */ accentBgStrong: string; /** Text color for unimplemented / disabled tool entries */ disabledText: string; /** Text color for "coming soon" badges */ soonBadgeText: string; /** Stream-status indicator dot colors */ stream: { connected: string; reconnecting: string; disconnected: string; }; } /** Colors specific to the drawing toolbar (LeftBar). */ interface DrawingToolbarColors { /** Default icon color (category buttons, action buttons) */ iconColor: string; /** Active/selected icon color */ activeIconColor: string; /** Flyout row text for implemented tools */ flyoutLabelColor: string; /** Flyout group-heading color */ flyoutHeadingColor: string; } /** Colors specific to the top bar and its flyout dropdowns. */ interface TopBarColors { /** Default button text color */ btnColor: string; /** Active button text color */ activeBtnColor: string; /** Flyout row text color */ flyoutRowColor: string; /** Flyout group-header text color */ flyoutCategoryColor: string; } /** Colors specific to the bottom bar duration buttons. */ interface BottomBarColors { /** Inactive duration button text */ btnColor: string; /** Active duration button background */ activeBtnBg: string; /** Active duration button text */ activeBtnText: string; /** Active duration button border */ activeBtnBorder: string; } /** Colors specific to the indicator overlay pills. */ interface IndicatorOverlayColors { /** Pill background (semi-transparent) */ pillBg: string; /** Gear and remove icon color */ iconColor: string; /** Dropdown row hover background */ dropdownHoverBg: string; } /** Colors for trade/position horizontal level lines. */ interface TradeLevelColors { /** Solid accent color for buy-side UI elements (popover text, button, icon). */ buySide: string; /** Solid accent color for sell-side UI elements (popover text, button, icon). */ sellSide: string; /** Line + box border color for open executed trades. */ tradeLine: string; /** Line + box border color for open positions. */ positionLine: string; /** Dashed line color for pending buy orders (limit/stop). */ pendingBuyLine: string; /** Dashed line color for pending sell orders (limit/stop). */ pendingSellLine: string; /** Primary text color inside the info box. */ labelText: string; /** Background fill of the × close button. */ closeBtn: string; /** Icon color of the × inside the close button. */ closeBtnText: string; /** Background of the floating info box (semi-transparent). */ boxBg: string; /** Background of the floating info box when hovered. */ boxBgHover: string; /** Color of the 6-dot drag grip icon. */ dragHandle: string; /** Color of the drag grip icon when hovered. */ dragHandleHover: string; } /** * Default per-drawing-type style fallbacks. Each drawing type has an entry that * provides default stroke/fill/text values; per-instance `IDrawing.style` * overrides these. Used by `resolveStyle()` in `src/drawings/styleUtils.ts`. */ type DrawingThemeMap = Record; /** Colors for the Trade Panel side drawer. */ interface TradePanelColors { background: string; border: string; headerBg: string; tabActive: string; tabInactive: string; rowHoverBg: string; rowText: string; rowSubText: string; } interface ChartTheme { background: string; grid: string; axisText: string; axisBorder: string; crosshair: string; tooltip: { background: string; text: string; border: string; }; candle: { up: string; down: string; wickUp: string; wickDown: string; /** Border/outline color for up candle bodies. Defaults to `up` if omitted. */ borderUp?: string; /** Border/outline color for down candle bodies. Defaults to `down` if omitted. */ borderDown?: string; }; volume: { up: string; down: string; }; /** Shared accent / interactive-state colors */ ui: ChartThemeUi; /** Drawing toolbar (LeftBar) specific colors */ drawingToolbar: DrawingToolbarColors; /** Top bar specific colors */ topBar: TopBarColors; /** Bottom bar specific colors */ bottomBar: BottomBarColors; /** Indicator overlay (pills) specific colors */ indicatorOverlay: IndicatorOverlayColors; /** Trade and position level line colors */ tradeLevels: TradeLevelColors; /** Trade Panel side drawer colors */ tradePanel: TradePanelColors; /** Per-drawing-type default style fallbacks (keyed by DrawingToolType). */ drawing: DrawingThemeMap; } /** A deep-partial version of ChartTheme for use in `themeOverrides`. */ type DeepPartialChartTheme = DeepPartial; /** * Deep-merge a partial theme override on top of a full base theme. * Only the keys you supply are replaced; everything else falls back to `base`. */ declare function deepMergeTheme(base: ChartTheme, override: DeepPartial | undefined): ChartTheme; /** * Walk every color string in `theme` and resolve any `var(--…)` CSS custom * properties to a concrete color value using the provided container element. * Non-variable strings are returned unchanged. * * Must be called after the container is appended to the live DOM so that the * browser can look up the custom property inheritance chain. */ declare function resolveCssVarsInTheme(theme: ChartTheme, container: HTMLElement): ChartTheme; declare const DARK_THEME: ChartTheme; declare const LIGHT_THEME: ChartTheme; interface OHLCVBar { time: number; open: number; high: number; low: number; close: number; volume?: number; } interface Viewport { startIndex: number; endIndex: number; candleWidth: number; candleGap: number; } interface PriceRange { min: number; max: number; } type SeriesType = "candlestick" | "hollow" | "line" | "area" | "ohlc" | "heikinashi" | "volumecandles" | "linemarkers" | "step" | "hlcarea" | "baseline" | "columns" | "highlow"; type Theme = "dark" | "light"; type Timeframe = "1m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "8h" | "1D" | "1W" | "1M"; type Duration = "1D" | "5D" | "1M" | "3M" | "6M" | "1Y" | "5Y" | "All"; interface Padding { top: number; right: number; bottom: number; left: number; } interface OrderSubmit { price: number; lots: number; side: 'buy' | 'sell'; /** 'market' for immediate execution; 'limit'/'stop' for pending orders. Default: 'market'. */ orderType?: 'market' | 'limit' | 'stop'; stopLoss?: number; takeProfit?: number; } interface DataLoaderParams { start: Date; end: Date; interval: string; } /** * Per-theme deep-partial color overrides applied on top of the built-in * dark / light themes. Only the keys you supply are replaced. */ type ThemeOverrides = { dark?: DeepPartialChartTheme; light?: DeepPartialChartTheme; }; interface ChartConfig { container: HTMLElement; theme?: Theme; series?: SeriesType; showVolume?: boolean; showUI?: boolean; /** If false, the drawing tools toolbar and pencil button are hidden entirely. Default: true */ showDrawingTools?: boolean; /** If false, the settings gear button in the top bar is hidden entirely. Default: true */ showSettings?: boolean; /** If false, the fullscreen toggle button in the top bar is hidden entirely. Default: true */ showFullscreenButton?: boolean; timeframe?: Timeframe; duration?: Duration; symbol?: string; /** List of symbols/ISINs the user can switch between via the symbol picker modal. */ isins?: string[]; /** Called when the user picks a symbol from the picker modal. Parent should call setSymbol() + setData(). */ onIsinSelect?: (isin: string) => void; /** * Called when the user clicks the symbol name in the top-left strip. * When set, suppresses the built-in ISIN picker modal and fires this callback instead. * Intended for native WebView hosts that handle symbol navigation natively. */ onSymbolClick?: (symbol: string) => void; padding?: Partial; /** * @deprecated DraftOrderQtyInput has been removed. This value is stored * internally and used as the submitted lot size, but no qty input is shown. * Minimum (and default) lot size for draft order submission. Default: `1`. */ minLots?: number; /** * When true, renders an editable QTY pill at the left of the draft order * info box. Clicking the pill opens a flyout to edit the quantity. Default: `false`. */ showQuantityField?: boolean; /** * Constraints for the draft order QTY field. Only relevant when * `showQuantityField` is true. `minLots` also sets the initial quantity * and the step value for the flyout input. */ quantityFieldConfig?: { /** Minimum lot size, step size, and initial quantity (e.g. `0.01`). Default: `1` */ minLots?: number; /** Maximum lot size (e.g. `100`). Default: `100` */ maxLots?: number; }; /** Called when user submits an order via the floating trade button */ onOrderSubmit?: (order: OrderSubmit) => void; /** * @deprecated DraftOrderQtyInput has been removed. This callback is accepted * for backward compatibility but will never fire — there is no qty input to change. * Use external state to track lot size. */ onLotsChange?: (lots: number) => void; /** @deprecated Use onLevelEdit which delivers all changes in one event. */ onLevelDragEnd?: (payload: { label: string; type: TradeLevelType; newPrice: number; data: unknown; }) => void; /** Called when the user confirms edits to a level. All changes (main price, SL, TP) arrive together in one event. */ onLevelEdit?: (payload: { label: string; type: TradeLevelType; data: unknown; newLots?: number; changes: Array<{ field: 'MAIN' | 'SL' | 'TP' | 'ADD_SL' | 'ADD_TP' | 'REMOVE_SL' | 'REMOVE_TP'; newPrice: number; data: unknown; newLots?: number; bracketOrderLabel?: string; }>; }) => void; /** * Override the default duration → timeframe pairing used by the bottom bar. * Can be supplied as a plain JSON object. Only entries provided are overridden; * the rest fall back to the built-in defaults. * Example: { "1Y": "1D", "5Y": "1W", "All": "1M" } */ durationTimeframeMap?: Partial>; /** * Optional data loader. When provided, ChartEngine calls this for initial * load, timeframe/duration changes, and scroll-back historical fetches. * The consumer owns URL building, auth, and response parsing. */ dataLoader?: (params: DataLoaderParams) => Promise; /** * Optional color overrides for the built-in dark and/or light themes. * Only the keys you provide are replaced; everything else falls back to * DARK_THEME / LIGHT_THEME. Accepts any CSS color string including CSS * custom properties (e.g. `"var(--my-bg)"`). * * @example * themeOverrides: { * dark: { background: 'var(--sidebar-bg-dark)', axisText: '#ccc' }, * light: { background: 'var(--sidebar-bg-light)' }, * } */ themeOverrides?: ThemeOverrides; /** * IANA timezone string for all time-axis and crosshair labels. * `"UTC"` (default) preserves existing behavior. * `"local"` uses the browser/device timezone automatically. * Any IANA string is accepted: `"America/New_York"`, `"Europe/London"`, etc. */ timezone?: string; /** * Optional per-component UI configuration overrides (font sizes, icon * sizes, spacing). Only the keys you provide are overridden; all others * fall back to DEFAULT_UI_CONFIG. Colors are controlled via the theme. */ uiConfig?: DeepPartial$1; /** * Optional user-visible string overrides for translation / localisation. * Only the keys you provide are overridden; all others fall back to * DEFAULT_LABELS (English). * * @example * labels: { * trade: { buy: 'Acheter', sell: 'Vendre' }, * ohlc: { open: 'O', high: 'H', low: 'L', close: 'C', volume: 'V' }, * } */ labels?: DeepPartial$1; /** * How long (ms) the tick-activity indicator stays green after the last * received tick before reverting to the stream-connection colour. * Default: 30 000 (30 s). */ tickActivityMs?: number; /** * Maximum number of candles to request per data load. * Caps the start-date window so a fine-grained timeframe (e.g. 1m) * with a long duration (e.g. 1Y) doesn't request hundreds of thousands * of bars. Default: 200. */ maxCandles?: number; /** * Minimum bars expected from the initial fetch before giving up. If the * `dataLoader` returns fewer bars than this, ChartEngine automatically * widens the lookback window and retries — this keeps charts useful after * weekends, holidays, or for instruments with sparse recent history. * Default: 10. */ minInitialBars?: number; /** * Hard ceiling (in milliseconds) on how far back auto-widening retries * can reach when chasing enough bars. Retries stop once the window meets * or exceeds this value. Default: 365 days. */ maxLookbackMs?: number; /** * How close (in bars) the viewport must be to the start of loaded data * before a historical fetch is triggered. Higher values prefetch earlier. * Clamped to a minimum of 20. Default: 80 (one screen-width of bars). */ prefetchThreshold?: number; /** * On touch/mobile devices, the initial visible bar count is * `DEFAULT_VISIBLE_BARS / mobileBarDivisor`. Accepted values: 2, 3, 4. * Default: `2`. */ mobileBarDivisor?: 2 | 3 | 4; /** * Enable momentum (kinetic) scrolling on drag release. When `true`, releasing * a fast pan gesture lets the chart continue scrolling with gradually * decelerating speed — matching the feel of native iOS/Android scroll views. * Default: `true`. */ momentumScrollEnabled?: boolean; /** * Per-frame velocity decay factor for momentum scrolling, normalised to 60 fps. * A value of `0.95` means the viewport retains 95% of its speed each 16.67 ms * frame. Lower values stop faster; higher values coast longer. * Clamped to `[0.80, 0.99]`. Default: `0.95`. */ momentumDecay?: number; /** * Minimum release velocity (px/ms) required to trigger a momentum scroll. * Swipes slower than this threshold stop immediately on finger-up. * Raising this value suppresses momentum for slow drags while still triggering * on fast flicks. Default: `0.3`. */ momentumThreshold?: number; /** * Maximum initial launch velocity (px/ms) for momentum scrolling. * Caps runaway fast-flick launches that would scroll hundreds of bars in one * gesture. Default: `6.0`. */ momentumMaxVelocity?: number; /** * Initial number of candles visible when the chart first loads (desktop). * On mobile this value is further divided by `mobileBarDivisor` unless * `defaultMobileVisibleBars` is also set. * Default: `80`. * * @deprecated Use `targetCandleWidth` instead. The chart will automatically * calculate the appropriate number of visible bars based on the canvas width. * This option remains as an explicit override when a fixed bar count is needed. */ defaultVisibleBars?: number; /** * Initial number of candles visible when the chart first loads on * touch/mobile devices. When set, overrides the `mobileBarDivisor` logic. * Default: `defaultVisibleBars / mobileBarDivisor`. * * @deprecated Use `targetCandleWidth` instead. The chart will automatically * calculate the appropriate number of visible bars based on the canvas width. * This option remains as an explicit override when a fixed bar count is needed. */ defaultMobileVisibleBars?: number; /** * Target pixel width per candle slot used to auto-calculate the initial * number of visible bars from the canvas width. Ignored when * `defaultVisibleBars` is explicitly provided. * Default: `10`. */ targetCandleWidth?: number; /** * Which side of the quote to use for candle close/high/low during live * tick updates. Defaults to `'bid'` (forex convention). Set to `'ask'` * if your broker streams ask-based OHLCV bars. */ tickClosePriceSource?: 'bid' | 'ask'; /** * When the combined count of open positions and pending orders exceeds this * number, the position render style auto-defaults to `'dot'` (compact). * Below or equal to the threshold it defaults to `'line'` (full line). * Users can still override this at any time from the Settings dialog. * When omitted, defaults to `2`. */ tradesThresholdForHorizontalLine?: number; /** * Initial position render style. When provided, overrides the auto-threshold * logic and localStorage. Restored from persisted state by the host app. */ positionRenderStyle?: PositionRenderStyle; /** * Initial trade display filter. Controls which level types are visible. * Restored from persisted state by the host app. */ tradeDisplayFilter?: TradeDisplayFilter; /** * Initial per-theme canvas color overrides (set via the Settings dialog). * Restored from persisted state by the host app. */ canvasColors?: { dark?: Partial; light?: Partial; }; /** * Show both Bid and Ask price lines as dashed horizontal lines on the chart. * When `false` (default), only the `tickClosePriceSource` side is shown. * Only relevant when a live tick stream is active. * Default: `false`. */ showBidAskLines?: boolean; /** * Show the ACT logo watermark in the bottom-left corner of the price pane. * Default: `false`. */ showActLogo?: boolean; /** * Maximum number of sub-pane indicators (oscillators) that can be active * simultaneously. Prevents layout collapse when too many panes are stacked. * Default: 3. */ maxSubPanes?: number; /** * Show the candle countdown timer on the time axis beneath the last (live) candle. * Default: `true`. */ showCandleCountdown?: boolean; /** * Timeframes on which the candle countdown is shown. * - `undefined` (default): intraday only (`1m`–`4h`) * - `'all'`: every timeframe * - `Timeframe[]`: explicit allowlist (e.g. `['1D', '1W']`) * Requires `showCandleCountdown: true` (default). */ candleCountdownTimeframes?: Timeframe[] | 'all'; /** * Per-timeframe base interval map. For each timeframe key, specifies which * interval the `dataLoader` will be called with. The library then aggregates * the returned bars up to the target timeframe before rendering. * * Defaults to the timeframe itself when a key is not present (no aggregation). * Only entries where the mapped base interval is finer than the target timeframe * result in aggregation; equal or coarser values are ignored. * * @example * // API natively supports only 30m and 1D — higher TFs are built client-side: * aggregateFrom: { * '1h': '30m', // fetch 30-min bars → aggregate to 1H * '4h': '30m', // fetch 30-min bars → aggregate to 4H * '1W': '1D', // fetch daily bars → aggregate to 1W * '1M': '1D', // fetch daily bars → aggregate to 1M * } */ aggregateFrom?: Partial>; /** * Enable trade-level fan-out clustering. When `true`, overlapping * trade levels whose Y pixel positions are within `clusterThresholdDistance` * pixels are grouped into a single expandable cluster badge. * Default: `true`. */ levelClusteringEnabled?: boolean; /** * Pixel proximity threshold for level clustering. Levels whose Y pixel * positions are within this distance get grouped into a cluster. * Only effective when `levelClusteringEnabled` is `true` (default). Set to * a higher value for more aggressive grouping, lower for tighter grouping. * Default: `20`. */ clusterThresholdDistance?: number; /** * Hide the ✓ / ✗ confirm-cancel buttons on trade levels that have pending changes. * Use when the host app provides its own native confirm/cancel controls. * Default: `false`. */ hideLevelConfirmCancel?: boolean; /** * When `true`, clicking or tapping anywhere outside a selected/active trade * level dismisses it (reverting any pending edits, mirroring ✗ Cancel). * When `false` (default), the active level is preserved across outside * clicks — only explicit ✓ / ✗ buttons, tapping the level itself, or * `setLevels()` removing it will dismiss it. Recommended `false` so * incidental clicks (e.g. price-axis resize, tapping outside the QTY input) * don't drop the user's in-progress edit. * Default: `false`. */ deselectActiveOnOutsideClick?: boolean; /** * Always render SL/TP bracket lines + price pills, even when the parent * trade level is not hovered or selected. Close (×) buttons remain * hover-only to keep the chart uncluttered. * Default: `false`. */ showTradeLevelsAlways?: boolean; /** * Show the candle countdown timer on the right price axis, just below * the live price tag. Subject to the same `candleCountdownTimeframes` * filter as the time-axis countdown. * Default: `false`. */ showPriceAxisCountdown?: boolean; /** * Multiplier applied to the Confirm (✓), Cancel (✗), Edit (✎), and Close (×) * buttons on trade-level overlays (both main-level and SL/TP bracket boxes). * Scales button radii and inter-button gaps so visual size AND hit/drag areas * grow together — useful for touch targets. * Clamped to `[1, 3]`. Default: `1`. */ tradeLevelButtonScale?: number; /** * When `true`, a theme toggle (Dark / Light) is shown in the Settings dialog. * Default: `false` — the toggle is hidden. */ enableThemeToggle?: boolean; /** * Hide the symbol name and tick-activity (streaming) dot shown in the * top-left corner of the chart canvas. The OHLC(V) data strip is **not** * affected by this flag — use `hideOHLCV` to hide it independently. * Default: `false` (symbol + dot are visible). */ hideSymbolAndTick?: boolean; /** * Hide the OHLC(V) data strip rendered in the top-left overlay * (the `O: H: L: C: V:` line(s)). Independent of `hideSymbolAndTick`. * Default: `false` (strip is visible). */ hideOHLCV?: boolean; /** * Show the bottom duration-selector bar. * Default: `false` (bar is hidden). */ showBottomBar?: boolean; /** * @deprecated DraftOrderQtyInput has been removed. This option is a no-op. * Accepted for backward compatibility only. */ hideQtyButton?: boolean; /** * Enable TFC (Trade from Charts) functionality. * When `false`, the TFC toggle button is never shown and all trade levels, * trade button, and trade popover are completely disabled. * When `true` (default), a TFC toggle button appears in the top bar * allowing the user to enable/disable TFC at runtime. */ tfcEnabled?: boolean; } interface IndicatorResult { index: number; value: number | null; upper?: number | null; lower?: number | null; signal?: number | null; histogram?: number | null; } interface IIndicator { readonly name: string; readonly color: string; readonly pane?: "main" | "sub"; readonly paneHeight?: number; compute(data: OHLCVBar[]): IndicatorResult[]; /** * Returns the natural value range for the given results. * Used to render a price axis on the right side of sub-panes and to support draggable Y-scale. * Only required for sub-pane indicators. */ getValueRange?(results: IndicatorResult[]): PriceRange; render(ctx: CanvasRenderingContext2D, results: IndicatorResult[], scaleManager: ScaleManager, viewport: Viewport, chartHeight: number, rangeOverride?: PriceRange): void; } type DrawingToolType = "horizontalLine" | "verticalLine" | "trendLine" | "rectangle" | "ellipse" | "circle" | "triangle" | "fibRetracement" | "fibExtension" | "fibChannel" | "fibProjection" | "fibFan" | "fibCircles" | "fibSpiral" | "fibTimezone" | "flatChannel" | "parallelChannel" | "disjointChannel" | "pitchfork" | "schiffPitchfork" | "modifiedSchiff" | "insidePitchfork" | "crossLine" | "trendAngle" | "arc" | "sineLine" | "rotatedRectangle" | "path" | "polyline" | "brush" | "highlighter" | "text" | "callout" | "priceLabel" | "priceNote" | "anchoredNote" | "arrowUp" | "arrowDown" | "arrowMarker" | "flag" | "volumeProfile" | "anchoredVP" | "fixedRangeVP" | "abcdPattern" | "gartleyPattern" | "batPattern" | "butterflyPattern" | "crabPattern" | "sharkPattern" | "cypherPattern" | "headShoulders" | "trianglePattern" | "threeDrives" | "elliottImpulse" | "elliottCorrective" | "elliottTriangle" | "elliottWxy" | "elliottCombination" | "gannFan" | "gannSquare" | "gannBox" | "priceRange" | "dateRange" | "datePriceRange" | "ruler" | "regressionTrend" | "projection" | "cyclicLines" | "timeCycles" | "priceProjection" | "ghostFeed"; interface DrawingPoint { barIndex: number; price: number; /** Unix-ms timestamp of the bar at this point — used to re-anchor drawings after data reload. */ timestamp?: number; } /** A resize handle on a drawing — identifies which point can be dragged */ interface DrawingHandle { pointIndex: number; cursor: string; } /** Base per-instance style fields applicable to every drawing. */ interface DrawingStyle { /** Primary line/border/marker color. */ strokeColor?: string; /** Stroke width in px (typically 1–4). */ lineWidth?: number; /** Dash pattern for lines and shape borders. */ lineStyle?: 'solid' | 'dashed' | 'dotted'; /** Fill color for shapes that have a fill (rectangle, channel, fib level fills). */ fillColor?: string; /** Fill opacity (0..1). */ fillOpacity?: number; } /** Extends DrawingStyle for text-bearing drawings (text, callout, anchoredNote, priceNote). */ interface DrawingTextStyle extends DrawingStyle { /** Foreground text color. */ textColor?: string; /** Font size in px (default 13). */ fontSize?: number; } /** Per-level visibility + color for multi-level drawings (fib family, gann box). */ interface DrawingLevelStyle { visible: boolean; color: string; } /** Extends DrawingStyle for fib/multi-level drawings. */ interface DrawingFibStyle extends DrawingStyle { /** Map of level value (as string, e.g. '0', '0.236', '0.5', '1') → per-level style. */ levels?: Record; } /** Union of all drawing style shapes. */ type AnyDrawingStyle = DrawingStyle | DrawingTextStyle | DrawingFibStyle; interface IDrawing { id: string; type: DrawingToolType; points: DrawingPoint[]; complete: boolean; visible?: boolean; locked?: boolean; text?: string; /** Optional per-instance style override; falls back to theme defaults when absent. */ style?: AnyDrawingStyle; render(ctx: CanvasRenderingContext2D, scale: ScaleManager, viewport: Viewport, priceRange: PriceRange, chartW: number, chartH: number, isSelected: boolean, pricePrecision?: number, theme?: ChartTheme): void; hitTest(x: number, y: number, scale: ScaleManager, viewport: Viewport, priceRange: PriceRange, chartW: number, chartH: number): boolean; /** Returns the handle under (x, y), or null if none */ getHandle(x: number, y: number, scale: ScaleManager, viewport: Viewport, priceRange: PriceRange, chartW: number, chartH: number): DrawingHandle | null; } type StreamStatus = "connected" | "disconnected" | "reconnecting"; interface Tick { time: number; bid: number; ask: number; volume: number; } interface IWebSocketAdapter { connect(): void; disconnect(): void; onTick(callback: (tick: Tick) => void): void; onStatus(callback: (status: StreamStatus) => void): void; } type IndicatorParams = Record; interface ActiveIndicatorState { indicator: IIndicator; shortName: string; currentParams: IndicatorParams; visible: boolean; } /** Serializable snapshot of a drawing — contains only data fields, no methods. */ interface SerializedDrawing { id: string; type: DrawingToolType; points: DrawingPoint[]; complete: boolean; visible?: boolean; text?: string; locked?: boolean; /** Optional per-instance style override; absent for drawings using theme defaults. */ style?: AnyDrawingStyle; } /** Serializable per-symbol chart state emitted via the `stateChange` event. */ interface IndicatorStateEntry { shortName: string; params: IndicatorParams; visible?: boolean; } /** Color overrides for the chart canvas elements (background, grid, candles, etc.). */ interface CanvasColorSettings { background: string; grid: string; axisText: string; axisBorder: string; crosshair: string; candleUp: string; candleDown: string; wickUp: string; wickDown: string; borderUp: string; borderDown: string; volumeUp: string; volumeDown: string; } /** Full serializable snapshot of user-configured chart state per symbol. */ interface ChartState { symbol: string; timeframe: Timeframe; duration?: Duration; series: SeriesType; showVolume: boolean; theme: 'dark' | 'light'; indicators: IndicatorStateEntry[]; drawings: SerializedDrawing[]; /** User-selected position render style (line / dot). */ positionRenderStyle?: PositionRenderStyle; /** Which trade level types are visible on the chart. */ tradeDisplayFilter?: TradeDisplayFilter; /** Per-theme canvas color overrides set via the Settings dialog. */ canvasColors?: { dark?: Partial; light?: Partial; }; /** Whether TFC (Trade from Charts) is currently active (user toggle state). */ tfcEnabled?: boolean; /** * Visible time window, anchored by absolute unix-ms timestamps of the * viewport edges. Persisted separately from `drawings` so that pan/zoom * state survives a refresh without affecting drawing anchors. Stored as * time (not bar indexes) so the window remains meaningful after timeframe * changes and data backfill. */ viewport?: { startTime: number; endTime: number; }; /** * User-applied Y-axis adjustments. `factor` is the price-range scale * (>1 = zoomed out, <1 = zoomed in); `panOffset` is the vertical drag * offset in price units. Resets to `{factor: 1, panOffset: 0}` in * auto-fit mode. */ priceScale?: { factor: number; panOffset: number; }; } interface CrosshairPosition { x: number; y: number; barIndex: number; price: number; bar: OHLCVBar | null; } type ChartEventMap = { crosshair: CrosshairPosition; click: CrosshairPosition; zoom: { viewport: Viewport; }; pan: { viewport: Viewport; }; timeframeChange: { timeframe: Timeframe; }; durationChange: { duration: Duration; timeframe: Timeframe; }; seriesChange: { series: SeriesType; }; streamStatus: { status: StreamStatus; }; /** Emitted after a full data reload (initial load or timeframe/duration change). * Consumers can use this to reconnect a live stream with the new params. */ dataLoaded: { timeframe: Timeframe; interval: string; start: Date; end: Date; }; /** Emitted when the user clicks the × button on a trade, position, or bracket (SL/TP) level. */ tradeLevelClose: { label: string; type: TradeLevelType; /** CLOSED = position closed; CANCELLED = order cancelled; REMOVE_SL / REMOVE_TP = bracket removed. */ action: 'CLOSED' | 'CANCELLED' | 'REMOVE_SL' | 'REMOVE_TP'; /** The specific level/order being closed — bracket order's data when closing an SL/TP, parent's data otherwise. */ data: unknown; /** Present only when closing an SL or TP bracket line (not the main level). */ bracketType?: 'SL' | 'TP'; /** True when the chart is in fullscreen mode (native or CSS) at the time of the action. */ isFullscreen: boolean; }; /** Emitted when user finishes dragging a pending/position level line to a new price. */ tradeLevelDragEnd: { label: string; type: TradeLevelType; newPrice: number; data: unknown; }; /** Emitted when user finishes dragging a bracket (SL/TP) line of a pending order. */ tradeLevelBracketDrag: { label: string; bracketType: 'stopLoss' | 'takeProfit'; newPrice: number; data: unknown; }; /** Emitted when user clicks the Edit (pencil) button on a level. Use to open/pre-fill an external order panel. */ tradeLevelEditOpen: { label: string; type: TradeLevelType; data: unknown; price: number; side?: 'buy' | 'sell'; stopLossPrice?: number; takeProfitPrice?: number; /** True when the chart is in fullscreen mode (native or CSS) at the time of the action. */ isFullscreen: boolean; }; /** Emitted on every mouse-move while dragging a trade level line (before confirm). * `bracketType` is present when dragging an SL/TP bracket line; absent for main entry drag. * `derivedSLPrice` / `derivedTPPrice` are present during a main-entry drag in follow-brackets mode * so external panels can mirror the SL/TP translation live (keeps validation from flickering). */ tradeLevelDrag: { label: string; newPrice: number; data: unknown; bracketType?: 'stopLoss' | 'takeProfit'; derivedSLPrice?: number; derivedTPPrice?: number; isFullscreen: boolean; }; /** Emitted at the instant a bracket (SL/TP) drag begins — before any movement. * Native layers listen to this to suppress tap-outside dismiss while dragging. */ tradeLevelDragStart: { label: string; bracketType: 'stopLoss' | 'takeProfit'; isFullscreen: boolean; }; /** Emitted when chart's ✓ button confirms an edit (including draft orders). External panel listens to reset/close itself. */ tradeLevelConfirmed: { label: string; type: TradeLevelType | 'draft'; isFullscreen: boolean; }; /** Emitted when an in-progress level edit is cancelled from the chart (ESC key or inline ✕ cancel button). * Mirrors `tradeLevelConfirmed` but for the revert path. Not fired for draft orders (those emit `draftCancelled`). * External panels listen to reset their modify-order form when the user aborts the edit from the chart side. */ tradeLevelEditCancelled: { label: string; type: TradeLevelType; isFullscreen: boolean; }; /** Emitted when a draft order is cancelled (Escape, ✕ button, or external revert). */ draftCancelled: { label: string; isFullscreen: boolean; }; /** Emitted when a new draft order is shown on the chart (market or limit/stop). * Native layer listens to open the buy/sell form. */ draftInitiated: { side: 'buy' | 'sell'; price: number; orderType: 'limit' | 'stop' | 'market'; isFullscreen: boolean; }; /** Emitted after any user-driven change to chart configuration (timeframe, series, indicators, drawings, etc.). * The payload is a full serializable snapshot — consumers can persist it keyed by symbol. */ stateChange: { symbol: string; state: ChartState; }; /** Emitted when a candle period closes and a new one opens (detected via tick timestamp). * `completedBar` is the tick-reconstructed closed candle — may diverge from exchange OHLCV. * `openingBar` is the newly appended candle. * `intervalMs` is the candle duration — use it to build the re-fetch window. * The library automatically re-fetches via `dataLoader` if one is configured; this event * is emitted regardless so consumers can react (e.g. update external state). */ newBar: { completedBar: OHLCVBar; openingBar: OHLCVBar; intervalMs: number; }; /** Emitted after addLevelBracket() / addBracket() auto-places a SL or TP bracket so consumers can populate their form's price field. label is an empty string when the bracket was placed on a draft order (no external ID yet). */ tradeLevelBracketActivated: { label: string; bracketType: 'sl' | 'tp'; price: number; isFullscreen: boolean; }; /** Emitted when TFC (Trade from Charts) is toggled on or off via the top bar button or API. */ tfcToggle: { enabled: boolean; }; /** Emitted whenever any dismissible UI (flyout, modal, dropdown, popover) opens or closes. * Hosts (native wrappers, PWAs) listen to track whether a back button / gesture should * dismiss chart UI vs. navigate. Pair with `dismissAllUI()` to wire platform back events. */ uiStateChange: { hasOpenUI: boolean; }; /** Emitted live while the user edits lot qty via the QTY pill flyout, before the * level edit is confirmed. Use this to recompute qty-derived UI (e.g. Estimated * PNL on SL/TP brackets) in real time. Final committed qty still arrives on * `tradeLevelEdit.newLots` at ✓ confirm (or immediately for draft orders). * `type` is `'draft'` for the in-progress draft order, otherwise the parent level's type. * `previousLots` is the qty at edit-session start (useful for revert-aware previews). */ tradeLevelQtyChange: { label: string; type: TradeLevelType | 'draft'; newLots: number; previousLots: number; isFullscreen: boolean; }; /** Emitted when the user confirms all edits to a level — replaces separate tradeLevelDragEnd / tradeLevelBracketDrag events. */ tradeLevelEdit: { label: string; type: TradeLevelType; /** * Parent level's data. When the user edited the lot size during this session, * the `lots` field of this object is overridden with the new value for convenience * (so `data.lots` always reflects the effective qty being submitted). The original * server fields (e.g. `Quantity`) are left untouched — use `newLots` when you need * to distinguish "edited" from "unchanged". */ data: unknown; /** True when the chart is in fullscreen mode (native or CSS) at the time of the action. */ isFullscreen: boolean; /** Present when the user changed the lot size via the QTY pill flyout during this edit session. */ newLots?: number; changes: Array<{ /** MAIN = entry price edit; SL/TP = bracket edit; ADD_SL/ADD_TP = new bracket placed; REMOVE_SL/REMOVE_TP = bracket removed. */ field: 'MAIN' | 'SL' | 'TP' | 'ADD_SL' | 'ADD_TP' | 'REMOVE_SL' | 'REMOVE_TP'; newPrice: number; /** * Bracket order's data when the bracket is a ToClose order; parent's data for inline brackets. * On the MAIN change, `lots` is overridden with the new qty when the user edited it (same rule as the top-level `data`). */ data: unknown; /** Present on the MAIN change when the user edited the lot size during this session. */ newLots?: number; bracketOrderLabel?: string; }>; }; }; /** Distinguishes level types: historical trade, open position, or pending order. */ type TradeLevelType = 'trade' | 'position' | 'pending'; /** Controls which level types are visible on the chart. */ type TradeDisplayFilter = 'all' | 'positions' | 'orders' | 'none'; /** Controls the visual rendering style for position levels. */ type PositionRenderStyle = 'line' | 'dot'; /** * A horizontal price level for a historical/closed trade. * Rendered as a line with a compact info box — no PnL display. */ interface TradeLevel { /** Unique identifier for this level — used for hit testing and events. */ label: string; /** * Text displayed in the info box. Falls back to `label` when omitted. * Use this to send consumer-formatted strings like "Buy 0.01 lot". */ text?: string; /** Price at which the line is drawn. */ price: number; type: 'trade'; /** * Your original trade object. Returned as-is in the `tradeLevelClose` event. * The library never inspects this value. */ data?: unknown; } /** * A horizontal price level for an open position with optional live PnL display. * Rendered as a line with a compact info box; PnL row shown when `pnlText` is provided. */ interface PositionLevel { /** Unique identifier for this level — used for hit testing and events. */ label: string; /** * Text displayed in the info box. Falls back to `label` when omitted. * Use this to send consumer-formatted strings like "Buy 0.01 lot". */ text?: string; /** Entry price at which the line is drawn. */ price: number; type: 'position'; /** * Pre-computed PnL value (sign determines badge color: positive=green, negative=red). * The library does not calculate this — compute it in your consumer using your own * price feed, currency, and fee logic. */ pnl?: number; /** * Pre-formatted PnL string rendered verbatim in the box (e.g. "+$42.10 (+0.8%)"). * Only displayed when present. Format and currency are owned by the consumer. */ pnlText?: string; /** Side of the position — 'buy' for long, 'sell' for short. Required to color and constrain SL/TP bracket lines. */ side?: 'buy' | 'sell'; /** Stop-loss price. Renders as a secondary dashed line below entry (buy) or above (sell). Draggable — emits `tradeLevelBracketDrag`. */ stopLossPrice?: number; /** Data object for the SL bracket — returned in SL-related events instead of the parent's `data`. */ stopLossData?: unknown; /** Take-profit price. Renders as a secondary dashed line above entry (buy) or below (sell). Draggable — emits `tradeLevelBracketDrag`. */ takeProfitPrice?: number; /** Data object for the TP bracket — returned in TP-related events instead of the parent's `data`. */ takeProfitData?: unknown; /** * When true, the entry price line becomes draggable — renders a grip handle and emits * `tradeLevelEdit` with `field: 'main'` on confirm. Use this for pending entry orders * (e.g. Entry Limit / Entry Stop) that should display like open positions but still allow * the entry price to be modified. */ entryPriceEditable?: boolean; /** * For entry orders rendered as position levels (e.g. Entry Limit / Entry Stop): * 'limit' → entry must stay on the limit side of market price (buy below, sell above). * 'stop' → entry must stay on the stop side (buy above, sell below). * Omit for regular open positions — no market-side constraint is applied. */ orderType?: 'limit' | 'stop'; /** Lot size for Entry Limit / Entry Stop orders — shown in the info box label. */ lots?: number; /** * Your original position object. Returned as-is in the `tradeLevelClose` event. * The library never inspects this value. */ data?: unknown; } /** * A horizontal price level for a pending (open) order — limit or stop. * Rendered as a dashed line with side-colored info box and optional SL/TP sub-lines. * The grip handle on the left allows dragging to modify the order price. */ interface PendingOrderLevel { /** Unique identifier — used for hit testing, events, and drag. */ label: string; /** Text in the info box. Falls back to `label` when omitted. */ text?: string; /** Order price — the main draggable line. */ price: number; type: 'pending'; side: 'buy' | 'sell'; orderType: 'limit' | 'stop' | 'market'; /** Lot size — displayed in the info box when present. */ lots?: number; /** * Stop-loss price. Renders as a secondary dashed line below the order price * (for buy orders) or above (for sell orders). Draggable — emits `tradeLevelBracketDrag`. */ stopLossPrice?: number; /** Data object for the SL bracket — returned in SL-related events instead of the parent's `data`. */ stopLossData?: unknown; /** * Take-profit price. Renders as a secondary dashed line above the order price * (for buy orders) or below (for sell orders). Draggable — emits `tradeLevelBracketDrag`. */ takeProfitPrice?: number; /** Data object for the TP bracket — returned in TP-related events instead of the parent's `data`. */ takeProfitData?: unknown; /** * If set, this order is an SL/TP bracket for the level whose label equals this value. * It will NOT render as a standalone line — instead it populates `stopLossPrice` or * `takeProfitPrice` on the parent level. Bracket type is inferred by price vs parent price * using the parent's `side` field (buy: price below parent → SL, above → TP; sell: reversed). */ ToClose?: string; /** Your original order object. Returned as-is in events. The library never inspects this. */ data?: unknown; } /** Union of all level types — use this wherever a level is accepted or stored. */ type AnyLevel = TradeLevel | PositionLevel | PendingOrderLevel; type PriceSource = 'open' | 'high' | 'low' | 'close'; declare class SMA implements IIndicator { private readonly period; private readonly source; readonly name: string; readonly color: string; constructor(period: number, color?: string, name?: string, source?: PriceSource); compute(data: OHLCVBar[]): IndicatorResult[]; render(ctx: CanvasRenderingContext2D, results: IndicatorResult[], scale: ScaleManager, viewport: Viewport, chartHeight: number): void; } declare class EMA implements IIndicator { private readonly period; private readonly source; readonly name: string; readonly color: string; constructor(period: number, color?: string, name?: string, source?: PriceSource); compute(data: OHLCVBar[]): IndicatorResult[]; render(ctx: CanvasRenderingContext2D, results: IndicatorResult[], scale: ScaleManager, viewport: Viewport, chartHeight: number): void; } declare class BollingerBands implements IIndicator { private readonly period; private readonly stdDevMultiplier; private readonly source; readonly name: string; readonly color: string; constructor(period?: number, stdDevMultiplier?: number, color?: string, name?: string, source?: PriceSource); compute(data: OHLCVBar[]): IndicatorResult[]; render(ctx: CanvasRenderingContext2D, results: IndicatorResult[], scale: ScaleManager, viewport: Viewport, chartHeight: number): void; } declare class RSI implements IIndicator { private readonly period; private readonly source; readonly name: string; readonly color: string; readonly pane: "sub"; readonly paneHeight = 80; constructor(period?: number, color?: string, name?: string, source?: PriceSource); compute(data: OHLCVBar[]): IndicatorResult[]; getValueRange(_results: IndicatorResult[]): PriceRange; render(ctx: CanvasRenderingContext2D, results: IndicatorResult[], scale: ScaleManager, viewport: Viewport, paneHeight: number, rangeOverride?: PriceRange): void; } declare class MACD implements IIndicator { private readonly fast; private readonly slow; private readonly signal; private readonly source; readonly name: string; readonly color: string; readonly pane: "sub"; readonly paneHeight = 80; constructor(fast?: number, slow?: number, signal?: number, color?: string, name?: string, source?: PriceSource); compute(data: OHLCVBar[]): IndicatorResult[]; getValueRange(results: IndicatorResult[]): PriceRange; render(ctx: CanvasRenderingContext2D, results: IndicatorResult[], scale: ScaleManager, viewport: Viewport, paneHeight: number, rangeOverride?: PriceRange): void; } export { type IndicatorOverlayColors as $, type AnyDrawingStyle as A, BollingerBands as B, type ChartConfig as C, type DrawingToolType as D, DEFAULT_DRAWING_TOOLBAR_CONFIG as E, DEFAULT_INDICATOR_OVERLAY_CONFIG as F, DEFAULT_LABELS as G, DEFAULT_PRICE_AXIS_CONFIG as H, type IIndicator as I, DEFAULT_TIME_AXIS_CONFIG as J, DEFAULT_TOP_BAR_CONFIG as K, DEFAULT_TRADE_BUTTON_CONFIG as L, DEFAULT_UI_CONFIG as M, type DataLoaderParams as N, type OHLCVBar as O, type PriceRange as P, type DeepPartial$1 as Q, type DeepPartialChartTheme as R, type SeriesType as S, type Timeframe as T, type DialogLabels as U, type Viewport as V, type DrawingToolbarColors as W, type DrawingToolbarLabels as X, type DrawingToolbarUiConfig as Y, type Duration as Z, EMA as _, type ChartEventMap as a, type IndicatorOverlayUiConfig as a0, type IndicatorParams as a1, type IndicatorResult as a2, type IndicatorStateEntry as a3, LIGHT_THEME as a4, MACD as a5, type OhlcLabels as a6, type OrderSubmit as a7, type Padding as a8, type PendingOrderLevel as a9, type PositionLevel as aa, type PositionRenderStyle as ab, type PriceAxisUiConfig as ac, RSI as ad, SMA as ae, type Theme as af, type ThemeOverrides as ag, type TimeAxisUiConfig as ah, type TopBarColors as ai, type TopBarLabels as aj, type TopBarUiConfig as ak, type TradeButtonUiConfig as al, type TradeDisplayFilter as am, type TradeLabels as an, type TradeLevel as ao, type TradeLevelColors as ap, type TradePanelColors as aq, type UiConfig as ar, deepMergeTheme as as, resolveCssVarsInTheme as at, resolveLabels as au, resolveUiConfig as av, type PriceSource as aw, type ChartState as b, type IDrawing as c, type IWebSocketAdapter as d, type TradeLevelType as e, type AnyLevel as f, type DrawingPoint as g, ScaleManager as h, type DrawingHandle as i, type ChartTheme as j, type SerializedDrawing as k, type Tick as l, type StreamStatus as m, type ActiveIndicatorState as n, type BottomBarColors as o, type BottomBarLabels as p, type BottomBarUiConfig as q, type CanvasColorSettings as r, type ChartLabels as s, type ChartMiscLabels as t, type ChartThemeUi as u, type CrosshairPosition as v, type CrosshairUiConfig as w, DARK_THEME as x, DEFAULT_BOTTOM_BAR_CONFIG as y, DEFAULT_CROSSHAIR_CONFIG as z };