acttrader-charts 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -187,6 +187,10 @@ chart.on('tradeLevelDrag', ({ label, newPrice, bracketType, isFullscreen }) => {
187
187
  });
188
188
  ```
189
189
 
190
+ **Off-viewport level indicators:**
191
+
192
+ When a trade level's entry, SL, or TP price lies outside the visible price range, a small pill (`▲ N` / `▼ N`) appears near the right edge of the chart showing the count of off-screen markers per direction. Clicking the pill smooth-scrolls the nearest off-viewport marker to the vertical center of the chart. This requires no configuration — it activates automatically whenever levels are present.
193
+
190
194
  **Drag constraints (enforced live):**
191
195
 
192
196
  | Order side | Stop Loss | Take Profit |
@@ -218,7 +222,7 @@ When `enableTrading` is on and live BID/ASK data is streaming, hovering / activa
218
222
  | `theme` | | `"dark"` | `"dark"` or `"light"` |
219
223
  | `series` | | `"candlestick"` | Initial chart type |
220
224
  | `showVolume` | | `true` | Show volume overlay |
221
- | `showUI` | | `true` | Render top / bottom / left bars |
225
+ | `showUI` | | `true` | Render top / bottom / left bars. When `false`, the loading overlay is also suppressed (mobile wrappers provide their own) |
222
226
  | `showDrawingTools` | | `true` | Show drawing toolbar and pencil button |
223
227
  | `timeframe` | | `"1D"` | Initial timeframe |
224
228
  | `duration` | | — | Initial active duration button |
@@ -229,6 +233,7 @@ When `enableTrading` is on and live BID/ASK data is streaming, hovering / activa
229
233
  | `minLots` | | `1` | Default lot size in the trade popover |
230
234
  | `tickActivityMs` | | `30000` | ms the stream dot stays green after last tick |
231
235
  | `maxCandles` | | `200` | Max bars fetched per data-load request |
236
+ | `prefetchThreshold` | | `80` | Bars from start of data at which historical fetch triggers (min 20) |
232
237
  | `mobileBarDivisor` | | `2` | Divide desktop visible bar count on touch devices (`2`, `3`, or `4`) |
233
238
  | `targetCandleWidth` | | `10` | Target px width per candle for auto-calculating initial bar count |
234
239
  | `durationTimeframeMap` | | *(see below)* | Override duration → timeframe pairings |
@@ -245,6 +250,11 @@ When `enableTrading` is on and live BID/ASK data is streaming, hovering / activa
245
250
  | `tradeDisplayFilter` | | `"all"` | Which TFC levels are visible: `"all"` · `"positions"` · `"orders"` · `"none"` |
246
251
  | `positionRenderStyle` | | auto | Force position render style: `"line"` or `"dot"` |
247
252
  | `hideLevelConfirmCancel` | | `false` | Hide on-canvas ✓/✗ confirm-cancel buttons for TFC level edits |
253
+ | `tfcEnabled` | | `true` | Enable the TFC toggle button in the top bar. When `false`, TFC is completely disabled — the toggle button is hidden and all trade levels, draft orders, and the floating trade button are suppressed |
254
+ | `levelClusteringEnabled` | | `true` | Enable trade-level fan-out clustering; overlapping levels group into expandable badges |
255
+ | `clusterThresholdDistance` | | `20` | Pixel proximity threshold for clustering (only when `levelClusteringEnabled` is `true`) |
256
+ | `hideSymbolAndTick` | | `false` | Hide the symbol name, OHLC strip, and tick-activity dot overlay |
257
+ | `showBottomBar` | | `false` | Show the bottom duration-selector bar |
248
258
  | `hideQtyButton` | | `false` | Hide the floating Qty input overlay on draft orders |
249
259
  | `tradesThresholdForHorizontalLine` | | `2` | Level count above which render auto-switches to `"dot"` mode |
250
260
  | `canvasColors` | | — | Per-theme canvas background color overrides (persisted from Settings dialog) |
@@ -295,12 +305,15 @@ import { DEFAULT_UI_CONFIG } from 'acttrader-charts';
295
305
  | Component key | Configurable properties |
296
306
  |---|---|
297
307
  | `drawingToolbar` | `iconBtnSize`, `iconFontSize`, `iconFontFamily`, `flyoutLabelFontSize`, `flyoutLabelFontFamily`, `shortcutFontSize`, `soonBadgeFontSize`, `flyoutHeadingFontSize`, `flyoutHeadingLetterSpacing`, `scrollBtnHeight`, `scrollBtnFontSize`, `barPadding`, `btnGap` |
298
- | `topBar` | `height`, `dropBtnFontSize`, `dropBtnFontFamily`, `drawBtnSize`, `drawBtnIconFontSize`, `flyoutRowFontSize`, `flyoutRowFontFamily`, `flyoutCategoryFontSize`, `flyoutCategoryLetterSpacing`, `flyoutCheckFontSize`, `streamDotSize` |
308
+ | `topBar` | `height`, `dropBtnFontSize`, `dropBtnFontFamily`, `drawBtnSize`, `drawBtnIconFontSize`, `iconBtnSize`, `mobileIconBtnSize`, `mobileDrawBtnIconSize`, `flyoutRowFontSize`, `flyoutRowFontFamily`, `flyoutCategoryFontSize`, `flyoutCategoryLetterSpacing`, `flyoutCheckFontSize`, `streamDotSize` |
299
309
  | `bottomBar` | `height`, `btnFontSize`, `btnFontFamily` |
300
310
  | `priceAxis` | `fontSize`, `fontFamily` |
301
311
  | `timeAxis` | `fontSize`, `fontFamily` |
302
312
  | `crosshair` | `labelHeight`, `labelPaddingX`, `fontSize`, `fontFamily` |
303
313
  | `indicatorOverlay` | `pillFontSize`, `pillFontFamily`, `dotFontSize`, `pillIconFontSize`, `collapseBtnFontSize`, `collapseBtnFontFamily`, `dropdownRowFontSize`, `dropdownRowFontFamily`, `dropdownIconFontSize` |
314
+ | `tradeButton` | `size`, `mobileSize`, `iconSize`, `mobileIconSize` |
315
+
316
+ **Mobile icon sizing:** When the chart container is narrower than `drawingToolbar.mobileBreakpoint` (default `480`), the top-bar icon buttons (settings, fullscreen, drawing toggle) and the floating trade ⊕ button use their mobile sizes automatically. Defaults: top-bar icon buttons grow `26px → 28px` (icon SVG +2px), trade button grows `22px → 24px` (icon `14px → 16px`). Override any of these values via `uiConfig.topBar.mobileIconBtnSize`, `uiConfig.topBar.mobileDrawBtnIconSize`, or `uiConfig.tradeButton.mobileSize` / `mobileIconSize`.
304
317
 
305
318
  **Example:**
306
319
 
@@ -324,6 +337,7 @@ import {
324
337
  DEFAULT_TOP_BAR_CONFIG,
325
338
  DEFAULT_PRICE_AXIS_CONFIG,
326
339
  DEFAULT_CROSSHAIR_CONFIG,
340
+ DEFAULT_TRADE_BUTTON_CONFIG,
327
341
  // ...
328
342
  } from 'acttrader-charts';
329
343
  ```
@@ -472,6 +486,8 @@ chart.setLoading(loading: boolean): this
472
486
  ```ts
473
487
  chart.setSeries(series: SeriesType): this
474
488
  chart.setTheme('dark' | 'light'): this
489
+ chart.setTimeframe(tf: Timeframe): this // change timeframe and reload data
490
+ chart.setThemeOverrides(overrides: ThemeOverrides): this // update per-theme color overrides at runtime
475
491
  chart.setVolume(show: boolean): this
476
492
  ```
477
493
 
@@ -498,6 +514,7 @@ chart.removeLevelByLabel(label: string): this
498
514
  chart.cancelCurrentEdit(): this // cancel the active draft order or in-progress level edit; no-op when nothing is active
499
515
  chart.addLevelBracket(label: string, bracketType: 'sl' | 'tp'): this // auto-place a SL or TP bracket at a default offset; emits tradeLevelBracketActivated with the computed price
500
516
  chart.setDraftBracketPnl(bracketType: 'sl' | 'tp', pnlText: string | null): this // set estimated P&L text on a draft order bracket line; pass null to clear
517
+ chart.setTfcActive(enabled: boolean): this // toggle TFC on/off at runtime; hides/shows all trade levels, draft orders, and floating trade button; fires tfcToggle event
501
518
  ```
502
519
 
503
520
  ### Trade Button
@@ -674,6 +691,7 @@ chart.on('tradeLevelEditOpen', ({ label, type, price, side, stopLossPrice, takeP
674
691
  chart.on('tradeLevelConfirmed',({ label, type, isFullscreen }) => {});
675
692
  chart.on('draftInitiated', ({ side, price, orderType, isFullscreen }) => {}); // new draft order shown — open buy/sell form
676
693
  chart.on('draftCancelled', ({ label, isFullscreen }) => {}); // draft order dismissed without confirming
694
+ chart.on('tfcToggle', ({ enabled }) => {}); // TFC toggled on or off via top bar button or setTfcActive()
677
695
  chart.on('tradeLevelDragEnd', ({ label, type, newPrice, data }) => {}); // deprecated — use tradeLevelEdit
678
696
  chart.on('tradeLevelBracketDrag', ({ label, bracketType, newPrice, data }) => {}); // deprecated
679
697
 
@@ -49,6 +49,12 @@ interface TopBarUiConfig {
49
49
  drawBtnSize: string;
50
50
  /** Font size for the icon inside the drawing toggle button */
51
51
  drawBtnIconFontSize: string;
52
+ /** Size (width = height) of icon-only buttons (settings, fullscreen) — desktop */
53
+ iconBtnSize: string;
54
+ /** Size (width = height) of icon-only buttons — mobile override */
55
+ mobileIconBtnSize: string;
56
+ /** SVG icon dimension inside the drawing toggle button — mobile override */
57
+ mobileDrawBtnIconSize: string;
52
58
  /** Font size for flyout list rows */
53
59
  flyoutRowFontSize: string;
54
60
  /** Font family for flyout list rows */
@@ -112,6 +118,16 @@ interface IndicatorOverlayUiConfig {
112
118
  /** Font size for gear ⚙ and remove ✕ icons inside dropdown rows */
113
119
  dropdownIconFontSize: string;
114
120
  }
121
+ interface TradeButtonUiConfig {
122
+ /** Button diameter (px) — desktop */
123
+ size: number;
124
+ /** Button diameter (px) — mobile override */
125
+ mobileSize: number;
126
+ /** SVG icon dimension (px) — desktop */
127
+ iconSize: number;
128
+ /** SVG icon dimension (px) — mobile override */
129
+ mobileIconSize: number;
130
+ }
115
131
  interface UiConfig {
116
132
  drawingToolbar: DrawingToolbarUiConfig;
117
133
  topBar: TopBarUiConfig;
@@ -120,6 +136,7 @@ interface UiConfig {
120
136
  timeAxis: TimeAxisUiConfig;
121
137
  crosshair: CrosshairUiConfig;
122
138
  indicatorOverlay: IndicatorOverlayUiConfig;
139
+ tradeButton: TradeButtonUiConfig;
123
140
  }
124
141
  declare const DEFAULT_DRAWING_TOOLBAR_CONFIG: DrawingToolbarUiConfig;
125
142
  declare const DEFAULT_TOP_BAR_CONFIG: TopBarUiConfig;
@@ -128,6 +145,7 @@ declare const DEFAULT_PRICE_AXIS_CONFIG: PriceAxisUiConfig;
128
145
  declare const DEFAULT_TIME_AXIS_CONFIG: TimeAxisUiConfig;
129
146
  declare const DEFAULT_CROSSHAIR_CONFIG: CrosshairUiConfig;
130
147
  declare const DEFAULT_INDICATOR_OVERLAY_CONFIG: IndicatorOverlayUiConfig;
148
+ declare const DEFAULT_TRADE_BUTTON_CONFIG: TradeButtonUiConfig;
131
149
  declare const DEFAULT_UI_CONFIG: UiConfig;
132
150
  type DeepPartial$1<T> = {
133
151
  [K in keyof T]?: T[K] extends object ? DeepPartial$1<T[K]> : T[K];
@@ -171,6 +189,8 @@ interface TopBarLabels {
171
189
  exitFullscreenTitle: string;
172
190
  /** Tooltip on the chart-settings button. */
173
191
  settingsTitle: string;
192
+ /** Tooltip on the TFC (Trade from Charts) toggle button. */
193
+ tfcToggleTitle: string;
174
194
  }
175
195
  interface BottomBarLabels {
176
196
  /** Duration selector button labels. */
@@ -510,6 +530,14 @@ interface DataLoaderParams {
510
530
  end: Date;
511
531
  interval: string;
512
532
  }
533
+ /**
534
+ * Per-theme deep-partial color overrides applied on top of the built-in
535
+ * dark / light themes. Only the keys you supply are replaced.
536
+ */
537
+ type ThemeOverrides = {
538
+ dark?: DeepPartialChartTheme;
539
+ light?: DeepPartialChartTheme;
540
+ };
513
541
  interface ChartConfig {
514
542
  container: HTMLElement;
515
543
  theme?: Theme;
@@ -592,10 +620,7 @@ interface ChartConfig {
592
620
  * light: { background: 'var(--sidebar-bg-light)' },
593
621
  * }
594
622
  */
595
- themeOverrides?: {
596
- dark?: DeepPartialChartTheme;
597
- light?: DeepPartialChartTheme;
598
- };
623
+ themeOverrides?: ThemeOverrides;
599
624
  /**
600
625
  * Optional per-component UI configuration overrides (font sizes, icon
601
626
  * sizes, spacing). Only the keys you provide are overridden; all others
@@ -627,6 +652,12 @@ interface ChartConfig {
627
652
  * of bars. Default: 200.
628
653
  */
629
654
  maxCandles?: number;
655
+ /**
656
+ * How close (in bars) the viewport must be to the start of loaded data
657
+ * before a historical fetch is triggered. Higher values prefetch earlier.
658
+ * Clamped to a minimum of 20. Default: 80 (one screen-width of bars).
659
+ */
660
+ prefetchThreshold?: number;
630
661
  /**
631
662
  * On touch/mobile devices, the initial visible bar count is
632
663
  * `DEFAULT_VISIBLE_BARS / mobileBarDivisor`. Accepted values: 2, 3, 4.
@@ -743,6 +774,21 @@ interface ChartConfig {
743
774
  * }
744
775
  */
745
776
  aggregateFrom?: Partial<Record<Timeframe, Timeframe>>;
777
+ /**
778
+ * Enable trade-level fan-out clustering. When `true`, overlapping
779
+ * trade levels whose Y pixel positions are within `clusterThresholdDistance`
780
+ * pixels are grouped into a single expandable cluster badge.
781
+ * Default: `true`.
782
+ */
783
+ levelClusteringEnabled?: boolean;
784
+ /**
785
+ * Pixel proximity threshold for level clustering. Levels whose Y pixel
786
+ * positions are within this distance get grouped into a cluster.
787
+ * Only effective when `levelClusteringEnabled` is `true` (default). Set to
788
+ * a higher value for more aggressive grouping, lower for tighter grouping.
789
+ * Default: `20`.
790
+ */
791
+ clusterThresholdDistance?: number;
746
792
  /**
747
793
  * Hide the ✓ / ✗ confirm-cancel buttons on trade levels that have pending changes.
748
794
  * Use when the host app provides its own native confirm/cancel controls.
@@ -754,11 +800,30 @@ interface ChartConfig {
754
800
  * Default: `false` — the toggle is hidden.
755
801
  */
756
802
  enableThemeToggle?: boolean;
803
+ /**
804
+ * Hide the symbol name, OHLC strip, and tick-activity dot overlay
805
+ * shown in the top-left corner of the chart canvas.
806
+ * Default: `false` (overlay is visible).
807
+ */
808
+ hideSymbolAndTick?: boolean;
809
+ /**
810
+ * Show the bottom duration-selector bar.
811
+ * Default: `false` (bar is hidden).
812
+ */
813
+ showBottomBar?: boolean;
757
814
  /**
758
815
  * @deprecated DraftOrderQtyInput has been removed. This option is a no-op.
759
816
  * Accepted for backward compatibility only.
760
817
  */
761
818
  hideQtyButton?: boolean;
819
+ /**
820
+ * Enable TFC (Trade from Charts) functionality.
821
+ * When `false`, the TFC toggle button is never shown and all trade levels,
822
+ * trade button, and trade popover are completely disabled.
823
+ * When `true` (default), a TFC toggle button appears in the top bar
824
+ * allowing the user to enable/disable TFC at runtime.
825
+ */
826
+ tfcEnabled?: boolean;
762
827
  }
763
828
  interface IndicatorResult {
764
829
  index: number;
@@ -878,6 +943,8 @@ interface ChartState {
878
943
  dark?: Partial<CanvasColorSettings>;
879
944
  light?: Partial<CanvasColorSettings>;
880
945
  };
946
+ /** Whether TFC (Trade from Charts) is currently active (user toggle state). */
947
+ tfcEnabled?: boolean;
881
948
  }
882
949
  interface CrosshairPosition {
883
950
  x: number;
@@ -1014,6 +1081,10 @@ type ChartEventMap = {
1014
1081
  price: number;
1015
1082
  isFullscreen: boolean;
1016
1083
  };
1084
+ /** Emitted when TFC (Trade from Charts) is toggled on or off via the top bar button or API. */
1085
+ tfcToggle: {
1086
+ enabled: boolean;
1087
+ };
1017
1088
  /** Emitted when the user confirms all edits to a level — replaces separate tradeLevelDragEnd / tradeLevelBracketDrag events. */
1018
1089
  tradeLevelEdit: {
1019
1090
  label: string;
@@ -1222,4 +1293,4 @@ declare class MACD implements IIndicator {
1222
1293
  render(ctx: CanvasRenderingContext2D, results: IndicatorResult[], scale: ScaleManager, viewport: Viewport, paneHeight: number, rangeOverride?: PriceRange): void;
1223
1294
  }
1224
1295
 
1225
- export { type IndicatorResult as $, type AnyLevel as A, BollingerBands as B, type ChartConfig as C, type DrawingToolType as D, DEFAULT_LABELS as E, DEFAULT_PRICE_AXIS_CONFIG as F, DEFAULT_TIME_AXIS_CONFIG as G, DEFAULT_TOP_BAR_CONFIG as H, type IIndicator as I, DEFAULT_UI_CONFIG as J, type DataLoaderParams as K, type DeepPartial$1 as L, type DeepPartialChartTheme as M, type DialogLabels as N, type OHLCVBar as O, type PriceRange as P, type DrawingToolbarColors as Q, type DrawingToolbarLabels as R, type SeriesType as S, type TradeLevelType as T, type DrawingToolbarUiConfig as U, type Viewport as V, type Duration as W, EMA as X, type IndicatorOverlayColors as Y, type IndicatorOverlayUiConfig as Z, type IndicatorParams as _, type ChartEventMap as a, type IndicatorStateEntry as a0, LIGHT_THEME as a1, MACD as a2, type OhlcLabels as a3, type OrderSubmit as a4, type Padding as a5, type PendingOrderLevel as a6, type PositionLevel as a7, type PositionRenderStyle as a8, type PriceAxisUiConfig as a9, RSI as aa, SMA as ab, type Theme as ac, type TimeAxisUiConfig as ad, type Timeframe as ae, type TopBarColors as af, type TopBarLabels as ag, type TopBarUiConfig as ah, type TradeDisplayFilter as ai, type TradeLabels as aj, type TradeLevel as ak, type TradeLevelColors as al, type TradePanelColors as am, type UiConfig as an, deepMergeTheme as ao, resolveCssVarsInTheme as ap, resolveLabels as aq, resolveUiConfig as ar, type PriceSource as as, type ChartState as b, type IDrawing as c, type IWebSocketAdapter as d, type DrawingPoint as e, ScaleManager as f, type DrawingHandle as g, type SerializedDrawing as h, type Tick as i, type StreamStatus as j, type ActiveIndicatorState as k, type BottomBarColors as l, type BottomBarLabels as m, type BottomBarUiConfig as n, type CanvasColorSettings as o, type ChartLabels as p, type ChartMiscLabels as q, type ChartTheme as r, type ChartThemeUi as s, type CrosshairPosition as t, type CrosshairUiConfig as u, DARK_THEME as v, DEFAULT_BOTTOM_BAR_CONFIG as w, DEFAULT_CROSSHAIR_CONFIG as x, DEFAULT_DRAWING_TOOLBAR_CONFIG as y, DEFAULT_INDICATOR_OVERLAY_CONFIG as z };
1296
+ export { type IndicatorOverlayUiConfig as $, type AnyLevel as A, BollingerBands as B, type ChartConfig as C, type DrawingToolType as D, DEFAULT_INDICATOR_OVERLAY_CONFIG as E, DEFAULT_LABELS as F, DEFAULT_PRICE_AXIS_CONFIG as G, DEFAULT_TIME_AXIS_CONFIG as H, type IIndicator as I, DEFAULT_TOP_BAR_CONFIG as J, DEFAULT_TRADE_BUTTON_CONFIG as K, DEFAULT_UI_CONFIG as L, type DataLoaderParams as M, type DeepPartial$1 as N, type OHLCVBar as O, type PriceRange as P, type DeepPartialChartTheme as Q, type DialogLabels as R, type SeriesType as S, type Timeframe as T, type DrawingToolbarColors as U, type Viewport as V, type DrawingToolbarLabels as W, type DrawingToolbarUiConfig as X, type Duration as Y, EMA as Z, type IndicatorOverlayColors as _, type ChartEventMap as a, type IndicatorParams as a0, type IndicatorResult as a1, type IndicatorStateEntry as a2, LIGHT_THEME as a3, MACD as a4, type OhlcLabels as a5, type OrderSubmit as a6, type Padding as a7, type PendingOrderLevel as a8, type PositionLevel as a9, type PositionRenderStyle as aa, type PriceAxisUiConfig as ab, RSI as ac, SMA as ad, type Theme as ae, type ThemeOverrides as af, type TimeAxisUiConfig as ag, type TopBarColors as ah, type TopBarLabels as ai, type TopBarUiConfig as aj, type TradeButtonUiConfig as ak, type TradeDisplayFilter as al, type TradeLabels as am, type TradeLevel as an, type TradeLevelColors as ao, type TradePanelColors as ap, type UiConfig as aq, deepMergeTheme as ar, resolveCssVarsInTheme as as, resolveLabels as at, resolveUiConfig as au, type PriceSource as av, type ChartState as b, type IDrawing as c, type IWebSocketAdapter as d, type TradeLevelType as e, type DrawingPoint as f, ScaleManager as g, type DrawingHandle as h, type SerializedDrawing as i, type Tick as j, type StreamStatus as k, type ActiveIndicatorState as l, type BottomBarColors as m, type BottomBarLabels as n, type BottomBarUiConfig as o, type CanvasColorSettings as p, type ChartLabels as q, type ChartMiscLabels as r, type ChartTheme as s, type ChartThemeUi as t, type CrosshairPosition as u, type CrosshairUiConfig as v, DARK_THEME as w, DEFAULT_BOTTOM_BAR_CONFIG as x, DEFAULT_CROSSHAIR_CONFIG as y, DEFAULT_DRAWING_TOOLBAR_CONFIG as z };
@@ -49,6 +49,12 @@ interface TopBarUiConfig {
49
49
  drawBtnSize: string;
50
50
  /** Font size for the icon inside the drawing toggle button */
51
51
  drawBtnIconFontSize: string;
52
+ /** Size (width = height) of icon-only buttons (settings, fullscreen) — desktop */
53
+ iconBtnSize: string;
54
+ /** Size (width = height) of icon-only buttons — mobile override */
55
+ mobileIconBtnSize: string;
56
+ /** SVG icon dimension inside the drawing toggle button — mobile override */
57
+ mobileDrawBtnIconSize: string;
52
58
  /** Font size for flyout list rows */
53
59
  flyoutRowFontSize: string;
54
60
  /** Font family for flyout list rows */
@@ -112,6 +118,16 @@ interface IndicatorOverlayUiConfig {
112
118
  /** Font size for gear ⚙ and remove ✕ icons inside dropdown rows */
113
119
  dropdownIconFontSize: string;
114
120
  }
121
+ interface TradeButtonUiConfig {
122
+ /** Button diameter (px) — desktop */
123
+ size: number;
124
+ /** Button diameter (px) — mobile override */
125
+ mobileSize: number;
126
+ /** SVG icon dimension (px) — desktop */
127
+ iconSize: number;
128
+ /** SVG icon dimension (px) — mobile override */
129
+ mobileIconSize: number;
130
+ }
115
131
  interface UiConfig {
116
132
  drawingToolbar: DrawingToolbarUiConfig;
117
133
  topBar: TopBarUiConfig;
@@ -120,6 +136,7 @@ interface UiConfig {
120
136
  timeAxis: TimeAxisUiConfig;
121
137
  crosshair: CrosshairUiConfig;
122
138
  indicatorOverlay: IndicatorOverlayUiConfig;
139
+ tradeButton: TradeButtonUiConfig;
123
140
  }
124
141
  declare const DEFAULT_DRAWING_TOOLBAR_CONFIG: DrawingToolbarUiConfig;
125
142
  declare const DEFAULT_TOP_BAR_CONFIG: TopBarUiConfig;
@@ -128,6 +145,7 @@ declare const DEFAULT_PRICE_AXIS_CONFIG: PriceAxisUiConfig;
128
145
  declare const DEFAULT_TIME_AXIS_CONFIG: TimeAxisUiConfig;
129
146
  declare const DEFAULT_CROSSHAIR_CONFIG: CrosshairUiConfig;
130
147
  declare const DEFAULT_INDICATOR_OVERLAY_CONFIG: IndicatorOverlayUiConfig;
148
+ declare const DEFAULT_TRADE_BUTTON_CONFIG: TradeButtonUiConfig;
131
149
  declare const DEFAULT_UI_CONFIG: UiConfig;
132
150
  type DeepPartial$1<T> = {
133
151
  [K in keyof T]?: T[K] extends object ? DeepPartial$1<T[K]> : T[K];
@@ -171,6 +189,8 @@ interface TopBarLabels {
171
189
  exitFullscreenTitle: string;
172
190
  /** Tooltip on the chart-settings button. */
173
191
  settingsTitle: string;
192
+ /** Tooltip on the TFC (Trade from Charts) toggle button. */
193
+ tfcToggleTitle: string;
174
194
  }
175
195
  interface BottomBarLabels {
176
196
  /** Duration selector button labels. */
@@ -510,6 +530,14 @@ interface DataLoaderParams {
510
530
  end: Date;
511
531
  interval: string;
512
532
  }
533
+ /**
534
+ * Per-theme deep-partial color overrides applied on top of the built-in
535
+ * dark / light themes. Only the keys you supply are replaced.
536
+ */
537
+ type ThemeOverrides = {
538
+ dark?: DeepPartialChartTheme;
539
+ light?: DeepPartialChartTheme;
540
+ };
513
541
  interface ChartConfig {
514
542
  container: HTMLElement;
515
543
  theme?: Theme;
@@ -592,10 +620,7 @@ interface ChartConfig {
592
620
  * light: { background: 'var(--sidebar-bg-light)' },
593
621
  * }
594
622
  */
595
- themeOverrides?: {
596
- dark?: DeepPartialChartTheme;
597
- light?: DeepPartialChartTheme;
598
- };
623
+ themeOverrides?: ThemeOverrides;
599
624
  /**
600
625
  * Optional per-component UI configuration overrides (font sizes, icon
601
626
  * sizes, spacing). Only the keys you provide are overridden; all others
@@ -627,6 +652,12 @@ interface ChartConfig {
627
652
  * of bars. Default: 200.
628
653
  */
629
654
  maxCandles?: number;
655
+ /**
656
+ * How close (in bars) the viewport must be to the start of loaded data
657
+ * before a historical fetch is triggered. Higher values prefetch earlier.
658
+ * Clamped to a minimum of 20. Default: 80 (one screen-width of bars).
659
+ */
660
+ prefetchThreshold?: number;
630
661
  /**
631
662
  * On touch/mobile devices, the initial visible bar count is
632
663
  * `DEFAULT_VISIBLE_BARS / mobileBarDivisor`. Accepted values: 2, 3, 4.
@@ -743,6 +774,21 @@ interface ChartConfig {
743
774
  * }
744
775
  */
745
776
  aggregateFrom?: Partial<Record<Timeframe, Timeframe>>;
777
+ /**
778
+ * Enable trade-level fan-out clustering. When `true`, overlapping
779
+ * trade levels whose Y pixel positions are within `clusterThresholdDistance`
780
+ * pixels are grouped into a single expandable cluster badge.
781
+ * Default: `true`.
782
+ */
783
+ levelClusteringEnabled?: boolean;
784
+ /**
785
+ * Pixel proximity threshold for level clustering. Levels whose Y pixel
786
+ * positions are within this distance get grouped into a cluster.
787
+ * Only effective when `levelClusteringEnabled` is `true` (default). Set to
788
+ * a higher value for more aggressive grouping, lower for tighter grouping.
789
+ * Default: `20`.
790
+ */
791
+ clusterThresholdDistance?: number;
746
792
  /**
747
793
  * Hide the ✓ / ✗ confirm-cancel buttons on trade levels that have pending changes.
748
794
  * Use when the host app provides its own native confirm/cancel controls.
@@ -754,11 +800,30 @@ interface ChartConfig {
754
800
  * Default: `false` — the toggle is hidden.
755
801
  */
756
802
  enableThemeToggle?: boolean;
803
+ /**
804
+ * Hide the symbol name, OHLC strip, and tick-activity dot overlay
805
+ * shown in the top-left corner of the chart canvas.
806
+ * Default: `false` (overlay is visible).
807
+ */
808
+ hideSymbolAndTick?: boolean;
809
+ /**
810
+ * Show the bottom duration-selector bar.
811
+ * Default: `false` (bar is hidden).
812
+ */
813
+ showBottomBar?: boolean;
757
814
  /**
758
815
  * @deprecated DraftOrderQtyInput has been removed. This option is a no-op.
759
816
  * Accepted for backward compatibility only.
760
817
  */
761
818
  hideQtyButton?: boolean;
819
+ /**
820
+ * Enable TFC (Trade from Charts) functionality.
821
+ * When `false`, the TFC toggle button is never shown and all trade levels,
822
+ * trade button, and trade popover are completely disabled.
823
+ * When `true` (default), a TFC toggle button appears in the top bar
824
+ * allowing the user to enable/disable TFC at runtime.
825
+ */
826
+ tfcEnabled?: boolean;
762
827
  }
763
828
  interface IndicatorResult {
764
829
  index: number;
@@ -878,6 +943,8 @@ interface ChartState {
878
943
  dark?: Partial<CanvasColorSettings>;
879
944
  light?: Partial<CanvasColorSettings>;
880
945
  };
946
+ /** Whether TFC (Trade from Charts) is currently active (user toggle state). */
947
+ tfcEnabled?: boolean;
881
948
  }
882
949
  interface CrosshairPosition {
883
950
  x: number;
@@ -1014,6 +1081,10 @@ type ChartEventMap = {
1014
1081
  price: number;
1015
1082
  isFullscreen: boolean;
1016
1083
  };
1084
+ /** Emitted when TFC (Trade from Charts) is toggled on or off via the top bar button or API. */
1085
+ tfcToggle: {
1086
+ enabled: boolean;
1087
+ };
1017
1088
  /** Emitted when the user confirms all edits to a level — replaces separate tradeLevelDragEnd / tradeLevelBracketDrag events. */
1018
1089
  tradeLevelEdit: {
1019
1090
  label: string;
@@ -1222,4 +1293,4 @@ declare class MACD implements IIndicator {
1222
1293
  render(ctx: CanvasRenderingContext2D, results: IndicatorResult[], scale: ScaleManager, viewport: Viewport, paneHeight: number, rangeOverride?: PriceRange): void;
1223
1294
  }
1224
1295
 
1225
- export { type IndicatorResult as $, type AnyLevel as A, BollingerBands as B, type ChartConfig as C, type DrawingToolType as D, DEFAULT_LABELS as E, DEFAULT_PRICE_AXIS_CONFIG as F, DEFAULT_TIME_AXIS_CONFIG as G, DEFAULT_TOP_BAR_CONFIG as H, type IIndicator as I, DEFAULT_UI_CONFIG as J, type DataLoaderParams as K, type DeepPartial$1 as L, type DeepPartialChartTheme as M, type DialogLabels as N, type OHLCVBar as O, type PriceRange as P, type DrawingToolbarColors as Q, type DrawingToolbarLabels as R, type SeriesType as S, type TradeLevelType as T, type DrawingToolbarUiConfig as U, type Viewport as V, type Duration as W, EMA as X, type IndicatorOverlayColors as Y, type IndicatorOverlayUiConfig as Z, type IndicatorParams as _, type ChartEventMap as a, type IndicatorStateEntry as a0, LIGHT_THEME as a1, MACD as a2, type OhlcLabels as a3, type OrderSubmit as a4, type Padding as a5, type PendingOrderLevel as a6, type PositionLevel as a7, type PositionRenderStyle as a8, type PriceAxisUiConfig as a9, RSI as aa, SMA as ab, type Theme as ac, type TimeAxisUiConfig as ad, type Timeframe as ae, type TopBarColors as af, type TopBarLabels as ag, type TopBarUiConfig as ah, type TradeDisplayFilter as ai, type TradeLabels as aj, type TradeLevel as ak, type TradeLevelColors as al, type TradePanelColors as am, type UiConfig as an, deepMergeTheme as ao, resolveCssVarsInTheme as ap, resolveLabels as aq, resolveUiConfig as ar, type PriceSource as as, type ChartState as b, type IDrawing as c, type IWebSocketAdapter as d, type DrawingPoint as e, ScaleManager as f, type DrawingHandle as g, type SerializedDrawing as h, type Tick as i, type StreamStatus as j, type ActiveIndicatorState as k, type BottomBarColors as l, type BottomBarLabels as m, type BottomBarUiConfig as n, type CanvasColorSettings as o, type ChartLabels as p, type ChartMiscLabels as q, type ChartTheme as r, type ChartThemeUi as s, type CrosshairPosition as t, type CrosshairUiConfig as u, DARK_THEME as v, DEFAULT_BOTTOM_BAR_CONFIG as w, DEFAULT_CROSSHAIR_CONFIG as x, DEFAULT_DRAWING_TOOLBAR_CONFIG as y, DEFAULT_INDICATOR_OVERLAY_CONFIG as z };
1296
+ export { type IndicatorOverlayUiConfig as $, type AnyLevel as A, BollingerBands as B, type ChartConfig as C, type DrawingToolType as D, DEFAULT_INDICATOR_OVERLAY_CONFIG as E, DEFAULT_LABELS as F, DEFAULT_PRICE_AXIS_CONFIG as G, DEFAULT_TIME_AXIS_CONFIG as H, type IIndicator as I, DEFAULT_TOP_BAR_CONFIG as J, DEFAULT_TRADE_BUTTON_CONFIG as K, DEFAULT_UI_CONFIG as L, type DataLoaderParams as M, type DeepPartial$1 as N, type OHLCVBar as O, type PriceRange as P, type DeepPartialChartTheme as Q, type DialogLabels as R, type SeriesType as S, type Timeframe as T, type DrawingToolbarColors as U, type Viewport as V, type DrawingToolbarLabels as W, type DrawingToolbarUiConfig as X, type Duration as Y, EMA as Z, type IndicatorOverlayColors as _, type ChartEventMap as a, type IndicatorParams as a0, type IndicatorResult as a1, type IndicatorStateEntry as a2, LIGHT_THEME as a3, MACD as a4, type OhlcLabels as a5, type OrderSubmit as a6, type Padding as a7, type PendingOrderLevel as a8, type PositionLevel as a9, type PositionRenderStyle as aa, type PriceAxisUiConfig as ab, RSI as ac, SMA as ad, type Theme as ae, type ThemeOverrides as af, type TimeAxisUiConfig as ag, type TopBarColors as ah, type TopBarLabels as ai, type TopBarUiConfig as aj, type TradeButtonUiConfig as ak, type TradeDisplayFilter as al, type TradeLabels as am, type TradeLevel as an, type TradeLevelColors as ao, type TradePanelColors as ap, type UiConfig as aq, deepMergeTheme as ar, resolveCssVarsInTheme as as, resolveLabels as at, resolveUiConfig as au, type PriceSource as av, type ChartState as b, type IDrawing as c, type IWebSocketAdapter as d, type TradeLevelType as e, type DrawingPoint as f, ScaleManager as g, type DrawingHandle as h, type SerializedDrawing as i, type Tick as j, type StreamStatus as k, type ActiveIndicatorState as l, type BottomBarColors as m, type BottomBarLabels as n, type BottomBarUiConfig as o, type CanvasColorSettings as p, type ChartLabels as q, type ChartMiscLabels as r, type ChartTheme as s, type ChartThemeUi as t, type CrosshairPosition as u, type CrosshairUiConfig as v, DARK_THEME as w, DEFAULT_BOTTOM_BAR_CONFIG as x, DEFAULT_CROSSHAIR_CONFIG as y, DEFAULT_DRAWING_TOOLBAR_CONFIG as z };