acttrader-charts 1.0.13 → 1.0.15

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 |
@@ -229,7 +233,12 @@ 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`) |
238
+ | `momentumScrollEnabled` | | `true` | Enable momentum (kinetic) scrolling — chart coasts after a fast flick |
239
+ | `momentumDecay` | | `0.95` | Per-frame velocity decay, normalised to 60 fps. Clamped `[0.80, 0.99]`. Lower = stops faster |
240
+ | `momentumThreshold` | | `0.3` | Min release velocity (px/ms) to launch momentum. Raise to require a faster flick |
241
+ | `momentumMaxVelocity` | | `6.0` | Max launch velocity (px/ms) — caps hard-flick speed |
233
242
  | `targetCandleWidth` | | `10` | Target px width per candle for auto-calculating initial bar count |
234
243
  | `durationTimeframeMap` | | *(see below)* | Override duration → timeframe pairings |
235
244
  | `dataLoader` | | — | `(params) => Promise<OHLCVBar[]>` auto-called on load / change |
@@ -245,8 +254,16 @@ When `enableTrading` is on and live BID/ASK data is streaming, hovering / activa
245
254
  | `tradeDisplayFilter` | | `"all"` | Which TFC levels are visible: `"all"` · `"positions"` · `"orders"` · `"none"` |
246
255
  | `positionRenderStyle` | | auto | Force position render style: `"line"` or `"dot"` |
247
256
  | `hideLevelConfirmCancel` | | `false` | Hide on-canvas ✓/✗ confirm-cancel buttons for TFC level edits |
257
+ | `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 |
258
+ | `levelClusteringEnabled` | | `true` | Enable trade-level fan-out clustering; overlapping levels group into expandable badges |
259
+ | `clusterThresholdDistance` | | `20` | Pixel proximity threshold for clustering (only when `levelClusteringEnabled` is `true`) |
260
+ | `hideSymbolAndTick` | | `false` | Hide the symbol name, OHLC strip, and tick-activity dot overlay |
261
+ | `showBottomBar` | | `false` | Show the bottom duration-selector bar |
248
262
  | `hideQtyButton` | | `false` | Hide the floating Qty input overlay on draft orders |
263
+ | `showQuantityField` | | `false` | Render an editable QTY pill at the left of the draft order info box. Clicking the pill opens a flyout input to edit the quantity before submitting |
264
+ | `quantityFieldConfig` | | — | Constraints for the draft order QTY field (only relevant when `showQuantityField` is `true`). Object: `{ minLots?: number, maxLots?: number }`. `minLots` also sets the initial quantity and the step value for the flyout input (default: `1`). `maxLots` caps the input (default: `100`) |
249
265
  | `tradesThresholdForHorizontalLine` | | `2` | Level count above which render auto-switches to `"dot"` mode |
266
+ | `timezone` | | `"UTC"` | IANA timezone string for time-axis and crosshair labels. `"UTC"` (default), `"local"` (browser/device timezone), or any IANA string (`"America/New_York"`, `"Europe/London"`, etc.) |
250
267
  | `canvasColors` | | — | Per-theme canvas background color overrides (persisted from Settings dialog) |
251
268
  | `aggregateFrom` | | — | Fetch finer-grained data and aggregate client-side per timeframe |
252
269
  | `onOrderSubmit` | | — | Called when user submits a trade via the floating button |
@@ -469,6 +486,17 @@ chart.loadData(bars: OHLCVBar[]): this
469
486
  chart.prependData(bars: OHLCVBar[]): this // prepend historical bars (infinite scroll back)
470
487
  chart.correctBar(barTime: number, bar: OHLCVBar): void // replace a bar with authoritative data after close
471
488
  chart.setLoading(loading: boolean): this
489
+
490
+ // Reset — clears all bars, the live price line, and any in-flight fetch.
491
+ // Call before switching to a new symbol so no previous symbol data bleeds in.
492
+ chart.resetData(): this
493
+ ```
494
+
495
+ **Symbol switch pattern:**
496
+ ```ts
497
+ chart.setSymbol('GBPUSD').resetData();
498
+ // … fetch new bars …
499
+ chart.loadData(newBars);
472
500
  ```
473
501
 
474
502
  ### Series & Appearance
@@ -477,7 +505,8 @@ chart.setLoading(loading: boolean): this
477
505
  chart.setSeries(series: SeriesType): this
478
506
  chart.setTheme('dark' | 'light'): this
479
507
  chart.setTimeframe(tf: Timeframe): this // change timeframe and reload data
480
- chart.setThemeOverrides(overrides: ChartConfig['themeOverrides']): this // update per-theme color overrides at runtime
508
+ chart.setThemeOverrides(overrides: ThemeOverrides): this // update per-theme color overrides at runtime
509
+ chart.setTimezone(tz: string): this // change display timezone at runtime
481
510
  chart.setVolume(show: boolean): this
482
511
  ```
483
512
 
@@ -504,6 +533,7 @@ chart.removeLevelByLabel(label: string): this
504
533
  chart.cancelCurrentEdit(): this // cancel the active draft order or in-progress level edit; no-op when nothing is active
505
534
  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
506
535
  chart.setDraftBracketPnl(bracketType: 'sl' | 'tp', pnlText: string | null): this // set estimated P&L text on a draft order bracket line; pass null to clear
536
+ 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
507
537
  ```
508
538
 
509
539
  ### Trade Button
@@ -680,6 +710,7 @@ chart.on('tradeLevelEditOpen', ({ label, type, price, side, stopLossPrice, takeP
680
710
  chart.on('tradeLevelConfirmed',({ label, type, isFullscreen }) => {});
681
711
  chart.on('draftInitiated', ({ side, price, orderType, isFullscreen }) => {}); // new draft order shown — open buy/sell form
682
712
  chart.on('draftCancelled', ({ label, isFullscreen }) => {}); // draft order dismissed without confirming
713
+ chart.on('tfcToggle', ({ enabled }) => {}); // TFC toggled on or off via top bar button or setTfcActive()
683
714
  chart.on('tradeLevelDragEnd', ({ label, type, newPrice, data }) => {}); // deprecated — use tradeLevelEdit
684
715
  chart.on('tradeLevelBracketDrag', ({ label, bracketType, newPrice, data }) => {}); // deprecated
685
716
 
@@ -189,6 +189,8 @@ interface TopBarLabels {
189
189
  exitFullscreenTitle: string;
190
190
  /** Tooltip on the chart-settings button. */
191
191
  settingsTitle: string;
192
+ /** Tooltip on the TFC (Trade from Charts) toggle button. */
193
+ tfcToggleTitle: string;
192
194
  }
193
195
  interface BottomBarLabels {
194
196
  /** Duration selector button labels. */
@@ -528,6 +530,14 @@ interface DataLoaderParams {
528
530
  end: Date;
529
531
  interval: string;
530
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
+ };
531
541
  interface ChartConfig {
532
542
  container: HTMLElement;
533
543
  theme?: Theme;
@@ -558,6 +568,22 @@ interface ChartConfig {
558
568
  * Minimum (and default) lot size for draft order submission. Default: `1`.
559
569
  */
560
570
  minLots?: number;
571
+ /**
572
+ * When true, renders an editable QTY pill at the left of the draft order
573
+ * info box. Clicking the pill opens a flyout to edit the quantity. Default: `false`.
574
+ */
575
+ showQuantityField?: boolean;
576
+ /**
577
+ * Constraints for the draft order QTY field. Only relevant when
578
+ * `showQuantityField` is true. `minLots` also sets the initial quantity
579
+ * and the step value for the flyout input.
580
+ */
581
+ quantityFieldConfig?: {
582
+ /** Minimum lot size, step size, and initial quantity (e.g. `0.01`). Default: `1` */
583
+ minLots?: number;
584
+ /** Maximum lot size (e.g. `100`). Default: `100` */
585
+ maxLots?: number;
586
+ };
561
587
  /** Called when user submits an order via the floating trade button */
562
588
  onOrderSubmit?: (order: OrderSubmit) => void;
563
589
  /**
@@ -610,10 +636,14 @@ interface ChartConfig {
610
636
  * light: { background: 'var(--sidebar-bg-light)' },
611
637
  * }
612
638
  */
613
- themeOverrides?: {
614
- dark?: DeepPartialChartTheme;
615
- light?: DeepPartialChartTheme;
616
- };
639
+ themeOverrides?: ThemeOverrides;
640
+ /**
641
+ * IANA timezone string for all time-axis and crosshair labels.
642
+ * `"UTC"` (default) preserves existing behavior.
643
+ * `"local"` uses the browser/device timezone automatically.
644
+ * Any IANA string is accepted: `"America/New_York"`, `"Europe/London"`, etc.
645
+ */
646
+ timezone?: string;
617
647
  /**
618
648
  * Optional per-component UI configuration overrides (font sizes, icon
619
649
  * sizes, spacing). Only the keys you provide are overridden; all others
@@ -645,12 +675,45 @@ interface ChartConfig {
645
675
  * of bars. Default: 200.
646
676
  */
647
677
  maxCandles?: number;
678
+ /**
679
+ * How close (in bars) the viewport must be to the start of loaded data
680
+ * before a historical fetch is triggered. Higher values prefetch earlier.
681
+ * Clamped to a minimum of 20. Default: 80 (one screen-width of bars).
682
+ */
683
+ prefetchThreshold?: number;
648
684
  /**
649
685
  * On touch/mobile devices, the initial visible bar count is
650
686
  * `DEFAULT_VISIBLE_BARS / mobileBarDivisor`. Accepted values: 2, 3, 4.
651
687
  * Default: `2`.
652
688
  */
653
689
  mobileBarDivisor?: 2 | 3 | 4;
690
+ /**
691
+ * Enable momentum (kinetic) scrolling on drag release. When `true`, releasing
692
+ * a fast pan gesture lets the chart continue scrolling with gradually
693
+ * decelerating speed — matching the feel of native iOS/Android scroll views.
694
+ * Default: `true`.
695
+ */
696
+ momentumScrollEnabled?: boolean;
697
+ /**
698
+ * Per-frame velocity decay factor for momentum scrolling, normalised to 60 fps.
699
+ * A value of `0.95` means the viewport retains 95% of its speed each 16.67 ms
700
+ * frame. Lower values stop faster; higher values coast longer.
701
+ * Clamped to `[0.80, 0.99]`. Default: `0.95`.
702
+ */
703
+ momentumDecay?: number;
704
+ /**
705
+ * Minimum release velocity (px/ms) required to trigger a momentum scroll.
706
+ * Swipes slower than this threshold stop immediately on finger-up.
707
+ * Raising this value suppresses momentum for slow drags while still triggering
708
+ * on fast flicks. Default: `0.3`.
709
+ */
710
+ momentumThreshold?: number;
711
+ /**
712
+ * Maximum initial launch velocity (px/ms) for momentum scrolling.
713
+ * Caps runaway fast-flick launches that would scroll hundreds of bars in one
714
+ * gesture. Default: `6.0`.
715
+ */
716
+ momentumMaxVelocity?: number;
654
717
  /**
655
718
  * Initial number of candles visible when the chart first loads (desktop).
656
719
  * On mobile this value is further divided by `mobileBarDivisor` unless
@@ -761,6 +824,21 @@ interface ChartConfig {
761
824
  * }
762
825
  */
763
826
  aggregateFrom?: Partial<Record<Timeframe, Timeframe>>;
827
+ /**
828
+ * Enable trade-level fan-out clustering. When `true`, overlapping
829
+ * trade levels whose Y pixel positions are within `clusterThresholdDistance`
830
+ * pixels are grouped into a single expandable cluster badge.
831
+ * Default: `true`.
832
+ */
833
+ levelClusteringEnabled?: boolean;
834
+ /**
835
+ * Pixel proximity threshold for level clustering. Levels whose Y pixel
836
+ * positions are within this distance get grouped into a cluster.
837
+ * Only effective when `levelClusteringEnabled` is `true` (default). Set to
838
+ * a higher value for more aggressive grouping, lower for tighter grouping.
839
+ * Default: `20`.
840
+ */
841
+ clusterThresholdDistance?: number;
764
842
  /**
765
843
  * Hide the ✓ / ✗ confirm-cancel buttons on trade levels that have pending changes.
766
844
  * Use when the host app provides its own native confirm/cancel controls.
@@ -772,11 +850,30 @@ interface ChartConfig {
772
850
  * Default: `false` — the toggle is hidden.
773
851
  */
774
852
  enableThemeToggle?: boolean;
853
+ /**
854
+ * Hide the symbol name, OHLC strip, and tick-activity dot overlay
855
+ * shown in the top-left corner of the chart canvas.
856
+ * Default: `false` (overlay is visible).
857
+ */
858
+ hideSymbolAndTick?: boolean;
859
+ /**
860
+ * Show the bottom duration-selector bar.
861
+ * Default: `false` (bar is hidden).
862
+ */
863
+ showBottomBar?: boolean;
775
864
  /**
776
865
  * @deprecated DraftOrderQtyInput has been removed. This option is a no-op.
777
866
  * Accepted for backward compatibility only.
778
867
  */
779
868
  hideQtyButton?: boolean;
869
+ /**
870
+ * Enable TFC (Trade from Charts) functionality.
871
+ * When `false`, the TFC toggle button is never shown and all trade levels,
872
+ * trade button, and trade popover are completely disabled.
873
+ * When `true` (default), a TFC toggle button appears in the top bar
874
+ * allowing the user to enable/disable TFC at runtime.
875
+ */
876
+ tfcEnabled?: boolean;
780
877
  }
781
878
  interface IndicatorResult {
782
879
  index: number;
@@ -896,6 +993,8 @@ interface ChartState {
896
993
  dark?: Partial<CanvasColorSettings>;
897
994
  light?: Partial<CanvasColorSettings>;
898
995
  };
996
+ /** Whether TFC (Trade from Charts) is currently active (user toggle state). */
997
+ tfcEnabled?: boolean;
899
998
  }
900
999
  interface CrosshairPosition {
901
1000
  x: number;
@@ -1032,6 +1131,10 @@ type ChartEventMap = {
1032
1131
  price: number;
1033
1132
  isFullscreen: boolean;
1034
1133
  };
1134
+ /** Emitted when TFC (Trade from Charts) is toggled on or off via the top bar button or API. */
1135
+ tfcToggle: {
1136
+ enabled: boolean;
1137
+ };
1035
1138
  /** Emitted when the user confirms all edits to a level — replaces separate tradeLevelDragEnd / tradeLevelBracketDrag events. */
1036
1139
  tradeLevelEdit: {
1037
1140
  label: string;
@@ -1240,4 +1343,4 @@ declare class MACD implements IIndicator {
1240
1343
  render(ctx: CanvasRenderingContext2D, results: IndicatorResult[], scale: ScaleManager, viewport: Viewport, paneHeight: number, rangeOverride?: PriceRange): void;
1241
1344
  }
1242
1345
 
1243
- 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 TimeAxisUiConfig as af, type TopBarColors as ag, type TopBarLabels as ah, type TopBarUiConfig as ai, type TradeButtonUiConfig as aj, type TradeDisplayFilter as ak, type TradeLabels as al, type TradeLevel as am, type TradeLevelColors as an, type TradePanelColors as ao, type UiConfig as ap, deepMergeTheme as aq, resolveCssVarsInTheme as ar, resolveLabels as as, resolveUiConfig as at, type PriceSource as au, 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 };
1346
+ 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 };
@@ -189,6 +189,8 @@ interface TopBarLabels {
189
189
  exitFullscreenTitle: string;
190
190
  /** Tooltip on the chart-settings button. */
191
191
  settingsTitle: string;
192
+ /** Tooltip on the TFC (Trade from Charts) toggle button. */
193
+ tfcToggleTitle: string;
192
194
  }
193
195
  interface BottomBarLabels {
194
196
  /** Duration selector button labels. */
@@ -528,6 +530,14 @@ interface DataLoaderParams {
528
530
  end: Date;
529
531
  interval: string;
530
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
+ };
531
541
  interface ChartConfig {
532
542
  container: HTMLElement;
533
543
  theme?: Theme;
@@ -558,6 +568,22 @@ interface ChartConfig {
558
568
  * Minimum (and default) lot size for draft order submission. Default: `1`.
559
569
  */
560
570
  minLots?: number;
571
+ /**
572
+ * When true, renders an editable QTY pill at the left of the draft order
573
+ * info box. Clicking the pill opens a flyout to edit the quantity. Default: `false`.
574
+ */
575
+ showQuantityField?: boolean;
576
+ /**
577
+ * Constraints for the draft order QTY field. Only relevant when
578
+ * `showQuantityField` is true. `minLots` also sets the initial quantity
579
+ * and the step value for the flyout input.
580
+ */
581
+ quantityFieldConfig?: {
582
+ /** Minimum lot size, step size, and initial quantity (e.g. `0.01`). Default: `1` */
583
+ minLots?: number;
584
+ /** Maximum lot size (e.g. `100`). Default: `100` */
585
+ maxLots?: number;
586
+ };
561
587
  /** Called when user submits an order via the floating trade button */
562
588
  onOrderSubmit?: (order: OrderSubmit) => void;
563
589
  /**
@@ -610,10 +636,14 @@ interface ChartConfig {
610
636
  * light: { background: 'var(--sidebar-bg-light)' },
611
637
  * }
612
638
  */
613
- themeOverrides?: {
614
- dark?: DeepPartialChartTheme;
615
- light?: DeepPartialChartTheme;
616
- };
639
+ themeOverrides?: ThemeOverrides;
640
+ /**
641
+ * IANA timezone string for all time-axis and crosshair labels.
642
+ * `"UTC"` (default) preserves existing behavior.
643
+ * `"local"` uses the browser/device timezone automatically.
644
+ * Any IANA string is accepted: `"America/New_York"`, `"Europe/London"`, etc.
645
+ */
646
+ timezone?: string;
617
647
  /**
618
648
  * Optional per-component UI configuration overrides (font sizes, icon
619
649
  * sizes, spacing). Only the keys you provide are overridden; all others
@@ -645,12 +675,45 @@ interface ChartConfig {
645
675
  * of bars. Default: 200.
646
676
  */
647
677
  maxCandles?: number;
678
+ /**
679
+ * How close (in bars) the viewport must be to the start of loaded data
680
+ * before a historical fetch is triggered. Higher values prefetch earlier.
681
+ * Clamped to a minimum of 20. Default: 80 (one screen-width of bars).
682
+ */
683
+ prefetchThreshold?: number;
648
684
  /**
649
685
  * On touch/mobile devices, the initial visible bar count is
650
686
  * `DEFAULT_VISIBLE_BARS / mobileBarDivisor`. Accepted values: 2, 3, 4.
651
687
  * Default: `2`.
652
688
  */
653
689
  mobileBarDivisor?: 2 | 3 | 4;
690
+ /**
691
+ * Enable momentum (kinetic) scrolling on drag release. When `true`, releasing
692
+ * a fast pan gesture lets the chart continue scrolling with gradually
693
+ * decelerating speed — matching the feel of native iOS/Android scroll views.
694
+ * Default: `true`.
695
+ */
696
+ momentumScrollEnabled?: boolean;
697
+ /**
698
+ * Per-frame velocity decay factor for momentum scrolling, normalised to 60 fps.
699
+ * A value of `0.95` means the viewport retains 95% of its speed each 16.67 ms
700
+ * frame. Lower values stop faster; higher values coast longer.
701
+ * Clamped to `[0.80, 0.99]`. Default: `0.95`.
702
+ */
703
+ momentumDecay?: number;
704
+ /**
705
+ * Minimum release velocity (px/ms) required to trigger a momentum scroll.
706
+ * Swipes slower than this threshold stop immediately on finger-up.
707
+ * Raising this value suppresses momentum for slow drags while still triggering
708
+ * on fast flicks. Default: `0.3`.
709
+ */
710
+ momentumThreshold?: number;
711
+ /**
712
+ * Maximum initial launch velocity (px/ms) for momentum scrolling.
713
+ * Caps runaway fast-flick launches that would scroll hundreds of bars in one
714
+ * gesture. Default: `6.0`.
715
+ */
716
+ momentumMaxVelocity?: number;
654
717
  /**
655
718
  * Initial number of candles visible when the chart first loads (desktop).
656
719
  * On mobile this value is further divided by `mobileBarDivisor` unless
@@ -761,6 +824,21 @@ interface ChartConfig {
761
824
  * }
762
825
  */
763
826
  aggregateFrom?: Partial<Record<Timeframe, Timeframe>>;
827
+ /**
828
+ * Enable trade-level fan-out clustering. When `true`, overlapping
829
+ * trade levels whose Y pixel positions are within `clusterThresholdDistance`
830
+ * pixels are grouped into a single expandable cluster badge.
831
+ * Default: `true`.
832
+ */
833
+ levelClusteringEnabled?: boolean;
834
+ /**
835
+ * Pixel proximity threshold for level clustering. Levels whose Y pixel
836
+ * positions are within this distance get grouped into a cluster.
837
+ * Only effective when `levelClusteringEnabled` is `true` (default). Set to
838
+ * a higher value for more aggressive grouping, lower for tighter grouping.
839
+ * Default: `20`.
840
+ */
841
+ clusterThresholdDistance?: number;
764
842
  /**
765
843
  * Hide the ✓ / ✗ confirm-cancel buttons on trade levels that have pending changes.
766
844
  * Use when the host app provides its own native confirm/cancel controls.
@@ -772,11 +850,30 @@ interface ChartConfig {
772
850
  * Default: `false` — the toggle is hidden.
773
851
  */
774
852
  enableThemeToggle?: boolean;
853
+ /**
854
+ * Hide the symbol name, OHLC strip, and tick-activity dot overlay
855
+ * shown in the top-left corner of the chart canvas.
856
+ * Default: `false` (overlay is visible).
857
+ */
858
+ hideSymbolAndTick?: boolean;
859
+ /**
860
+ * Show the bottom duration-selector bar.
861
+ * Default: `false` (bar is hidden).
862
+ */
863
+ showBottomBar?: boolean;
775
864
  /**
776
865
  * @deprecated DraftOrderQtyInput has been removed. This option is a no-op.
777
866
  * Accepted for backward compatibility only.
778
867
  */
779
868
  hideQtyButton?: boolean;
869
+ /**
870
+ * Enable TFC (Trade from Charts) functionality.
871
+ * When `false`, the TFC toggle button is never shown and all trade levels,
872
+ * trade button, and trade popover are completely disabled.
873
+ * When `true` (default), a TFC toggle button appears in the top bar
874
+ * allowing the user to enable/disable TFC at runtime.
875
+ */
876
+ tfcEnabled?: boolean;
780
877
  }
781
878
  interface IndicatorResult {
782
879
  index: number;
@@ -896,6 +993,8 @@ interface ChartState {
896
993
  dark?: Partial<CanvasColorSettings>;
897
994
  light?: Partial<CanvasColorSettings>;
898
995
  };
996
+ /** Whether TFC (Trade from Charts) is currently active (user toggle state). */
997
+ tfcEnabled?: boolean;
899
998
  }
900
999
  interface CrosshairPosition {
901
1000
  x: number;
@@ -1032,6 +1131,10 @@ type ChartEventMap = {
1032
1131
  price: number;
1033
1132
  isFullscreen: boolean;
1034
1133
  };
1134
+ /** Emitted when TFC (Trade from Charts) is toggled on or off via the top bar button or API. */
1135
+ tfcToggle: {
1136
+ enabled: boolean;
1137
+ };
1035
1138
  /** Emitted when the user confirms all edits to a level — replaces separate tradeLevelDragEnd / tradeLevelBracketDrag events. */
1036
1139
  tradeLevelEdit: {
1037
1140
  label: string;
@@ -1240,4 +1343,4 @@ declare class MACD implements IIndicator {
1240
1343
  render(ctx: CanvasRenderingContext2D, results: IndicatorResult[], scale: ScaleManager, viewport: Viewport, paneHeight: number, rangeOverride?: PriceRange): void;
1241
1344
  }
1242
1345
 
1243
- 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 TimeAxisUiConfig as af, type TopBarColors as ag, type TopBarLabels as ah, type TopBarUiConfig as ai, type TradeButtonUiConfig as aj, type TradeDisplayFilter as ak, type TradeLabels as al, type TradeLevel as am, type TradeLevelColors as an, type TradePanelColors as ao, type UiConfig as ap, deepMergeTheme as aq, resolveCssVarsInTheme as ar, resolveLabels as as, resolveUiConfig as at, type PriceSource as au, 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 };
1346
+ 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 };