@pipsend/charts 1.3.1 → 2.0.1

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/dist/typings.d.ts CHANGED
@@ -15,6 +15,18 @@ declare abstract class DrawingToolBase implements IDrawingTool {
15
15
  private _generateId;
16
16
  get id(): string;
17
17
  get type(): string;
18
+ /**
19
+ * Lets a tool hand the base its own options object, once, in the constructor.
20
+ *
21
+ * Every tool keeps a typed bag of its own (`_trendOptions`, `_circleOptions`…)
22
+ * that the base knows nothing about. Registering the reference here means
23
+ * `applyOptions` and `options` work for all of them without each tool
24
+ * repeating the same merge.
25
+ */
26
+ protected _registerOptions(options: Record<string, unknown>): void;
27
+ protected _ownOptions: Record<string, unknown> | null;
28
+ /** The options in effect, for a configuration dialog to read. */
29
+ options(): Record<string, unknown>;
18
30
  applyOptions(options: Partial<DrawingToolOptions>): void;
19
31
  show(): void;
20
32
  hide(): void;
@@ -248,6 +260,44 @@ export declare class CircleTool extends DrawingToolBase {
248
260
  protected _update(): void;
249
261
  remove(): void;
250
262
  }
263
+ /**
264
+ * A horizontal and a vertical line crossing at one point.
265
+ *
266
+ * Both lines move together — the tool marks a moment at a price, not two
267
+ * independent levels — so it has a single anchor and drags as one.
268
+ */
269
+ export declare class CrossLineTool extends DrawingToolBase {
270
+ private _crossOptions;
271
+ private _primitive;
272
+ private _repaint;
273
+ private _paneView;
274
+ private _isSelected;
275
+ private _isHovered;
276
+ private _isDragging;
277
+ private _grab;
278
+ private _moveStartTime;
279
+ private _moveStartPrice;
280
+ constructor(context: DrawingContext, options: CrossLineToolOptions);
281
+ private _createPrimitive;
282
+ private _requestUpdate;
283
+ protected _update(): void;
284
+ private _coordinates;
285
+ drawToCanvas(ctx: CanvasRenderingContext2D, horizontalPixelRatio: number, verticalPixelRatio: number): void;
286
+ private _hitTestPrimitive;
287
+ hitTest(x: number, y: number): boolean;
288
+ hitTestEndpoint(x: number, y: number): "line" | null;
289
+ startDrag(_target: "line", grab: DragAnchor): void;
290
+ updateDrag(time: Time, price: number): void;
291
+ stopDrag(): void;
292
+ setColor(color: string): void;
293
+ color(): string;
294
+ setSelected(selected: boolean): void;
295
+ isSelected(): boolean;
296
+ setHovered(hovered: boolean): void;
297
+ isHovered(): boolean;
298
+ remove(): void;
299
+ protected _serializeShape(): SerializedDrawingTool;
300
+ }
251
301
  /**
252
302
  * A price line that can be dragged and clicked.
253
303
  *
@@ -523,6 +573,15 @@ export declare class FibonacciCalculator {
523
573
  ratio: number;
524
574
  label: string;
525
575
  }>;
576
+ /**
577
+ * The ratios as plain numbers.
578
+ *
579
+ * Read here, in the module that declares the level literals, rather than by
580
+ * the caller: two anonymous `{ ratio, label }` types get different mangled
581
+ * names at build time, so a `.ratio` read from elsewhere comes back
582
+ * undefined.
583
+ */
584
+ getRatioValues(): number[];
526
585
  /**
527
586
  * Use standard ratios
528
587
  */
@@ -630,10 +689,6 @@ export declare class FibonacciFanTool extends DrawingToolBase {
630
689
  protected _update(): void;
631
690
  remove(): void;
632
691
  }
633
- /**
634
- * Fibonacci Retracement Tool - Herramienta para dibujar niveles de Fibonacci
635
- * Muestra niveles estándar: 0%, 23.6%, 38.2%, 50%, 61.8%, 78.6%, 100%
636
- */
637
692
  export declare class FibonacciTool extends DrawingToolBase {
638
693
  private _fibOptions;
639
694
  private _calculator;
@@ -672,6 +727,13 @@ export declare class FibonacciTool extends DrawingToolBase {
672
727
  stopDrag(): void;
673
728
  updateDrag(time: Time, price: number): void;
674
729
  hitTestEndpoint(x: number, y: number): "point1" | "point2" | null;
730
+ /**
731
+ * Merge options into the live tool. Same shape as the indicators', so the
732
+ * configuration dialog does not need to know what it is talking to.
733
+ */
734
+ applyOptions(options: Partial<FibonacciToolOptions>): void;
735
+ /** The options currently in effect, with the levels actually in use. */
736
+ options(): Record<string, unknown>;
675
737
  setColor(color: string): void;
676
738
  color(): string;
677
739
  setSelected(selected: boolean): void;
@@ -752,6 +814,8 @@ export declare class HorizontalLineTool extends DrawingToolBase {
752
814
  constructor(context: DrawingContext, options: HorizontalLineToolOptions);
753
815
  private _createPrimitive;
754
816
  private _createPaneView;
817
+ /** Where the line starts, in CSS pixels. Zero unless it is a ray. */
818
+ private _startX;
755
819
  drawToCanvas(ctx: CanvasRenderingContext2D, horizontalPixelRatio: number, verticalPixelRatio: number): void;
756
820
  private _drawLabel;
757
821
  setColor(color: string): void;
@@ -818,6 +882,178 @@ export declare class InteractiveLineManager {
818
882
  */
819
883
  isCreating(): boolean;
820
884
  }
885
+ /**
886
+ * Two parallel lines marking a trend and its channel.
887
+ *
888
+ * Drawn in three clicks: the first two set the base line, the third sets how
889
+ * far the parallel copy sits from it. The width is kept **in price**, not in
890
+ * pixels, so the channel keeps its meaning when the scale changes — a pixel
891
+ * offset would widen and narrow as you zoom.
892
+ */
893
+ export declare class ParallelChannelTool extends DrawingToolBase {
894
+ private _channelOptions;
895
+ private _primitive;
896
+ private _repaint;
897
+ private _paneView;
898
+ private _isSelected;
899
+ private _isHovered;
900
+ private _isDragging;
901
+ private _dragTarget;
902
+ private _grab;
903
+ private _moveStart;
904
+ private _isComplete;
905
+ private _clickCount;
906
+ private _previewPoint;
907
+ private _clickHandler;
908
+ private _moveHandler;
909
+ constructor(context: DrawingContext, options: ParallelChannelToolOptions);
910
+ private _createPrimitive;
911
+ private _requestUpdate;
912
+ protected _update(): void;
913
+ private _startDrawing;
914
+ private _finish;
915
+ private _stopDrawing;
916
+ /** Price of the base line at a given time, extrapolated beyond its points. */
917
+ private _priceOnBaseLine;
918
+ /** The two lines in pixels, or null while there is not enough to draw. */
919
+ private _lines;
920
+ drawToCanvas(ctx: CanvasRenderingContext2D, horizontalPixelRatio: number, verticalPixelRatio: number): void;
921
+ private _drawHandle;
922
+ private _rgba;
923
+ private _hitTestPrimitive;
924
+ private _distanceToSegment;
925
+ hitTest(x: number, y: number): boolean;
926
+ hitTestEndpoint(x: number, y: number): ChannelPart | null;
927
+ startDrag(target: ChannelPart, grab: DragAnchor): void;
928
+ updateDrag(time: Time, price: number): void;
929
+ stopDrag(): void;
930
+ setColor(color: string): void;
931
+ color(): string;
932
+ setSelected(selected: boolean): void;
933
+ isSelected(): boolean;
934
+ setHovered(hovered: boolean): void;
935
+ isHovered(): boolean;
936
+ remove(): void;
937
+ protected _serializeShape(): SerializedDrawingTool;
938
+ }
939
+ /**
940
+ * Andrews pitchfork: three prongs opening from a pivot.
941
+ *
942
+ * The median runs from the pivot through the midpoint of the other two points;
943
+ * the outer prongs run parallel to it, one through each. All three are
944
+ * projected to the right edge, which is the whole point — the fork is a
945
+ * forecast, not a measurement of what already happened.
946
+ */
947
+ export declare class PitchforkTool extends DrawingToolBase {
948
+ private _forkOptions;
949
+ private _primitive;
950
+ private _repaint;
951
+ private _paneView;
952
+ private _isSelected;
953
+ private _isHovered;
954
+ private _isDragging;
955
+ private _dragTarget;
956
+ private _grab;
957
+ private _moveStart;
958
+ private _isComplete;
959
+ private _clickCount;
960
+ private _previewPoint;
961
+ private _clickHandler;
962
+ private _moveHandler;
963
+ constructor(context: DrawingContext, options: PitchforkToolOptions);
964
+ private _createPrimitive;
965
+ private _requestUpdate;
966
+ protected _update(): void;
967
+ private _startDrawing;
968
+ private _finish;
969
+ private _stopDrawing;
970
+ private _screenPoint;
971
+ /**
972
+ * The three prongs in pixels, each already projected to the right edge.
973
+ */
974
+ private _prongs;
975
+ drawToCanvas(ctx: CanvasRenderingContext2D, horizontalPixelRatio: number, verticalPixelRatio: number): void;
976
+ /** While fewer than three points exist, only what is known is drawn. */
977
+ private _drawSkeleton;
978
+ private _drawHandle;
979
+ private _rgba;
980
+ private _hitTestPrimitive;
981
+ private _distanceToSegment;
982
+ hitTest(x: number, y: number): boolean;
983
+ hitTestEndpoint(x: number, y: number): PitchforkPart | null;
984
+ startDrag(target: PitchforkPart, grab: DragAnchor): void;
985
+ updateDrag(time: Time, price: number): void;
986
+ stopDrag(): void;
987
+ setColor(color: string): void;
988
+ color(): string;
989
+ setSelected(selected: boolean): void;
990
+ isSelected(): boolean;
991
+ setHovered(hovered: boolean): void;
992
+ isHovered(): boolean;
993
+ remove(): void;
994
+ protected _serializeShape(): SerializedDrawingTool;
995
+ }
996
+ /**
997
+ * A closed shape of any number of corners.
998
+ *
999
+ * Unlike the two-point tools it is drawn over several clicks: each one adds a
1000
+ * corner, and the shape closes when you click the first corner again or press
1001
+ * Enter. Three corners make a triangle, which is why there is no separate tool
1002
+ * for one.
1003
+ */
1004
+ export declare class PolygonTool extends DrawingToolBase {
1005
+ private _polygonOptions;
1006
+ private _points;
1007
+ private _primitive;
1008
+ private _repaint;
1009
+ private _paneView;
1010
+ private _isSelected;
1011
+ private _isHovered;
1012
+ private _isDragging;
1013
+ private _dragTarget;
1014
+ private _grab;
1015
+ private _moveStartPoints;
1016
+ private _isComplete;
1017
+ private _previewPoint;
1018
+ private _clickHandler;
1019
+ private _moveHandler;
1020
+ private _keyHandler;
1021
+ /** How close to the first corner a click has to land to close the shape. */
1022
+ private static readonly _CLOSE_TOLERANCE;
1023
+ constructor(context: DrawingContext, options: PolygonToolOptions);
1024
+ private _createPrimitive;
1025
+ private _requestUpdate;
1026
+ protected _update(): void;
1027
+ private _startDrawing;
1028
+ private _isNearFirstPoint;
1029
+ private _finish;
1030
+ private _stopDrawing;
1031
+ /** The corners in pixels, plus the preview corner while still drawing. */
1032
+ private _screenPoints;
1033
+ private _toScreen;
1034
+ drawToCanvas(ctx: CanvasRenderingContext2D, horizontalPixelRatio: number, verticalPixelRatio: number): void;
1035
+ /** The corners themselves, without the preview one. */
1036
+ private _screenCorners;
1037
+ private _drawHandle;
1038
+ private _rgba;
1039
+ private _hitTestPrimitive;
1040
+ hitTest(x: number, y: number): boolean;
1041
+ /** Index of the corner under the pointer, or null. */
1042
+ hitTestEndpoint(x: number, y: number): number | null;
1043
+ startDrag(target: number | "shape", grab: DragAnchor): void;
1044
+ updateDrag(time: Time, price: number): void;
1045
+ stopDrag(): void;
1046
+ setColor(color: string): void;
1047
+ color(): string;
1048
+ setSelected(selected: boolean): void;
1049
+ isSelected(): boolean;
1050
+ setHovered(hovered: boolean): void;
1051
+ isHovered(): boolean;
1052
+ /** The corners, for callers that need the shape rather than its picture. */
1053
+ points(): readonly PolygonVertex[];
1054
+ remove(): void;
1055
+ protected _serializeShape(): SerializedDrawingTool;
1056
+ }
821
1057
  export declare class PositionCalculator {
822
1058
  private _pipConfig;
823
1059
  constructor(pipConfig: PipConfig);
@@ -1099,6 +1335,12 @@ export declare class RulerTool extends DrawingToolBase {
1099
1335
  private _createPaneView;
1100
1336
  private _initializeInteractiveMode;
1101
1337
  drawToCanvas(ctx: CanvasRenderingContext2D, horizontalPixelRatio: number, verticalPixelRatio: number): void;
1338
+ /**
1339
+ * Marks the span on the axis being measured: a price range gets horizontal
1340
+ * caps at each level, a date range vertical ones at each moment. Without
1341
+ * them a diagonal line between two points reads as a trend line.
1342
+ */
1343
+ private _drawBracket;
1102
1344
  private _drawEndpoint;
1103
1345
  private _drawPreview;
1104
1346
  private _drawLabel;
@@ -1221,7 +1463,17 @@ export declare class TradingSessionsIndicator {
1221
1463
  private _isTimeInSession;
1222
1464
  private _getUTCHour;
1223
1465
  private _clearSessionBoxes;
1224
- updateOptions(options: Partial<TradingSessionsOptions>): void;
1466
+ /**
1467
+ * Merge options into the running indicator and repaint.
1468
+ *
1469
+ * The repaint is unconditional on purpose: the disabled branch only drops the
1470
+ * boxes from the model, and `_updateSessionHighlights` bails out early when
1471
+ * there is no visible range or no data. Without it, either path leaves the
1472
+ * boxes it just cleared on screen until something else happens to redraw.
1473
+ */
1474
+ applyOptions(options: Partial<TradingSessionsOptions>): void;
1475
+ /** The options currently in effect, defaults included. */
1476
+ options(): Required<TradingSessionsOptions>;
1225
1477
  enable(): void;
1226
1478
  disable(): void;
1227
1479
  remove(): void;
@@ -1248,6 +1500,24 @@ export declare class TrendLineTool extends DrawingToolBase {
1248
1500
  private _initializeInteractiveMode;
1249
1501
  private _createPrimitive;
1250
1502
  private _createPaneView;
1503
+ /**
1504
+ * The segment actually drawn, in CSS pixels, extensions included.
1505
+ *
1506
+ * Drawing and hit-testing have to agree on this: with the geometry inlined in
1507
+ * the renderer, a ray was painted across the chart but only pickable between
1508
+ * its two handles.
1509
+ */
1510
+ private _drawnSegment;
1511
+ /**
1512
+ * The level the axis label reports: where the line is at its right-hand end.
1513
+ * For a ray that is the chart edge, which is the level it is acting as
1514
+ * support or resistance at right now.
1515
+ *
1516
+ * A steep ray leaves the visible range long before the edge, and a label
1517
+ * outside the scale is simply not drawn — so it falls back to the handle,
1518
+ * which is always somewhere the user put it.
1519
+ */
1520
+ private _labelPrice;
1251
1521
  drawToCanvas(ctx: CanvasRenderingContext2D, horizontalPixelRatio: number, verticalPixelRatio: number): void;
1252
1522
  private _drawPreview;
1253
1523
  private _drawEndpoint;
@@ -1331,11 +1601,17 @@ export declare class VolumeProfileIndicator {
1331
1601
  addVolumeData(time: Time, volume: number): void;
1332
1602
  private _calculateProfile;
1333
1603
  getProfileData(): VolumeProfileData | null;
1334
- updateOptions(options: Partial<VolumeProfileOptions>): void;
1604
+ /**
1605
+ * Merge options into the running indicator and repaint. `_calculateProfile`
1606
+ * returns early without redrawing when there is no data yet, so the repaint
1607
+ * is asked for here rather than left to it.
1608
+ */
1609
+ applyOptions(options: Partial<VolumeProfileOptions>): void;
1335
1610
  remove(): void;
1336
1611
  getChart(): IChartApi;
1337
1612
  getSeries(): ISeriesApi<SeriesType>;
1338
- getOptions(): Required<VolumeProfileOptions>;
1613
+ /** The options currently in effect, defaults included. */
1614
+ options(): Required<VolumeProfileOptions>;
1339
1615
  private _requestUpdate;
1340
1616
  }
1341
1617
  export declare const DEFAULT_SESSIONS: TradingSession[];
@@ -1547,98 +1823,253 @@ export declare enum TrackingModeExitMode {
1547
1823
  */
1548
1824
  OnNextTap = 1
1549
1825
  }
1826
+ /**
1827
+ * Average Directional Index, with the +DI/-DI pair it is read against.
1828
+ *
1829
+ * ADX measures how strong a trend is without saying which way it goes; the
1830
+ * directional lines say which side is in control. All three are bounded to
1831
+ * 0-100, so the pane is pinned to that range.
1832
+ *
1833
+ * @param series - Source series
1834
+ * @param chart - Chart instance
1835
+ * @param options - ADX configuration
1836
+ * @returns The three series, plus live control over the options
1837
+ */
1838
+ export declare function applyADX(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: ADXOptions): IndicatorRuntime<ADXOptions> & {
1839
+ adx: ISeriesApi<"Line">;
1840
+ plusDI: ISeriesApi<"Line">;
1841
+ minusDI: ISeriesApi<"Line">;
1842
+ };
1550
1843
  /**
1551
1844
  * Apply ATR (Average True Range) indicator to a series
1552
1845
  * @param series - Source series
1553
1846
  * @param chart - Chart instance
1554
1847
  * @param options - ATR configuration
1555
- * @returns The ATR line series
1848
+ * @returns The ATR line series, plus live control over its options
1556
1849
  */
1557
- export declare function applyATR(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: ATROptions): {
1850
+ export declare function applyATR(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: ATROptions): IndicatorRuntime<ATROptions> & {
1558
1851
  series: ISeriesApi<"Line">;
1559
- remove(): void;
1560
1852
  };
1561
1853
  /**
1562
1854
  * Apply Bollinger Bands indicator to a series
1563
1855
  * @param series - Source series
1564
1856
  * @param chart - Chart instance
1565
1857
  * @param options - Bollinger Bands configuration
1566
- * @returns Object with upper, middle, and lower band series
1858
+ * @returns The three band series, plus live control over the options
1567
1859
  */
1568
- export declare function applyBollingerBands(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: BollingerBandsOptions): {
1860
+ export declare function applyBollingerBands(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: BollingerBandsOptions): IndicatorRuntime<BollingerBandsOptions> & {
1861
+ upper: ISeriesApi<"Line">;
1862
+ middle: ISeriesApi<"Line">;
1863
+ lower: ISeriesApi<"Line">;
1864
+ };
1865
+ /**
1866
+ * Commodity Channel Index.
1867
+ *
1868
+ * Unlike RSI or the stochastic it is not bounded, so the pane is left to
1869
+ * autoscale; the ±100 levels are what give it a frame of reference.
1870
+ *
1871
+ * @param series - Source series
1872
+ * @param chart - Chart instance
1873
+ * @param options - CCI configuration
1874
+ * @returns The CCI line series, plus live control over its options
1875
+ */
1876
+ export declare function applyCCI(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: CCIOptions): IndicatorRuntime<CCIOptions> & {
1877
+ series: ISeriesApi<"Line">;
1878
+ };
1879
+ /**
1880
+ * Donchian Channels: the highest high and lowest low of the last N bars.
1881
+ *
1882
+ * The bands are the breakout levels themselves, so unlike Bollinger or Keltner
1883
+ * they are flat until price makes a new extreme.
1884
+ *
1885
+ * @param series - Source series
1886
+ * @param chart - Chart instance
1887
+ * @param options - Donchian configuration
1888
+ * @returns The three band series, plus live control over the options
1889
+ */
1890
+ export declare function applyDonchianChannels(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: DonchianOptions): IndicatorRuntime<DonchianOptions> & {
1569
1891
  upper: ISeriesApi<"Line">;
1570
1892
  middle: ISeriesApi<"Line">;
1571
1893
  lower: ISeriesApi<"Line">;
1572
- remove(): void;
1573
1894
  };
1574
1895
  /**
1575
1896
  * Apply EMA (Exponential Moving Average) indicator to a series
1576
1897
  * @param series - Source series to calculate EMA from
1577
1898
  * @param chart - Chart instance
1578
1899
  * @param options - EMA configuration options
1579
- * @returns The EMA line series
1900
+ * @returns The EMA line series, plus live control over its options
1580
1901
  */
1581
- export declare function applyEMA(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: EMAOptions): {
1902
+ export declare function applyEMA(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: EMAOptions): IndicatorRuntime<EMAOptions> & {
1582
1903
  series: ISeriesApi<"Line">;
1583
- remove(): void;
1904
+ };
1905
+ /**
1906
+ * Ichimoku Kinko Hyo.
1907
+ *
1908
+ * Five lines, two of which are projected `displacement` bars into the future
1909
+ * and one pushed the same distance into the past. The area between the two
1910
+ * leading spans — the cloud — is filled by a primitive, since the engine draws
1911
+ * lines but nothing between them.
1912
+ *
1913
+ * @param series - Source series
1914
+ * @param chart - Chart instance
1915
+ * @param options - Ichimoku configuration
1916
+ * @returns The five line series, plus live control over the options
1917
+ */
1918
+ export declare function applyIchimoku(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: IchimokuOptions): IndicatorRuntime<IchimokuOptions> & {
1919
+ conversion: ISeriesApi<"Line">;
1920
+ base: ISeriesApi<"Line">;
1921
+ spanA: ISeriesApi<"Line">;
1922
+ spanB: ISeriesApi<"Line">;
1923
+ lagging: ISeriesApi<"Line">;
1924
+ };
1925
+ /**
1926
+ * Keltner Channels: an EMA with bands a multiple of the ATR away.
1927
+ *
1928
+ * Reads like Bollinger but the width follows the true range rather than the
1929
+ * standard deviation, so gaps widen it where Bollinger would ignore them.
1930
+ *
1931
+ * @param series - Source series
1932
+ * @param chart - Chart instance
1933
+ * @param options - Keltner configuration
1934
+ * @returns The three band series, plus live control over the options
1935
+ */
1936
+ export declare function applyKeltnerChannels(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: KeltnerOptions): IndicatorRuntime<KeltnerOptions> & {
1937
+ upper: ISeriesApi<"Line">;
1938
+ middle: ISeriesApi<"Line">;
1939
+ lower: ISeriesApi<"Line">;
1584
1940
  };
1585
1941
  /**
1586
1942
  * Apply MACD indicator to a series
1587
1943
  * @param series - Source series
1588
1944
  * @param chart - Chart instance
1589
1945
  * @param options - MACD configuration
1590
- * @returns Object with macd, signal, and histogram series
1946
+ * @returns The three series, plus live control over the options
1591
1947
  */
1592
- export declare function applyMACD(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: MACDOptions): {
1948
+ export declare function applyMACD(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: MACDOptions): IndicatorRuntime<MACDOptions> & {
1593
1949
  macd: ISeriesApi<"Line">;
1594
1950
  signal: ISeriesApi<"Line">;
1595
1951
  histogram: ISeriesApi<"Histogram">;
1596
- remove(): void;
1952
+ };
1953
+ /**
1954
+ * Money Flow Index — an RSI weighted by volume.
1955
+ *
1956
+ * Needs volumes: feed them with `setSeriesVolumes` before adding it, or it has
1957
+ * nothing to weigh and draws nothing.
1958
+ *
1959
+ * @param series - Source series
1960
+ * @param chart - Chart instance
1961
+ * @param options - MFI configuration
1962
+ * @returns The MFI line series, plus live control over its options
1963
+ */
1964
+ export declare function applyMFI(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: MFIOptions): IndicatorRuntime<MFIOptions> & {
1965
+ series: ISeriesApi<"Line">;
1597
1966
  };
1598
1967
  /**
1599
1968
  * Apply OBV (On-Balance Volume) indicator to a series
1600
1969
  * @param series - Source series
1601
1970
  * @param chart - Chart instance
1602
1971
  * @param options - OBV configuration
1603
- * @returns The OBV line series
1972
+ * @returns The OBV line series, plus live control over its options
1604
1973
  */
1605
- export declare function applyOBV(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: OBVOptions): {
1974
+ export declare function applyOBV(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: OBVOptions): IndicatorRuntime<OBVOptions> & {
1975
+ series: ISeriesApi<"Line">;
1976
+ };
1977
+ /**
1978
+ * Parabolic SAR: a dot per bar marking where the current trend would reverse.
1979
+ *
1980
+ * Drawn as a line series with the line hidden and its point markers on — the
1981
+ * dots are the indicator, and joining them would draw a shape that means
1982
+ * nothing, least of all across a trend flip.
1983
+ *
1984
+ * @param series - Source series
1985
+ * @param chart - Chart instance
1986
+ * @param options - SAR configuration
1987
+ * @returns The dot series, plus live control over the options
1988
+ */
1989
+ export declare function applyParabolicSAR(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: ParabolicSAROptions): IndicatorRuntime<ParabolicSAROptions> & {
1606
1990
  series: ISeriesApi<"Line">;
1607
- remove(): void;
1991
+ };
1992
+ /**
1993
+ * Classic (floor trader) pivot points.
1994
+ *
1995
+ * Each session's levels come from the previous session's high, low and close,
1996
+ * so they are flat for the whole session and step when a new one starts. The
1997
+ * first session has nothing behind it and is left blank rather than drawn from
1998
+ * its own — incomplete — range.
1999
+ *
2000
+ * @param series - Source series
2001
+ * @param chart - Chart instance
2002
+ * @param options - Pivot configuration
2003
+ * @returns The level series, plus live control over the options
2004
+ */
2005
+ export declare function applyPivotPoints(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: PivotPointsOptions): IndicatorRuntime<PivotPointsOptions> & {
2006
+ pivot: ISeriesApi<"Line">;
2007
+ resistances: ISeriesApi<"Line">[];
2008
+ supports: ISeriesApi<"Line">[];
1608
2009
  };
1609
2010
  /**
1610
2011
  * Apply RSI indicator to a series
1611
2012
  * @param series - Source series to calculate RSI from
1612
2013
  * @param chart - Chart instance to add the indicator to
1613
2014
  * @param options - RSI configuration options
1614
- * @returns The RSI line series
2015
+ * @returns The RSI line series, plus live control over its options
1615
2016
  */
1616
- export declare function applyRSI(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: RSIOptions): {
2017
+ export declare function applyRSI(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: RSIOptions): IndicatorRuntime<RSIOptions> & {
1617
2018
  series: ISeriesApi<"Line">;
1618
- remove(): void;
1619
2019
  };
1620
2020
  /**
1621
2021
  * Apply SMA (Simple Moving Average) indicator to a series
1622
2022
  * @param series - Source series to calculate SMA from
1623
2023
  * @param chart - Chart instance
1624
2024
  * @param options - SMA configuration options
1625
- * @returns The SMA line series
2025
+ * @returns The SMA line series, plus live control over its options
1626
2026
  */
1627
- export declare function applySMA(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: SMAOptions): {
2027
+ export declare function applySMA(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: SMAOptions): IndicatorRuntime<SMAOptions> & {
1628
2028
  series: ISeriesApi<"Line">;
1629
- remove(): void;
1630
2029
  };
1631
2030
  /**
1632
2031
  * Apply Stochastic Oscillator indicator to a series
1633
2032
  * @param series - Source series
1634
2033
  * @param chart - Chart instance
1635
2034
  * @param options - Stochastic configuration
1636
- * @returns Object with %K and %D line series
2035
+ * @returns The %K and %D series, plus live control over the options
1637
2036
  */
1638
- export declare function applyStochastic(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: StochasticOptions): {
2037
+ export declare function applyStochastic(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: StochasticOptions): IndicatorRuntime<StochasticOptions> & {
1639
2038
  k: ISeriesApi<"Line">;
1640
2039
  d: ISeriesApi<"Line">;
1641
- remove(): void;
2040
+ };
2041
+ /**
2042
+ * SuperTrend: an ATR band that follows price and flips side on a close through
2043
+ * it, drawn below price in an uptrend and above it in a downtrend.
2044
+ *
2045
+ * The bands only ever tighten while the trend holds — that ratchet is what
2046
+ * makes it a trailing stop rather than a pair of envelopes.
2047
+ *
2048
+ * @param series - Source series
2049
+ * @param chart - Chart instance
2050
+ * @param options - SuperTrend configuration
2051
+ * @returns The trend line, plus live control over the options
2052
+ */
2053
+ export declare function applySuperTrend(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: SuperTrendOptions): IndicatorRuntime<SuperTrendOptions> & {
2054
+ series: ISeriesApi<"Line">;
2055
+ };
2056
+ /**
2057
+ * Volume Weighted Average Price, restarted every session.
2058
+ *
2059
+ * Needs volumes: feed them with `setSeriesVolumes` first, or it has nothing to
2060
+ * weigh. The optional bands are the standard deviation of price around the
2061
+ * running average, which is what makes VWAP readable as a range rather than a
2062
+ * single line.
2063
+ *
2064
+ * @param series - Source series
2065
+ * @param chart - Chart instance
2066
+ * @param options - VWAP configuration
2067
+ * @returns The average and its bands, plus live control over the options
2068
+ */
2069
+ export declare function applyVWAP(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: VWAPOptions): IndicatorRuntime<VWAPOptions> & {
2070
+ series: ISeriesApi<"Line">;
2071
+ upper: ISeriesApi<"Line">;
2072
+ lower: ISeriesApi<"Line">;
1642
2073
  };
1643
2074
  /**
1644
2075
  * Apply Volume indicator to a series
@@ -1646,22 +2077,34 @@ export declare function applyStochastic(series: ISeriesApi<SeriesType>, chart: I
1646
2077
  * @param series - Source series to sync with
1647
2078
  * @param chart - Chart instance
1648
2079
  * @param options - Volume configuration
1649
- * @returns The Volume histogram series
2080
+ * @returns The Volume histogram series, plus live control over its options
1650
2081
  */
1651
- export declare function applyVolume(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: VolumeOptions): {
2082
+ export declare function applyVolume(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: VolumeOptions): IndicatorRuntime<VolumeOptions> & {
1652
2083
  series: ISeriesApi<"Histogram">;
1653
- remove(): void;
1654
2084
  };
1655
2085
  /**
1656
2086
  * Apply WMA (Weighted Moving Average) indicator to a series
1657
2087
  * @param series - Source series to calculate WMA from
1658
2088
  * @param chart - Chart instance
1659
2089
  * @param options - WMA configuration options
1660
- * @returns The WMA line series
2090
+ * @returns The WMA line series, plus live control over its options
1661
2091
  */
1662
- export declare function applyWMA(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: WMAOptions): {
2092
+ export declare function applyWMA(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: WMAOptions): IndicatorRuntime<WMAOptions> & {
2093
+ series: ISeriesApi<"Line">;
2094
+ };
2095
+ /**
2096
+ * Williams %R.
2097
+ *
2098
+ * Runs from -100 to 0 — inverted against the stochastic it mirrors — so the
2099
+ * pane is pinned to that range and overbought sits at the top (-20).
2100
+ *
2101
+ * @param series - Source series
2102
+ * @param chart - Chart instance
2103
+ * @param options - Williams %R configuration
2104
+ * @returns The %R line series, plus live control over its options
2105
+ */
2106
+ export declare function applyWilliamsR(series: ISeriesApi<SeriesType>, chart: IChartApi, options?: WilliamsROptions): IndicatorRuntime<WilliamsROptions> & {
1663
2107
  series: ISeriesApi<"Line">;
1664
- remove(): void;
1665
2108
  };
1666
2109
  /**
1667
2110
  * Automatically calculate pip configuration based on price
@@ -1696,6 +2139,7 @@ export declare function createChart(container: string | HTMLElement, options?: D
1696
2139
  */
1697
2140
  export declare function createChartEx<HorzScaleItem, THorzScaleBehavior extends IHorzScaleBehavior<HorzScaleItem>>(container: string | HTMLElement, horzScaleBehavior: THorzScaleBehavior, options?: DeepPartial<ReturnType<THorzScaleBehavior["options"]>>): IChartApiBase<HorzScaleItem>;
1698
2141
  export declare function createCircleTool(context: DrawingContext, options: CircleToolOptions): CircleTool;
2142
+ export declare function createCrossLineTool(context: DrawingContext, options: CrossLineToolOptions): CrossLineTool;
1699
2143
  export declare function createFibonacciExtensionTool(context: DrawingContext, options: FibonacciExtensionOptions): FibonacciExtensionTool;
1700
2144
  export declare function createFibonacciFanTool(context: DrawingContext, options: FibonacciFanToolOptions): FibonacciFanTool;
1701
2145
  /**
@@ -1757,6 +2201,9 @@ export declare function createInteractiveLineManager(chart: IChartApi, series: I
1757
2201
  * @returns An instance of IChartApiBase configured for price-based horizontal scaling.
1758
2202
  */
1759
2203
  export declare function createOptionsChart(container: string | HTMLElement, options?: DeepPartial<PriceChartOptions>): IChartApiBase<number>;
2204
+ export declare function createParallelChannelTool(context: DrawingContext, options: ParallelChannelToolOptions): ParallelChannelTool;
2205
+ export declare function createPitchforkTool(context: DrawingContext, options: PitchforkToolOptions): PitchforkTool;
2206
+ export declare function createPolygonTool(context: DrawingContext, options: PolygonToolOptions): PolygonTool;
1760
2207
  /**
1761
2208
  * Crea un gestor de marcadores de posiciones de trading
1762
2209
  *
@@ -1993,23 +2440,8 @@ export declare function isBusinessDay(time: Time): time is BusinessDay;
1993
2440
  * @returns `true` if `time` is a {@link UTCTimestamp} number, false otherwise.
1994
2441
  */
1995
2442
  export declare function isUTCTimestamp(time: Time): time is UTCTimestamp;
1996
- /**
1997
- * Set volume data for OBV calculation
1998
- * @param series - The candlestick series
1999
- * @param data - Array with volume field
2000
- */
2001
- export declare function setOBVVolumeData(series: ISeriesApi<SeriesType>, data: any[]): void;
2002
- /**
2003
- * Set volume data for a series
2004
- * Call this function when you set data to your candlestick series
2005
- * @param series - The candlestick series
2006
- * @param data - Array with volume field
2007
- * @example
2008
- * const data = [{time: '2024-01-01', open: 100, high: 105, low: 99, close: 103, volume: 1000000}, ...];
2009
- * candleSeries.setData(data);
2010
- * setVolumeData(candleSeries, data); // Store volume for indicators
2011
- */
2012
- export declare function setVolumeData(series: ISeriesApi<SeriesType>, data: any[]): void;
2443
+ /** Replaces the volumes known for a series. */
2444
+ export declare function setSeriesVolumes(series: ISeriesApi<SeriesType>, data: readonly any[]): void;
2013
2445
  export declare function setVolumeProfileData(indicator: VolumeProfileIndicator, data: Array<{
2014
2446
  time: Time;
2015
2447
  volume: number;
@@ -2022,11 +2454,28 @@ export declare function timeFromCoordinate(chart: IChartApi, series: ISeriesApi<
2022
2454
  * Returns the current version as a string. For example `'1.0.0'`.
2023
2455
  */
2024
2456
  export declare function version(): string;
2457
+ export interface ADXOptions {
2458
+ /** Pane the indicator is drawn in. Fixed at creation. */
2459
+ paneIndex?: number;
2460
+ period?: number;
2461
+ colorADX?: string;
2462
+ colorPlusDI?: string;
2463
+ colorMinusDI?: string;
2464
+ lineWidth?: number;
2465
+ /** 0 solid, 1 dotted, 2 dashed, 3 large dashed, 4 sparse dotted. */
2466
+ lineStyle?: number;
2467
+ /** Trend-strength threshold drawn across the pane. Null hides it. */
2468
+ threshold?: number | null;
2469
+ levelColor?: string;
2470
+ /** Whether the two directional lines are drawn alongside the ADX. */
2471
+ showDI?: boolean;
2472
+ }
2025
2473
  export interface ATROptions {
2026
- /** Pane the indicator is drawn in. Defaults to its historical value. */
2474
+ /** Pane the indicator is drawn in. Fixed at creation. */
2027
2475
  paneIndex?: number;
2028
2476
  period?: number;
2029
2477
  color?: string;
2478
+ lineWidth?: number;
2030
2479
  }
2031
2480
  /**
2032
2481
  * Structure describing a single item of data for area series
@@ -2449,13 +2898,15 @@ export interface BaselineStyleOptions {
2449
2898
  lastPriceAnimation: LastPriceAnimationMode;
2450
2899
  }
2451
2900
  export interface BollingerBandsOptions {
2452
- /** Pane the indicator is drawn in. Defaults to its historical value. */
2901
+ /** Pane the indicator is drawn in. Fixed at creation. */
2453
2902
  paneIndex?: number;
2454
2903
  period?: number;
2455
2904
  stdDev?: number;
2456
2905
  colorUpper?: string;
2457
2906
  colorMiddle?: string;
2458
2907
  colorLower?: string;
2908
+ /** Width of the outer bands. The middle band is drawn one step thicker. */
2909
+ lineWidth?: number;
2459
2910
  }
2460
2911
  export interface BrushPoint {
2461
2912
  time: Time;
@@ -2495,6 +2946,19 @@ export interface BusinessDay {
2495
2946
  */
2496
2947
  day: number;
2497
2948
  }
2949
+ export interface CCIOptions {
2950
+ /** Pane the indicator is drawn in. Fixed at creation. */
2951
+ paneIndex?: number;
2952
+ period?: number;
2953
+ color?: string;
2954
+ lineWidth?: number;
2955
+ /** 0 solid, 1 dotted, 2 dashed, 3 large dashed, 4 sparse dotted. */
2956
+ lineStyle?: number;
2957
+ /** Reference levels drawn across the pane. Null hides one. */
2958
+ overbought?: number | null;
2959
+ oversold?: number | null;
2960
+ levelColor?: string;
2961
+ }
2498
2962
  /**
2499
2963
  * Structure describing a single item of data for candlestick series
2500
2964
  */
@@ -2707,6 +3171,17 @@ export interface ControllableLine {
2707
3171
  cancelDrag(): void;
2708
3172
  click(): void;
2709
3173
  }
3174
+ export interface CrossLineToolOptions extends DrawingToolOptions {
3175
+ time?: Time;
3176
+ price?: number;
3177
+ lineColor?: string;
3178
+ lineWidth?: number;
3179
+ lineStyle?: "solid" | "dashed" | "dotted";
3180
+ /** Show the level on the price axis. */
3181
+ showPriceLabel?: boolean;
3182
+ onUpdate?: () => void;
3183
+ onRemove?: () => void;
3184
+ }
2710
3185
  /** Structure describing a crosshair line (vertical or horizontal) */
2711
3186
  export interface CrosshairLineOptions {
2712
3187
  /**
@@ -2827,6 +3302,19 @@ export interface CustomStyleOptions {
2827
3302
  */
2828
3303
  color: string;
2829
3304
  }
3305
+ export interface DonchianOptions {
3306
+ /** Pane the indicator is drawn in. Fixed at creation. */
3307
+ paneIndex?: number;
3308
+ period?: number;
3309
+ colorUpper?: string;
3310
+ colorMiddle?: string;
3311
+ colorLower?: string;
3312
+ lineWidth?: number;
3313
+ /** 0 solid, 1 dotted, 2 dashed, 3 large dashed, 4 sparse dotted. */
3314
+ lineStyle?: number;
3315
+ /** Whether the midline between the two extremes is drawn. */
3316
+ showMiddle?: boolean;
3317
+ }
2830
3318
  /**
2831
3319
  * Pointer position captured when a drag gesture starts. Whole-object moves are
2832
3320
  * computed as an offset from this anchor, so the object keeps its position
@@ -2920,10 +3408,15 @@ export interface DrawingUtils {
2920
3408
  readonly setLineStyle: (ctx: CanvasRenderingContext2D, lineStyle: LineStyle) => void;
2921
3409
  }
2922
3410
  export interface EMAOptions {
2923
- /** Pane the indicator is drawn in. Defaults to its historical value. */
3411
+ /** Pane the indicator is drawn in. Fixed at creation. */
2924
3412
  paneIndex?: number;
2925
3413
  period?: number;
2926
3414
  color?: string;
3415
+ lineWidth?: number;
3416
+ /** Which price of each bar to compute from. Defaults to the close. */
3417
+ source?: IndicatorSource;
3418
+ /** 0 solid, 1 dotted, 2 dashed, 3 large dashed, 4 sparse dotted. */
3419
+ lineStyle?: number;
2927
3420
  }
2928
3421
  export interface FibonacciExtensionLevel {
2929
3422
  level: number;
@@ -2990,6 +3483,15 @@ export interface FibonacciToolOptions extends DrawingToolOptions {
2990
3483
  point2Time?: Time;
2991
3484
  point2Price?: number;
2992
3485
  useExtended?: boolean;
3486
+ /**
3487
+ * The levels to draw, as plain ratios. Overrides `useExtended`, which only
3488
+ * picks between two fixed sets — traders keep their own, and dropping the
3489
+ * ones they do not read is half the point of the tool.
3490
+ *
3491
+ * Numbers rather than `{ ratio, label }` objects on purpose: these cross the
3492
+ * boundary to the app, and the build-time mangler renames object keys.
3493
+ */
3494
+ levels?: number[];
2993
3495
  interactive?: boolean;
2994
3496
  lineColor?: string;
2995
3497
  lineWidth?: number;
@@ -3139,11 +3641,18 @@ export interface HistogramStyleOptions {
3139
3641
  export interface HorizontalLineToolOptions extends DrawingToolOptions {
3140
3642
  price?: number;
3141
3643
  interactive?: boolean;
3644
+ /**
3645
+ * Where the line starts. Left undefined it spans the whole chart; set, the
3646
+ * line only runs from there to the right edge — a horizontal ray.
3647
+ */
3648
+ startTime?: Time;
3142
3649
  lineColor?: string;
3143
3650
  lineWidth?: number;
3144
3651
  lineStyle?: "solid" | "dashed" | "dotted";
3145
3652
  showLabel?: boolean;
3146
3653
  labelText?: string;
3654
+ /** Show the level on the price axis. */
3655
+ showPriceLabel?: boolean;
3147
3656
  onUpdate?: () => void;
3148
3657
  onRemove?: () => void;
3149
3658
  }
@@ -4781,6 +5290,29 @@ export interface IYieldCurveChartApi extends Omit<IChartApiBase<number>, "addSer
4781
5290
  */
4782
5291
  addSeries<T extends YieldCurveSeriesType>(definition: SeriesDefinition<T>, options?: SeriesPartialOptionsMap[T], paneIndex?: number): ISeriesApi<T, number, WhitespaceData<number> | LineData<number>>;
4783
5292
  }
5293
+ export interface IchimokuOptions {
5294
+ /** Pane the indicator is drawn in. Fixed at creation. */
5295
+ paneIndex?: number;
5296
+ /** Period of the conversion line (Tenkan-sen). */
5297
+ conversionPeriod?: number;
5298
+ /** Period of the base line (Kijun-sen). */
5299
+ basePeriod?: number;
5300
+ /** Period of the second leading span (Senkou Span B). */
5301
+ spanBPeriod?: number;
5302
+ /** How far the cloud is projected forward and the lagging span pushed back. */
5303
+ displacement?: number;
5304
+ colorConversion?: string;
5305
+ colorBase?: string;
5306
+ colorSpanA?: string;
5307
+ colorSpanB?: string;
5308
+ colorLagging?: string;
5309
+ cloudBullishColor?: string;
5310
+ cloudBearishColor?: string;
5311
+ cloudOpacity?: number;
5312
+ showCloud?: boolean;
5313
+ showLagging?: boolean;
5314
+ lineWidth?: number;
5315
+ }
4784
5316
  export interface ImageWatermarkOptions {
4785
5317
  /**
4786
5318
  * Maximum width for the image watermark.
@@ -4809,6 +5341,48 @@ export interface ImageWatermarkOptions {
4809
5341
  */
4810
5342
  alpha: number;
4811
5343
  }
5344
+ /**
5345
+ * What every indicator returns. Options can be changed on a live indicator, so
5346
+ * a chart never has to drop and rebuild one to restyle it or move its period.
5347
+ *
5348
+ * `TOptions` is the indicator's own public options interface, with defaults
5349
+ * already resolved: `options()` always answers with a complete set.
5350
+ */
5351
+ export interface IndicatorRuntime<TOptions extends object> {
5352
+ /**
5353
+ * Remove the indicator: drops its series and stops listening to the source.
5354
+ * Without this the subscription outlives the indicator and keeps writing to
5355
+ * a series that no longer exists.
5356
+ */
5357
+ remove(): void;
5358
+ /** Force a full recalculation. */
5359
+ recalculate(): void;
5360
+ /**
5361
+ * Merge options into the running indicator. Style-only changes restyle the
5362
+ * series; anything listed in `recomputeOn` also recalculates. `paneIndex` is
5363
+ * fixed at creation and ignored here.
5364
+ */
5365
+ applyOptions(next: Partial<TOptions>): void;
5366
+ /** The options currently in effect, defaults included. */
5367
+ options(): TOptions;
5368
+ }
5369
+ export interface KeltnerOptions {
5370
+ /** Pane the indicator is drawn in. Fixed at creation. */
5371
+ paneIndex?: number;
5372
+ /** Period of the exponential moving average at the centre. */
5373
+ period?: number;
5374
+ /** Period of the average true range that sets the width. */
5375
+ atrPeriod?: number;
5376
+ /** How many ATRs the bands sit from the centre. */
5377
+ multiplier?: number;
5378
+ source?: IndicatorSource;
5379
+ colorUpper?: string;
5380
+ colorMiddle?: string;
5381
+ colorLower?: string;
5382
+ lineWidth?: number;
5383
+ /** 0 solid, 1 dotted, 2 dashed, 3 large dashed, 4 sparse dotted. */
5384
+ lineStyle?: number;
5385
+ }
4812
5386
  /**
4813
5387
  * Represents options for enabling or disabling kinetic scrolling with mouse and touch gestures.
4814
5388
  */
@@ -5105,14 +5679,29 @@ export interface LocalizationOptionsBase {
5105
5679
  tickmarksPercentageFormatter?: TickmarksPercentageFormatterFn;
5106
5680
  }
5107
5681
  export interface MACDOptions {
5108
- /** Pane the indicator is drawn in. Defaults to its historical value. */
5682
+ /** Pane the indicator is drawn in. Fixed at creation. */
5109
5683
  paneIndex?: number;
5110
5684
  fastPeriod?: number;
5111
5685
  slowPeriod?: number;
5112
5686
  signalPeriod?: number;
5113
5687
  colorMACD?: string;
5114
5688
  colorSignal?: string;
5115
- colorHistogram?: string;
5689
+ colorHistogramUp?: string;
5690
+ colorHistogramDown?: string;
5691
+ lineWidth?: number;
5692
+ }
5693
+ export interface MFIOptions {
5694
+ /** Pane the indicator is drawn in. Fixed at creation. */
5695
+ paneIndex?: number;
5696
+ period?: number;
5697
+ color?: string;
5698
+ lineWidth?: number;
5699
+ /** 0 solid, 1 dotted, 2 dashed, 3 large dashed, 4 sparse dotted. */
5700
+ lineStyle?: number;
5701
+ /** Reference levels drawn across the pane. Null hides one. */
5702
+ overbought?: number | null;
5703
+ oversold?: number | null;
5704
+ levelColor?: string;
5116
5705
  }
5117
5706
  /**
5118
5707
  * Represents a mouse event.
@@ -5159,9 +5748,10 @@ export interface MouseEventParams<HorzScaleItem = Time> {
5159
5748
  sourceEvent?: TouchMouseEventData;
5160
5749
  }
5161
5750
  export interface OBVOptions {
5162
- /** Pane the indicator is drawn in. Defaults to its historical value. */
5751
+ /** Pane the indicator is drawn in. Fixed at creation. */
5163
5752
  paneIndex?: number;
5164
5753
  color?: string;
5754
+ lineWidth?: number;
5165
5755
  data?: any[];
5166
5756
  }
5167
5757
  /**
@@ -5231,6 +5821,37 @@ export interface PaneSize {
5231
5821
  /** Width of the Chart Pane (pixels) */
5232
5822
  width: number;
5233
5823
  }
5824
+ export interface ParabolicSAROptions {
5825
+ /** Pane the indicator is drawn in. Fixed at creation. */
5826
+ paneIndex?: number;
5827
+ /** Acceleration factor the trend starts with. */
5828
+ step?: number;
5829
+ /** Ceiling the acceleration factor is capped at. */
5830
+ maxStep?: number;
5831
+ colorUp?: string;
5832
+ colorDown?: string;
5833
+ /** Radius of each dot, in pixels. */
5834
+ dotSize?: number;
5835
+ }
5836
+ export interface ParallelChannelToolOptions extends DrawingToolOptions {
5837
+ point1Time?: Time;
5838
+ point1Price?: number;
5839
+ point2Time?: Time;
5840
+ point2Price?: number;
5841
+ /** Distance to the parallel line, in price. Signed: negative sits below. */
5842
+ channelWidth?: number;
5843
+ interactive?: boolean;
5844
+ lineColor?: string;
5845
+ lineWidth?: number;
5846
+ lineStyle?: "solid" | "dashed" | "dotted";
5847
+ fillColor?: string;
5848
+ fillOpacity?: number;
5849
+ extendRight?: boolean;
5850
+ showPriceLabel?: boolean;
5851
+ onUpdate?: () => void;
5852
+ onRemove?: () => void;
5853
+ onComplete?: () => void;
5854
+ }
5234
5855
  /**
5235
5856
  * Position Calculator - Cálculos de P&L, pips, R:R para trading
5236
5857
  */
@@ -5238,6 +5859,39 @@ export interface PipConfig {
5238
5859
  pipValue: number;
5239
5860
  decimals: number;
5240
5861
  }
5862
+ export interface PitchforkToolOptions extends DrawingToolOptions {
5863
+ /** The pivot the fork opens from. */
5864
+ pivotTime?: Time;
5865
+ pivotPrice?: number;
5866
+ /** The two points whose midpoint the median line runs through. */
5867
+ upperTime?: Time;
5868
+ upperPrice?: number;
5869
+ lowerTime?: Time;
5870
+ lowerPrice?: number;
5871
+ interactive?: boolean;
5872
+ lineColor?: string;
5873
+ lineWidth?: number;
5874
+ lineStyle?: "solid" | "dashed" | "dotted";
5875
+ fillColor?: string;
5876
+ fillOpacity?: number;
5877
+ onUpdate?: () => void;
5878
+ onRemove?: () => void;
5879
+ onComplete?: () => void;
5880
+ }
5881
+ export interface PivotPointsOptions {
5882
+ /** Pane the indicator is drawn in. Fixed at creation. */
5883
+ paneIndex?: number;
5884
+ /** Session the levels are derived from. */
5885
+ pivotPeriod?: SessionPeriod;
5886
+ /** How many support/resistance pairs to draw, from 1 to 3. */
5887
+ levels?: number;
5888
+ colorPivot?: string;
5889
+ colorResistance?: string;
5890
+ colorSupport?: string;
5891
+ lineWidth?: number;
5892
+ /** 0 solid, 1 dotted, 2 dashed, 3 large dashed, 4 sparse dotted. */
5893
+ lineStyle?: number;
5894
+ }
5241
5895
  /**
5242
5896
  * Represents a point on the chart.
5243
5897
  */
@@ -5251,6 +5905,22 @@ export interface Point {
5251
5905
  */
5252
5906
  readonly y: Coordinate;
5253
5907
  }
5908
+ export interface PolygonToolOptions extends DrawingToolOptions {
5909
+ points?: PolygonVertex[];
5910
+ interactive?: boolean;
5911
+ fillColor?: string;
5912
+ fillOpacity?: number;
5913
+ borderColor?: string;
5914
+ borderWidth?: number;
5915
+ borderStyle?: "solid" | "dashed" | "dotted";
5916
+ onUpdate?: () => void;
5917
+ onRemove?: () => void;
5918
+ onComplete?: () => void;
5919
+ }
5920
+ export interface PolygonVertex {
5921
+ time: Time;
5922
+ price: number;
5923
+ }
5254
5924
  /**
5255
5925
  * Opciones para el gestor de posiciones
5256
5926
  */
@@ -5621,10 +6291,19 @@ export interface PrimitiveHoveredItem {
5621
6291
  isBackground?: boolean;
5622
6292
  }
5623
6293
  export interface RSIOptions {
5624
- /** Pane the indicator is drawn in. Defaults to its historical value. */
6294
+ /** Pane the indicator is drawn in. Fixed at creation. */
5625
6295
  paneIndex?: number;
5626
6296
  period?: number;
5627
6297
  color?: string;
6298
+ lineWidth?: number;
6299
+ /** Which price of each bar to compute from. Defaults to the close. */
6300
+ source?: IndicatorSource;
6301
+ /** 0 solid, 1 dotted, 2 dashed, 3 large dashed, 4 sparse dotted. */
6302
+ lineStyle?: number;
6303
+ /** Reference level drawn across the pane. Set to null to hide it. */
6304
+ overbought?: number | null;
6305
+ oversold?: number | null;
6306
+ levelColor?: string;
5628
6307
  }
5629
6308
  export interface RectangleToolOptions extends DrawingToolOptions {
5630
6309
  time1?: Time;
@@ -5667,6 +6346,12 @@ export interface RulerToolOptions extends DrawingToolOptions {
5667
6346
  symbol?: string;
5668
6347
  pipConfig?: PipConfig;
5669
6348
  interactive?: boolean;
6349
+ /**
6350
+ * Which axis the measurement is about. Both by default; a price range only
6351
+ * reports the move, a date range only the elapsed bars, and each draws a
6352
+ * bracket across the axis it ignores so the reading is unambiguous.
6353
+ */
6354
+ measure?: "both" | "price" | "time";
5670
6355
  lineColor?: string;
5671
6356
  lineWidth?: number;
5672
6357
  showLabel?: boolean;
@@ -5678,11 +6363,15 @@ export interface RulerToolOptions extends DrawingToolOptions {
5678
6363
  onRemove?: () => void;
5679
6364
  }
5680
6365
  export interface SMAOptions {
5681
- /** Pane the indicator is drawn in. Defaults to its historical value. */
6366
+ /** Pane the indicator is drawn in. Fixed at creation. */
5682
6367
  paneIndex?: number;
5683
6368
  period?: number;
5684
6369
  color?: string;
5685
6370
  lineWidth?: number;
6371
+ /** Which price of each bar to compute from. Defaults to the close. */
6372
+ source?: IndicatorSource;
6373
+ /** 0 solid, 1 dotted, 2 dashed, 3 large dashed, 4 sparse dotted. */
6374
+ lineStyle?: number;
5686
6375
  }
5687
6376
  /**
5688
6377
  * Serialized drawing tool data — plain JSON-safe object
@@ -6151,12 +6840,30 @@ export interface SolidColor {
6151
6840
  color: string;
6152
6841
  }
6153
6842
  export interface StochasticOptions {
6154
- /** Pane the indicator is drawn in. Defaults to its historical value. */
6843
+ /** Pane the indicator is drawn in. Fixed at creation. */
6155
6844
  paneIndex?: number;
6156
6845
  kPeriod?: number;
6157
6846
  dPeriod?: number;
6158
6847
  colorK?: string;
6159
6848
  colorD?: string;
6849
+ lineWidth?: number;
6850
+ /** 0 solid, 1 dotted, 2 dashed, 3 large dashed, 4 sparse dotted. */
6851
+ lineStyle?: number;
6852
+ /** Reference level drawn across the pane. Set to null to hide it. */
6853
+ overbought?: number | null;
6854
+ oversold?: number | null;
6855
+ levelColor?: string;
6856
+ }
6857
+ export interface SuperTrendOptions {
6858
+ /** Pane the indicator is drawn in. Fixed at creation. */
6859
+ paneIndex?: number;
6860
+ /** Period of the average true range the bands are built from. */
6861
+ period?: number;
6862
+ /** How many ATRs the bands sit from the median price. */
6863
+ multiplier?: number;
6864
+ colorUp?: string;
6865
+ colorDown?: string;
6866
+ lineWidth?: number;
6160
6867
  }
6161
6868
  export interface TextToolOptions extends DrawingToolOptions {
6162
6869
  time?: Time;
@@ -6460,6 +7167,8 @@ export interface TrendLineToolOptions extends DrawingToolOptions {
6460
7167
  lineStyle?: "solid" | "dashed" | "dotted";
6461
7168
  extendLeft?: boolean;
6462
7169
  extendRight?: boolean;
7170
+ /** Show the line's current level on the price axis. */
7171
+ showPriceLabel?: boolean;
6463
7172
  onUpdate?: () => void;
6464
7173
  onRemove?: () => void;
6465
7174
  }
@@ -6484,6 +7193,19 @@ export interface UpDownMarkersPluginOptions {
6484
7193
  */
6485
7194
  updateVisibilityDuration: number;
6486
7195
  }
7196
+ export interface VWAPOptions {
7197
+ /** Pane the indicator is drawn in. Fixed at creation. */
7198
+ paneIndex?: number;
7199
+ /** Session the average restarts on. */
7200
+ anchorPeriod?: SessionPeriod;
7201
+ color?: string;
7202
+ lineWidth?: number;
7203
+ /** 0 solid, 1 dotted, 2 dashed, 3 large dashed, 4 sparse dotted. */
7204
+ lineStyle?: number;
7205
+ /** Standard-deviation bands around the average. 0 hides them. */
7206
+ bandMultiplier?: number;
7207
+ bandColor?: string;
7208
+ }
6487
7209
  /**
6488
7210
  * Represents a vertical gradient of two colors.
6489
7211
  */
@@ -6513,13 +7235,15 @@ export interface VerticalLineToolOptions extends DrawingToolOptions {
6513
7235
  onRemove?: () => void;
6514
7236
  }
6515
7237
  export interface VolumeOptions {
6516
- /** Pane the indicator is drawn in. Defaults to its historical value. */
7238
+ /** Pane the indicator is drawn in. Fixed at creation. */
6517
7239
  paneIndex?: number;
6518
7240
  colorUp?: string;
6519
7241
  colorDown?: string;
6520
7242
  }
6521
7243
  export interface VolumeProfileData {
6522
7244
  bins: PriceVolumeBin[];
7245
+ /** Price span each bin covers, so a bin can be drawn as tall as its band. */
7246
+ binSize: number;
6523
7247
  poc: number;
6524
7248
  valueAreaHigh: number;
6525
7249
  valueAreaLow: number;
@@ -6534,14 +7258,20 @@ export interface VolumeProfileOptions {
6534
7258
  pocColor?: string;
6535
7259
  valueAreaColor?: string;
6536
7260
  opacity?: number;
7261
+ /** Width of the histogram in pixels, capped at a fifth of the chart. */
6537
7262
  width?: number;
6538
7263
  position?: "left" | "right";
6539
7264
  }
6540
7265
  export interface WMAOptions {
6541
- /** Pane the indicator is drawn in. Defaults to its historical value. */
7266
+ /** Pane the indicator is drawn in. Fixed at creation. */
6542
7267
  paneIndex?: number;
6543
7268
  period?: number;
6544
7269
  color?: string;
7270
+ lineWidth?: number;
7271
+ /** Which price of each bar to compute from. Defaults to the close. */
7272
+ source?: IndicatorSource;
7273
+ /** 0 solid, 1 dotted, 2 dashed, 3 large dashed, 4 sparse dotted. */
7274
+ lineStyle?: number;
6545
7275
  }
6546
7276
  /**
6547
7277
  * Represents a whitespace data item, which is a data point without a value.
@@ -6570,6 +7300,19 @@ export interface WhitespaceData<HorzScaleItem = Time> {
6570
7300
  */
6571
7301
  customValues?: Record<string, unknown>;
6572
7302
  }
7303
+ export interface WilliamsROptions {
7304
+ /** Pane the indicator is drawn in. Fixed at creation. */
7305
+ paneIndex?: number;
7306
+ period?: number;
7307
+ color?: string;
7308
+ lineWidth?: number;
7309
+ /** 0 solid, 1 dotted, 2 dashed, 3 large dashed, 4 sparse dotted. */
7310
+ lineStyle?: number;
7311
+ /** Reference levels drawn across the pane. Null hides one. */
7312
+ overbought?: number | null;
7313
+ oversold?: number | null;
7314
+ levelColor?: string;
7315
+ }
6573
7316
  /**
6574
7317
  * Extended chart options that include yield curve specific options.
6575
7318
  * This interface combines the standard chart options with yield curve options.
@@ -6671,6 +7414,7 @@ export type CandlestickSeriesOptions = SeriesOptions<CandlestickStyleOptions>;
6671
7414
  * Represents candlestick series options where all properties are optional.
6672
7415
  */
6673
7416
  export type CandlestickSeriesPartialOptions = SeriesPartialOptions<CandlestickStyleOptions>;
7417
+ export type ChannelPart = "point1" | "point2" | "width" | "body";
6674
7418
  /**
6675
7419
  * Structure describing options of the chart with time points at the horizontal scale. Series options are to be set separately
6676
7420
  */
@@ -6761,6 +7505,8 @@ export type IPanePrimitive<HorzScaleItem = Time> = IPanePrimitiveBase<PaneAttach
6761
7505
  */
6762
7506
  export type ISeriesPrimitive<HorzScaleItem = Time> = ISeriesPrimitiveBase<SeriesAttachedParameter<HorzScaleItem, SeriesType>>;
6763
7507
  export type ITextWatermarkPluginApi<T> = PrimitiveHasApplyOptions<IPanePrimitiveWrapper<T, TextWatermarkOptions>>;
7508
+ /** Which price of each bar an indicator is computed from. */
7509
+ export type IndicatorSource = "close" | "open" | "high" | "low" | "hl2" | "hlc3" | "ohlc4";
6764
7510
  /**
6765
7511
  * Internal Horizontal Scale Item
6766
7512
  */
@@ -6843,6 +7589,7 @@ export type OverlayPriceScaleOptions = Omit<PriceScaleOptions, "visible" | "auto
6843
7589
  * A function used to format a percentage value as a string.
6844
7590
  */
6845
7591
  export type PercentageFormatterFn = (percentageValue: number) => string;
7592
+ export type PitchforkPart = "pivot" | "upper" | "lower" | "body";
6846
7593
  /**
6847
7594
  * Tipo de posición de trading
6848
7595
  */
@@ -6937,6 +7684,8 @@ export type SeriesPartialOptions<T> = DeepPartial<T & SeriesOptionsCommon>;
6937
7684
  * @see {@link SeriesOptionsMap}
6938
7685
  */
6939
7686
  export type SeriesType = keyof SeriesOptionsMap;
7687
+ /** How a series is cut into sessions. */
7688
+ export type SessionPeriod = "daily" | "weekly" | "monthly";
6940
7689
  /**
6941
7690
  * A custom function used to handle changes to the time scale's size.
6942
7691
  */