react-native-vroom-chart 0.15.0 → 0.16.0
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/cpp/VroomChartHostObject.cpp +171 -1
- package/cpp/_core_include/vroom/vroom_chart.h +137 -4
- package/cpp/_core_src/atr.cpp +67 -0
- package/cpp/_core_src/atr.h +44 -0
- package/cpp/_core_src/atr_pane.cpp +162 -0
- package/cpp/_core_src/atr_pane.h +48 -0
- package/cpp/_core_src/chart.cpp +461 -172
- package/cpp/_core_src/chart.h +150 -1
- package/cpp/_core_src/chart_facade.cpp +209 -23
- package/cpp/_core_src/fair_value_gaps.cpp +76 -0
- package/cpp/_core_src/fair_value_gaps.h +54 -0
- package/cpp/_core_src/fvg_overlay.cpp +262 -0
- package/cpp/_core_src/fvg_overlay.h +43 -0
- package/cpp/_core_src/ichimoku.cpp +65 -0
- package/cpp/_core_src/ichimoku.h +45 -0
- package/cpp/_core_src/labels.cpp +3 -0
- package/cpp/_core_src/line_morph.h +159 -0
- package/cpp/_core_src/ma_overlay.cpp +259 -36
- package/cpp/_core_src/ma_overlay.h +57 -2
- package/cpp/_core_src/macd.cpp +24 -1
- package/cpp/_core_src/macd.h +16 -0
- package/cpp/_core_src/macd_pane.cpp +71 -62
- package/cpp/_core_src/macd_pane.h +13 -1
- package/cpp/_core_src/pane_series.h +169 -0
- package/cpp/_core_src/rsi.cpp +4 -0
- package/cpp/_core_src/rsi.h +7 -0
- package/cpp/_core_src/rsi_pane.cpp +85 -29
- package/cpp/_core_src/rsi_pane.h +11 -1
- package/cpp/_core_src/viewport.h +35 -0
- package/lib/index.d.mts +251 -3
- package/lib/index.d.ts +251 -3
- package/lib/index.js +224 -6
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +224 -6
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/VroomChart.tsx +21 -3
- package/src/dataTransitions.ts +47 -0
- package/src/index.ts +5 -0
- package/src/jsi.d.ts +97 -1
- package/src/types.ts +5 -0
- package/src/useChartCore.ts +284 -5
package/lib/index.d.mts
CHANGED
|
@@ -194,6 +194,14 @@ type TransitionEasing = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out';
|
|
|
194
194
|
* (e.g. a fixed lookback).
|
|
195
195
|
*/
|
|
196
196
|
type IntervalTransition = 'transform' | 'fade';
|
|
197
|
+
/**
|
|
198
|
+
* How a live update to the series being displayed animates. `'none'` (default)
|
|
199
|
+
* applies it on the next frame with no animation and leaves the viewport where
|
|
200
|
+
* it is. `'transform'` eases the in-progress bar into its new values and, when
|
|
201
|
+
* the view is already pinned to the newest bar, slides the series left as each
|
|
202
|
+
* new bar arrives.
|
|
203
|
+
*/
|
|
204
|
+
type StreamTransition = 'none' | 'transform';
|
|
197
205
|
/** Active drawing tool while in `draw` mode. `null` draws nothing. */
|
|
198
206
|
type DrawTool = null | 'line' | 'box' | 'pencil' | 'path';
|
|
199
207
|
/** A drawing anchor in data space, so it stays glued to the candles on pan/zoom. */
|
|
@@ -436,6 +444,16 @@ type RSIConfig = {
|
|
|
436
444
|
bandColor?: string | number;
|
|
437
445
|
/** Draw the overbought/oversold rules. Default true. */
|
|
438
446
|
bandsVisible?: boolean;
|
|
447
|
+
/**
|
|
448
|
+
* Shade the stretches where the RSI line sits past a band, fading out at the
|
|
449
|
+
* rule and deepening toward the end of the scale, so how far a reading went
|
|
450
|
+
* past the threshold reads at a glance. Default true.
|
|
451
|
+
*
|
|
452
|
+
* Colored from the theme's `accentBull` (overbought) and `accentBear`
|
|
453
|
+
* (oversold), the same pair the volume bars and MACD histogram use. Never
|
|
454
|
+
* reaches full opacity — the line and its rule stay legible through it.
|
|
455
|
+
*/
|
|
456
|
+
extremeFill?: boolean;
|
|
439
457
|
};
|
|
440
458
|
/**
|
|
441
459
|
* A moving-average overlay line drawn on the price pane. Provide an array of
|
|
@@ -505,6 +523,180 @@ type BollingerBandsConfig = {
|
|
|
505
523
|
/** Fill opacity 0..1, applied to the upper band color. Default 0.1. */
|
|
506
524
|
fillOpacity?: number;
|
|
507
525
|
};
|
|
526
|
+
/**
|
|
527
|
+
* Ichimoku Kinko Hyo overlay config. Five lines on the price pane plus the
|
|
528
|
+
* cloud (kumo) shaded between the two leading spans. No pane is reserved.
|
|
529
|
+
*
|
|
530
|
+
* Unlike the other overlays, three of the lines are drawn away from the bar
|
|
531
|
+
* they were computed on:
|
|
532
|
+
*
|
|
533
|
+
* - Senkou A and B lead by `displacement` bars, so the cloud extends past the
|
|
534
|
+
* newest candle into empty time. The chart reserves that space when it frames
|
|
535
|
+
* itself, so the forward cloud is on screen without panning.
|
|
536
|
+
* - Chikou lags by `displacement` bars.
|
|
537
|
+
*
|
|
538
|
+
* Ichimoku is built on highs and lows rather than a single price series, so it
|
|
539
|
+
* takes no {@link MASource} or {@link MAKind}.
|
|
540
|
+
*
|
|
541
|
+
* Like the other price-pane overlays, its values don't feed the automatic
|
|
542
|
+
* y-axis fit — the cloud can run off the top or bottom of the pane on a chart
|
|
543
|
+
* scaled to the candles alone.
|
|
544
|
+
*/
|
|
545
|
+
type IchimokuConfig = {
|
|
546
|
+
/** Draw the indicator. Default false. */
|
|
547
|
+
enabled?: boolean;
|
|
548
|
+
/** Tenkan-sen (conversion) lookback. Default 9, clamped to >= 1. */
|
|
549
|
+
tenkanPeriod?: number;
|
|
550
|
+
/** Kijun-sen (base) lookback. Default 26, clamped to >= 1. */
|
|
551
|
+
kijunPeriod?: number;
|
|
552
|
+
/** Senkou Span B lookback. Default 52, clamped to >= 1. */
|
|
553
|
+
senkouBPeriod?: number;
|
|
554
|
+
/**
|
|
555
|
+
* Bars the cloud leads by and Chikou lags by. Default 26, clamped to >= 0.
|
|
556
|
+
* Changing it only moves what's already drawn — the lines themselves don't
|
|
557
|
+
* recompute.
|
|
558
|
+
*/
|
|
559
|
+
displacement?: number;
|
|
560
|
+
/** Tenkan-sen color (hex string or packed ARGB number). Default blue. */
|
|
561
|
+
tenkanColor?: string | number;
|
|
562
|
+
/** Tenkan-sen stroke width in px. Default 1. */
|
|
563
|
+
tenkanWidth?: number;
|
|
564
|
+
/** Draw the Tenkan-sen. Default true. */
|
|
565
|
+
tenkanVisible?: boolean;
|
|
566
|
+
/** Kijun-sen color. Default red. */
|
|
567
|
+
kijunColor?: string | number;
|
|
568
|
+
/** Kijun-sen stroke width in px. Default 1. */
|
|
569
|
+
kijunWidth?: number;
|
|
570
|
+
/** Draw the Kijun-sen. Default true. */
|
|
571
|
+
kijunVisible?: boolean;
|
|
572
|
+
/** Senkou Span A color. Default green. */
|
|
573
|
+
senkouAColor?: string | number;
|
|
574
|
+
/** Senkou Span A stroke width in px. Default 1. */
|
|
575
|
+
senkouAWidth?: number;
|
|
576
|
+
/** Draw the Senkou Span A edge. Default true. */
|
|
577
|
+
senkouAVisible?: boolean;
|
|
578
|
+
/** Senkou Span B color. Default orange. */
|
|
579
|
+
senkouBColor?: string | number;
|
|
580
|
+
/** Senkou Span B stroke width in px. Default 1. */
|
|
581
|
+
senkouBWidth?: number;
|
|
582
|
+
/** Draw the Senkou Span B edge. Default true. */
|
|
583
|
+
senkouBVisible?: boolean;
|
|
584
|
+
/** Chikou span color. Default teal. */
|
|
585
|
+
chikouColor?: string | number;
|
|
586
|
+
/** Chikou span stroke width in px. Default 1. */
|
|
587
|
+
chikouWidth?: number;
|
|
588
|
+
/** Draw the Chikou span. Default true. */
|
|
589
|
+
chikouVisible?: boolean;
|
|
590
|
+
/** Draw the cloud between the two leading spans. Default true. */
|
|
591
|
+
cloudVisible?: boolean;
|
|
592
|
+
/** Cloud fill where Senkou A is above Senkou B. Default green. */
|
|
593
|
+
bullishCloudColor?: string | number;
|
|
594
|
+
/** Cloud fill where Senkou A is below Senkou B. Default red. */
|
|
595
|
+
bearishCloudColor?: string | number;
|
|
596
|
+
/** Cloud opacity 0..1, applied to whichever cloud color is in play. Default 0.15. */
|
|
597
|
+
cloudOpacity?: number;
|
|
598
|
+
};
|
|
599
|
+
/**
|
|
600
|
+
* Fair Value Gap overlay config. Shaded boxes on the price pane marking
|
|
601
|
+
* three-candle imbalances — a run so fast the first and third candles' wicks
|
|
602
|
+
* never overlap, leaving a band of price that was skipped.
|
|
603
|
+
*
|
|
604
|
+
* A gap is bullish when `candles[i - 1].high < candles[i + 1].low` and bearish
|
|
605
|
+
* when `candles[i - 1].low > candles[i + 1].high`, and spans the untouched
|
|
606
|
+
* range between those two wicks. Each box is anchored to the middle bar's open
|
|
607
|
+
* and runs `boxLength` bars to the right, or to the pane's edge under
|
|
608
|
+
* `extendBoxes`.
|
|
609
|
+
*
|
|
610
|
+
* Gaps are tracked until price trades back through them — see `fillType` for
|
|
611
|
+
* which price settles that, and `deleteAfterFill` for what happens once it
|
|
612
|
+
* does. With `showInverse`, a filled gap carries on as a zone of the opposite
|
|
613
|
+
* polarity. Unlike the line overlays, the boxes are pure geometry: they don't
|
|
614
|
+
* feed the automatic y-axis fit.
|
|
615
|
+
*/
|
|
616
|
+
type FairValueGapsConfig = {
|
|
617
|
+
/** Draw the indicator. Default false. */
|
|
618
|
+
enabled?: boolean;
|
|
619
|
+
/** How many bars back to scan for gaps. Default 300, clamped to >= 0. */
|
|
620
|
+
maxBarsBack?: number;
|
|
621
|
+
/**
|
|
622
|
+
* Withhold a gap until its third candle closes. Default false, so a gap
|
|
623
|
+
* formed by the still-forming bar appears immediately and disappears again
|
|
624
|
+
* if that bar fills back in.
|
|
625
|
+
*/
|
|
626
|
+
waitForClose?: boolean;
|
|
627
|
+
/**
|
|
628
|
+
* Which price counts as trading back through the gap. `'close'` (default)
|
|
629
|
+
* needs a candle to close past the far edge; `'wick'` settles it the moment
|
|
630
|
+
* a high or low reaches through.
|
|
631
|
+
*/
|
|
632
|
+
fillType?: 'close' | 'wick';
|
|
633
|
+
/**
|
|
634
|
+
* Hide a gap once it's been filled. Default true. When false the box stays
|
|
635
|
+
* but stops at the bar that filled it, leaving a record of the rebalance.
|
|
636
|
+
*/
|
|
637
|
+
deleteAfterFill?: boolean;
|
|
638
|
+
/**
|
|
639
|
+
* Run every box to the right edge of the pane instead of ending it after
|
|
640
|
+
* `boxLength` bars. Default false. A filled box still stops at its fill bar.
|
|
641
|
+
*/
|
|
642
|
+
extendBoxes?: boolean;
|
|
643
|
+
/** Box width in bars when `extendBoxes` is off. Default 20, clamped to >= 1. */
|
|
644
|
+
boxLength?: number;
|
|
645
|
+
/** Fill color for bullish gaps (hex string or packed ARGB). Default green. */
|
|
646
|
+
bullishColor?: VroomColor;
|
|
647
|
+
/** Fill color for bearish gaps. Default red. */
|
|
648
|
+
bearishColor?: VroomColor;
|
|
649
|
+
/** Fill opacity 0..1, applied to whichever fill color is in play. Default 0.15. */
|
|
650
|
+
opacity?: number;
|
|
651
|
+
/** Draw the box outline. Default true. */
|
|
652
|
+
borderVisible?: boolean;
|
|
653
|
+
/** Outline style. Default `'solid'`. */
|
|
654
|
+
borderStyle?: 'solid' | 'dotted' | 'dashed';
|
|
655
|
+
/** Outline stroke width in px. Default 1. */
|
|
656
|
+
borderWidth?: number;
|
|
657
|
+
/** Outline color for bullish gaps. Defaults to `bullishColor` at full alpha. */
|
|
658
|
+
bullishBorderColor?: VroomColor;
|
|
659
|
+
/** Outline color for bearish gaps. Defaults to `bearishColor` at full alpha. */
|
|
660
|
+
bearishBorderColor?: VroomColor;
|
|
661
|
+
/** Draw a text label on each box. Default true. */
|
|
662
|
+
showLabels?: boolean;
|
|
663
|
+
/** Label text. Default `'FVG'`. */
|
|
664
|
+
label?: string;
|
|
665
|
+
/**
|
|
666
|
+
* Bars of clearance between the box and its label, used only under
|
|
667
|
+
* `extendBoxes` — a fixed-length box places the label inside its right end.
|
|
668
|
+
* Default 10, clamped to >= 0.
|
|
669
|
+
*/
|
|
670
|
+
labelDistance?: number;
|
|
671
|
+
/** Label color. Defaults to the box's border color. */
|
|
672
|
+
labelColor?: VroomColor;
|
|
673
|
+
/** Label font size in px. Defaults to the axis font size. */
|
|
674
|
+
labelFontSize?: number;
|
|
675
|
+
/**
|
|
676
|
+
* Keep drawing a gap after it's been filled, with its polarity flipped — the
|
|
677
|
+
* band price rejected on the way through becomes a zone of the opposite
|
|
678
|
+
* kind. Default false.
|
|
679
|
+
*
|
|
680
|
+
* The inverse box starts where the original one stops, at the close of the
|
|
681
|
+
* bar that filled the gap, and lasts until price reclaims the band the other
|
|
682
|
+
* way (by the same rule `fillType` sets). This pairs with the default
|
|
683
|
+
* `deleteAfterFill: true`: the original box vanishes at the fill and the
|
|
684
|
+
* inverse takes over from there.
|
|
685
|
+
*/
|
|
686
|
+
showInverse?: boolean;
|
|
687
|
+
/**
|
|
688
|
+
* Fill color for inverted zones that are bullish — that is, for *bearish*
|
|
689
|
+
* gaps price has broken above. Defaults to `bullishColor`.
|
|
690
|
+
*/
|
|
691
|
+
inverseBullishColor?: VroomColor;
|
|
692
|
+
/**
|
|
693
|
+
* Fill color for inverted zones that are bearish — that is, for *bullish*
|
|
694
|
+
* gaps price has broken below. Defaults to `bearishColor`.
|
|
695
|
+
*/
|
|
696
|
+
inverseBearishColor?: VroomColor;
|
|
697
|
+
/** Label text on inverted boxes. Default `'iFVG'`. */
|
|
698
|
+
inverseLabel?: string;
|
|
699
|
+
};
|
|
508
700
|
/**
|
|
509
701
|
* Volume bar config. One bottom-anchored bar per candle on the price pane,
|
|
510
702
|
* drawn under the candles and sharing their x position and body width.
|
|
@@ -828,6 +1020,37 @@ type MACDConfig = {
|
|
|
828
1020
|
/** Draw the zero-reference line. Default true. */
|
|
829
1021
|
zeroLineVisible?: boolean;
|
|
830
1022
|
};
|
|
1023
|
+
/**
|
|
1024
|
+
* How the true-range series is smoothed into ATR. `'rma'` is Wilder's original
|
|
1025
|
+
* (alpha = 1/period) and the conventional default; the other two are the
|
|
1026
|
+
* ordinary moving averages applied to the same series.
|
|
1027
|
+
*
|
|
1028
|
+
* Distinct from {@link MAKind}, which the other indicators use — RMA is
|
|
1029
|
+
* specific to Wilder's indicators and isn't offered elsewhere.
|
|
1030
|
+
*/
|
|
1031
|
+
type ATRSmoothing = 'rma' | 'sma' | 'ema';
|
|
1032
|
+
/**
|
|
1033
|
+
* ATR (Average True Range) indicator config. Rendered in its own pane below the
|
|
1034
|
+
* candles: a single line measuring volatility in price units.
|
|
1035
|
+
*
|
|
1036
|
+
* True Range is the widest of the bar's own high-low span and the two gaps from
|
|
1037
|
+
* its extremes to the previous close, so an overnight jump the bar's range
|
|
1038
|
+
* misses still counts. ATR smooths that series over `period` bars. It is
|
|
1039
|
+
* strictly positive and unbounded, so the pane fits 0..peak from its bottom
|
|
1040
|
+
* edge rather than centering on a reference level.
|
|
1041
|
+
*/
|
|
1042
|
+
type ATRConfig = {
|
|
1043
|
+
/** Draw the pane. Default false. */
|
|
1044
|
+
enabled?: boolean;
|
|
1045
|
+
/** Lookback in candles. Default 14. */
|
|
1046
|
+
period?: number;
|
|
1047
|
+
/** Smoothing applied to the true-range series. Default `'rma'`. */
|
|
1048
|
+
smoothing?: ATRSmoothing;
|
|
1049
|
+
/** Line color (hex string or packed ARGB number). Default teal. */
|
|
1050
|
+
lineColor?: string | number;
|
|
1051
|
+
/** Line stroke width in px. Default 1.5. */
|
|
1052
|
+
lineWidth?: number;
|
|
1053
|
+
};
|
|
831
1054
|
/**
|
|
832
1055
|
* Platform-agnostic props shared by every vroom chart component. Each platform
|
|
833
1056
|
* extends this with its own `style` typing (and any platform-only props) to
|
|
@@ -887,17 +1110,41 @@ type VroomChartCoreProps = {
|
|
|
887
1110
|
* motion still snaps.
|
|
888
1111
|
*/
|
|
889
1112
|
intervalTransition?: IntervalTransition;
|
|
1113
|
+
/**
|
|
1114
|
+
* How a live update to the series already on screen animates — a tick to the
|
|
1115
|
+
* in-progress bar, or a newly closed bar arriving. `'none'` (default) snaps,
|
|
1116
|
+
* matching a chart with no streaming at all.
|
|
1117
|
+
*
|
|
1118
|
+
* `'transform'` eases the last bar (and every indicator reading from it) from
|
|
1119
|
+
* its old shape into its new one. When a new bar arrives *and* the view is
|
|
1120
|
+
* still pinned to the newest bar, the window advances with it so the series
|
|
1121
|
+
* translates left. A view panned back into history is never moved.
|
|
1122
|
+
*/
|
|
1123
|
+
streamTransition?: StreamTransition;
|
|
1124
|
+
/**
|
|
1125
|
+
* Duration (ms) of the `streamTransition` animation. Default ~150 — shorter
|
|
1126
|
+
* than `transitionMs`, since ticks can arrive faster than a 300ms curve can
|
|
1127
|
+
* land. `0` snaps. Follows `transitionEasing`. Ignored (snaps) when the OS
|
|
1128
|
+
* requests reduced motion.
|
|
1129
|
+
*/
|
|
1130
|
+
streamTransitionMs?: number;
|
|
890
1131
|
theme?: VroomTheme;
|
|
891
1132
|
/** RSI indicator (pane below the candles). Omit/disable to hide it. */
|
|
892
1133
|
rsi?: RSIConfig;
|
|
893
1134
|
/** MACD indicator (its own pane below the candles). Omit/disable to hide it. */
|
|
894
1135
|
macd?: MACDConfig;
|
|
1136
|
+
/** ATR indicator (its own pane below the candles). Omit/disable to hide it. */
|
|
1137
|
+
atr?: ATRConfig;
|
|
895
1138
|
/** Moving-average overlay lines (SMA/EMA) drawn on the price pane. */
|
|
896
1139
|
movingAverages?: MovingAverageOverlay[];
|
|
897
1140
|
/** VWAP overlay (session anchor, configurable reset). */
|
|
898
1141
|
vwap?: VWAPConfig;
|
|
899
1142
|
/** Bollinger Bands overlay (three lines + fill on the price pane). */
|
|
900
1143
|
bollingerBands?: BollingerBandsConfig;
|
|
1144
|
+
/** Ichimoku Kinko Hyo overlay (five lines + the cloud on the price pane). */
|
|
1145
|
+
ichimoku?: IchimokuConfig;
|
|
1146
|
+
/** Fair Value Gap overlay (shaded imbalance boxes on the price pane). */
|
|
1147
|
+
fairValueGaps?: FairValueGapsConfig;
|
|
901
1148
|
/** Volume bars under the candles. On by default; disable or restyle them here. */
|
|
902
1149
|
volume?: VolumeConfig;
|
|
903
1150
|
/** Resting-order / order-book liquidity bands drawn behind the candles. */
|
|
@@ -1087,8 +1334,9 @@ declare global {
|
|
|
1087
1334
|
* Skia-rendered candlestick chart. Pass OHLCV `candles` and size it via `style`
|
|
1088
1335
|
* (it fills its parent by default). Pan to scroll, pinch to zoom, drag the
|
|
1089
1336
|
* price/time axes to rescale, and long-press for the crosshair. Optional
|
|
1090
|
-
* indicators (`rsi`, `macd`, `movingAverages`, `vwap
|
|
1091
|
-
*
|
|
1337
|
+
* indicators (`rsi`, `macd`, `movingAverages`, `vwap`, `bollingerBands`,
|
|
1338
|
+
* `ichimoku`, and more), colors (`theme`), and events (`onCrosshair`,
|
|
1339
|
+
* `onViewportChange`) are configured through props.
|
|
1092
1340
|
*
|
|
1093
1341
|
* @see {@link VroomChartProps} for the full prop reference.
|
|
1094
1342
|
*/
|
|
@@ -1125,4 +1373,4 @@ declare function classifyTransition(prev: Candle[] | null, next: Candle[], serie
|
|
|
1125
1373
|
*/
|
|
1126
1374
|
declare function timeframeWindow(oldWindow: VisibleRange, oldStepMs: number, oldLastMs: number, newStepMs: number, newLastMs: number): VisibleRange;
|
|
1127
1375
|
|
|
1128
|
-
export { type BollingerBandsConfig, type Candle, type ChartType, type CrosshairEvent, type DataTransition, type DefaultDrawingStyle, type Footprint, type FootprintEvent, type FootprintSide, type FootprintsStyle, type IntervalTransition, type MACDConfig, type MAKind, type MASource, type MovingAverageOverlay, type PlotRect, type PriceLine, type PriceLinesStyle, type RSIConfig, type TransitionEasing, type VWAPConfig, type VisibleRange, type VolumeConfig, VroomChart, type VroomChartProps, type VroomColor, type VroomTheme, classifyTransition, inferStepMs, timeframeWindow };
|
|
1376
|
+
export { type ATRConfig, type ATRSmoothing, type BollingerBandsConfig, type Candle, type ChartType, type CrosshairEvent, type DataTransition, type DefaultDrawingStyle, type FairValueGapsConfig, type Footprint, type FootprintEvent, type FootprintSide, type FootprintsStyle, type IchimokuConfig, type IntervalTransition, type MACDConfig, type MAKind, type MASource, type MovingAverageOverlay, type PlotRect, type PriceLine, type PriceLinesStyle, type RSIConfig, type StreamTransition, type TransitionEasing, type VWAPConfig, type VisibleRange, type VolumeConfig, VroomChart, type VroomChartProps, type VroomColor, type VroomTheme, classifyTransition, inferStepMs, timeframeWindow };
|
package/lib/index.d.ts
CHANGED
|
@@ -194,6 +194,14 @@ type TransitionEasing = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out';
|
|
|
194
194
|
* (e.g. a fixed lookback).
|
|
195
195
|
*/
|
|
196
196
|
type IntervalTransition = 'transform' | 'fade';
|
|
197
|
+
/**
|
|
198
|
+
* How a live update to the series being displayed animates. `'none'` (default)
|
|
199
|
+
* applies it on the next frame with no animation and leaves the viewport where
|
|
200
|
+
* it is. `'transform'` eases the in-progress bar into its new values and, when
|
|
201
|
+
* the view is already pinned to the newest bar, slides the series left as each
|
|
202
|
+
* new bar arrives.
|
|
203
|
+
*/
|
|
204
|
+
type StreamTransition = 'none' | 'transform';
|
|
197
205
|
/** Active drawing tool while in `draw` mode. `null` draws nothing. */
|
|
198
206
|
type DrawTool = null | 'line' | 'box' | 'pencil' | 'path';
|
|
199
207
|
/** A drawing anchor in data space, so it stays glued to the candles on pan/zoom. */
|
|
@@ -436,6 +444,16 @@ type RSIConfig = {
|
|
|
436
444
|
bandColor?: string | number;
|
|
437
445
|
/** Draw the overbought/oversold rules. Default true. */
|
|
438
446
|
bandsVisible?: boolean;
|
|
447
|
+
/**
|
|
448
|
+
* Shade the stretches where the RSI line sits past a band, fading out at the
|
|
449
|
+
* rule and deepening toward the end of the scale, so how far a reading went
|
|
450
|
+
* past the threshold reads at a glance. Default true.
|
|
451
|
+
*
|
|
452
|
+
* Colored from the theme's `accentBull` (overbought) and `accentBear`
|
|
453
|
+
* (oversold), the same pair the volume bars and MACD histogram use. Never
|
|
454
|
+
* reaches full opacity — the line and its rule stay legible through it.
|
|
455
|
+
*/
|
|
456
|
+
extremeFill?: boolean;
|
|
439
457
|
};
|
|
440
458
|
/**
|
|
441
459
|
* A moving-average overlay line drawn on the price pane. Provide an array of
|
|
@@ -505,6 +523,180 @@ type BollingerBandsConfig = {
|
|
|
505
523
|
/** Fill opacity 0..1, applied to the upper band color. Default 0.1. */
|
|
506
524
|
fillOpacity?: number;
|
|
507
525
|
};
|
|
526
|
+
/**
|
|
527
|
+
* Ichimoku Kinko Hyo overlay config. Five lines on the price pane plus the
|
|
528
|
+
* cloud (kumo) shaded between the two leading spans. No pane is reserved.
|
|
529
|
+
*
|
|
530
|
+
* Unlike the other overlays, three of the lines are drawn away from the bar
|
|
531
|
+
* they were computed on:
|
|
532
|
+
*
|
|
533
|
+
* - Senkou A and B lead by `displacement` bars, so the cloud extends past the
|
|
534
|
+
* newest candle into empty time. The chart reserves that space when it frames
|
|
535
|
+
* itself, so the forward cloud is on screen without panning.
|
|
536
|
+
* - Chikou lags by `displacement` bars.
|
|
537
|
+
*
|
|
538
|
+
* Ichimoku is built on highs and lows rather than a single price series, so it
|
|
539
|
+
* takes no {@link MASource} or {@link MAKind}.
|
|
540
|
+
*
|
|
541
|
+
* Like the other price-pane overlays, its values don't feed the automatic
|
|
542
|
+
* y-axis fit — the cloud can run off the top or bottom of the pane on a chart
|
|
543
|
+
* scaled to the candles alone.
|
|
544
|
+
*/
|
|
545
|
+
type IchimokuConfig = {
|
|
546
|
+
/** Draw the indicator. Default false. */
|
|
547
|
+
enabled?: boolean;
|
|
548
|
+
/** Tenkan-sen (conversion) lookback. Default 9, clamped to >= 1. */
|
|
549
|
+
tenkanPeriod?: number;
|
|
550
|
+
/** Kijun-sen (base) lookback. Default 26, clamped to >= 1. */
|
|
551
|
+
kijunPeriod?: number;
|
|
552
|
+
/** Senkou Span B lookback. Default 52, clamped to >= 1. */
|
|
553
|
+
senkouBPeriod?: number;
|
|
554
|
+
/**
|
|
555
|
+
* Bars the cloud leads by and Chikou lags by. Default 26, clamped to >= 0.
|
|
556
|
+
* Changing it only moves what's already drawn — the lines themselves don't
|
|
557
|
+
* recompute.
|
|
558
|
+
*/
|
|
559
|
+
displacement?: number;
|
|
560
|
+
/** Tenkan-sen color (hex string or packed ARGB number). Default blue. */
|
|
561
|
+
tenkanColor?: string | number;
|
|
562
|
+
/** Tenkan-sen stroke width in px. Default 1. */
|
|
563
|
+
tenkanWidth?: number;
|
|
564
|
+
/** Draw the Tenkan-sen. Default true. */
|
|
565
|
+
tenkanVisible?: boolean;
|
|
566
|
+
/** Kijun-sen color. Default red. */
|
|
567
|
+
kijunColor?: string | number;
|
|
568
|
+
/** Kijun-sen stroke width in px. Default 1. */
|
|
569
|
+
kijunWidth?: number;
|
|
570
|
+
/** Draw the Kijun-sen. Default true. */
|
|
571
|
+
kijunVisible?: boolean;
|
|
572
|
+
/** Senkou Span A color. Default green. */
|
|
573
|
+
senkouAColor?: string | number;
|
|
574
|
+
/** Senkou Span A stroke width in px. Default 1. */
|
|
575
|
+
senkouAWidth?: number;
|
|
576
|
+
/** Draw the Senkou Span A edge. Default true. */
|
|
577
|
+
senkouAVisible?: boolean;
|
|
578
|
+
/** Senkou Span B color. Default orange. */
|
|
579
|
+
senkouBColor?: string | number;
|
|
580
|
+
/** Senkou Span B stroke width in px. Default 1. */
|
|
581
|
+
senkouBWidth?: number;
|
|
582
|
+
/** Draw the Senkou Span B edge. Default true. */
|
|
583
|
+
senkouBVisible?: boolean;
|
|
584
|
+
/** Chikou span color. Default teal. */
|
|
585
|
+
chikouColor?: string | number;
|
|
586
|
+
/** Chikou span stroke width in px. Default 1. */
|
|
587
|
+
chikouWidth?: number;
|
|
588
|
+
/** Draw the Chikou span. Default true. */
|
|
589
|
+
chikouVisible?: boolean;
|
|
590
|
+
/** Draw the cloud between the two leading spans. Default true. */
|
|
591
|
+
cloudVisible?: boolean;
|
|
592
|
+
/** Cloud fill where Senkou A is above Senkou B. Default green. */
|
|
593
|
+
bullishCloudColor?: string | number;
|
|
594
|
+
/** Cloud fill where Senkou A is below Senkou B. Default red. */
|
|
595
|
+
bearishCloudColor?: string | number;
|
|
596
|
+
/** Cloud opacity 0..1, applied to whichever cloud color is in play. Default 0.15. */
|
|
597
|
+
cloudOpacity?: number;
|
|
598
|
+
};
|
|
599
|
+
/**
|
|
600
|
+
* Fair Value Gap overlay config. Shaded boxes on the price pane marking
|
|
601
|
+
* three-candle imbalances — a run so fast the first and third candles' wicks
|
|
602
|
+
* never overlap, leaving a band of price that was skipped.
|
|
603
|
+
*
|
|
604
|
+
* A gap is bullish when `candles[i - 1].high < candles[i + 1].low` and bearish
|
|
605
|
+
* when `candles[i - 1].low > candles[i + 1].high`, and spans the untouched
|
|
606
|
+
* range between those two wicks. Each box is anchored to the middle bar's open
|
|
607
|
+
* and runs `boxLength` bars to the right, or to the pane's edge under
|
|
608
|
+
* `extendBoxes`.
|
|
609
|
+
*
|
|
610
|
+
* Gaps are tracked until price trades back through them — see `fillType` for
|
|
611
|
+
* which price settles that, and `deleteAfterFill` for what happens once it
|
|
612
|
+
* does. With `showInverse`, a filled gap carries on as a zone of the opposite
|
|
613
|
+
* polarity. Unlike the line overlays, the boxes are pure geometry: they don't
|
|
614
|
+
* feed the automatic y-axis fit.
|
|
615
|
+
*/
|
|
616
|
+
type FairValueGapsConfig = {
|
|
617
|
+
/** Draw the indicator. Default false. */
|
|
618
|
+
enabled?: boolean;
|
|
619
|
+
/** How many bars back to scan for gaps. Default 300, clamped to >= 0. */
|
|
620
|
+
maxBarsBack?: number;
|
|
621
|
+
/**
|
|
622
|
+
* Withhold a gap until its third candle closes. Default false, so a gap
|
|
623
|
+
* formed by the still-forming bar appears immediately and disappears again
|
|
624
|
+
* if that bar fills back in.
|
|
625
|
+
*/
|
|
626
|
+
waitForClose?: boolean;
|
|
627
|
+
/**
|
|
628
|
+
* Which price counts as trading back through the gap. `'close'` (default)
|
|
629
|
+
* needs a candle to close past the far edge; `'wick'` settles it the moment
|
|
630
|
+
* a high or low reaches through.
|
|
631
|
+
*/
|
|
632
|
+
fillType?: 'close' | 'wick';
|
|
633
|
+
/**
|
|
634
|
+
* Hide a gap once it's been filled. Default true. When false the box stays
|
|
635
|
+
* but stops at the bar that filled it, leaving a record of the rebalance.
|
|
636
|
+
*/
|
|
637
|
+
deleteAfterFill?: boolean;
|
|
638
|
+
/**
|
|
639
|
+
* Run every box to the right edge of the pane instead of ending it after
|
|
640
|
+
* `boxLength` bars. Default false. A filled box still stops at its fill bar.
|
|
641
|
+
*/
|
|
642
|
+
extendBoxes?: boolean;
|
|
643
|
+
/** Box width in bars when `extendBoxes` is off. Default 20, clamped to >= 1. */
|
|
644
|
+
boxLength?: number;
|
|
645
|
+
/** Fill color for bullish gaps (hex string or packed ARGB). Default green. */
|
|
646
|
+
bullishColor?: VroomColor;
|
|
647
|
+
/** Fill color for bearish gaps. Default red. */
|
|
648
|
+
bearishColor?: VroomColor;
|
|
649
|
+
/** Fill opacity 0..1, applied to whichever fill color is in play. Default 0.15. */
|
|
650
|
+
opacity?: number;
|
|
651
|
+
/** Draw the box outline. Default true. */
|
|
652
|
+
borderVisible?: boolean;
|
|
653
|
+
/** Outline style. Default `'solid'`. */
|
|
654
|
+
borderStyle?: 'solid' | 'dotted' | 'dashed';
|
|
655
|
+
/** Outline stroke width in px. Default 1. */
|
|
656
|
+
borderWidth?: number;
|
|
657
|
+
/** Outline color for bullish gaps. Defaults to `bullishColor` at full alpha. */
|
|
658
|
+
bullishBorderColor?: VroomColor;
|
|
659
|
+
/** Outline color for bearish gaps. Defaults to `bearishColor` at full alpha. */
|
|
660
|
+
bearishBorderColor?: VroomColor;
|
|
661
|
+
/** Draw a text label on each box. Default true. */
|
|
662
|
+
showLabels?: boolean;
|
|
663
|
+
/** Label text. Default `'FVG'`. */
|
|
664
|
+
label?: string;
|
|
665
|
+
/**
|
|
666
|
+
* Bars of clearance between the box and its label, used only under
|
|
667
|
+
* `extendBoxes` — a fixed-length box places the label inside its right end.
|
|
668
|
+
* Default 10, clamped to >= 0.
|
|
669
|
+
*/
|
|
670
|
+
labelDistance?: number;
|
|
671
|
+
/** Label color. Defaults to the box's border color. */
|
|
672
|
+
labelColor?: VroomColor;
|
|
673
|
+
/** Label font size in px. Defaults to the axis font size. */
|
|
674
|
+
labelFontSize?: number;
|
|
675
|
+
/**
|
|
676
|
+
* Keep drawing a gap after it's been filled, with its polarity flipped — the
|
|
677
|
+
* band price rejected on the way through becomes a zone of the opposite
|
|
678
|
+
* kind. Default false.
|
|
679
|
+
*
|
|
680
|
+
* The inverse box starts where the original one stops, at the close of the
|
|
681
|
+
* bar that filled the gap, and lasts until price reclaims the band the other
|
|
682
|
+
* way (by the same rule `fillType` sets). This pairs with the default
|
|
683
|
+
* `deleteAfterFill: true`: the original box vanishes at the fill and the
|
|
684
|
+
* inverse takes over from there.
|
|
685
|
+
*/
|
|
686
|
+
showInverse?: boolean;
|
|
687
|
+
/**
|
|
688
|
+
* Fill color for inverted zones that are bullish — that is, for *bearish*
|
|
689
|
+
* gaps price has broken above. Defaults to `bullishColor`.
|
|
690
|
+
*/
|
|
691
|
+
inverseBullishColor?: VroomColor;
|
|
692
|
+
/**
|
|
693
|
+
* Fill color for inverted zones that are bearish — that is, for *bullish*
|
|
694
|
+
* gaps price has broken below. Defaults to `bearishColor`.
|
|
695
|
+
*/
|
|
696
|
+
inverseBearishColor?: VroomColor;
|
|
697
|
+
/** Label text on inverted boxes. Default `'iFVG'`. */
|
|
698
|
+
inverseLabel?: string;
|
|
699
|
+
};
|
|
508
700
|
/**
|
|
509
701
|
* Volume bar config. One bottom-anchored bar per candle on the price pane,
|
|
510
702
|
* drawn under the candles and sharing their x position and body width.
|
|
@@ -828,6 +1020,37 @@ type MACDConfig = {
|
|
|
828
1020
|
/** Draw the zero-reference line. Default true. */
|
|
829
1021
|
zeroLineVisible?: boolean;
|
|
830
1022
|
};
|
|
1023
|
+
/**
|
|
1024
|
+
* How the true-range series is smoothed into ATR. `'rma'` is Wilder's original
|
|
1025
|
+
* (alpha = 1/period) and the conventional default; the other two are the
|
|
1026
|
+
* ordinary moving averages applied to the same series.
|
|
1027
|
+
*
|
|
1028
|
+
* Distinct from {@link MAKind}, which the other indicators use — RMA is
|
|
1029
|
+
* specific to Wilder's indicators and isn't offered elsewhere.
|
|
1030
|
+
*/
|
|
1031
|
+
type ATRSmoothing = 'rma' | 'sma' | 'ema';
|
|
1032
|
+
/**
|
|
1033
|
+
* ATR (Average True Range) indicator config. Rendered in its own pane below the
|
|
1034
|
+
* candles: a single line measuring volatility in price units.
|
|
1035
|
+
*
|
|
1036
|
+
* True Range is the widest of the bar's own high-low span and the two gaps from
|
|
1037
|
+
* its extremes to the previous close, so an overnight jump the bar's range
|
|
1038
|
+
* misses still counts. ATR smooths that series over `period` bars. It is
|
|
1039
|
+
* strictly positive and unbounded, so the pane fits 0..peak from its bottom
|
|
1040
|
+
* edge rather than centering on a reference level.
|
|
1041
|
+
*/
|
|
1042
|
+
type ATRConfig = {
|
|
1043
|
+
/** Draw the pane. Default false. */
|
|
1044
|
+
enabled?: boolean;
|
|
1045
|
+
/** Lookback in candles. Default 14. */
|
|
1046
|
+
period?: number;
|
|
1047
|
+
/** Smoothing applied to the true-range series. Default `'rma'`. */
|
|
1048
|
+
smoothing?: ATRSmoothing;
|
|
1049
|
+
/** Line color (hex string or packed ARGB number). Default teal. */
|
|
1050
|
+
lineColor?: string | number;
|
|
1051
|
+
/** Line stroke width in px. Default 1.5. */
|
|
1052
|
+
lineWidth?: number;
|
|
1053
|
+
};
|
|
831
1054
|
/**
|
|
832
1055
|
* Platform-agnostic props shared by every vroom chart component. Each platform
|
|
833
1056
|
* extends this with its own `style` typing (and any platform-only props) to
|
|
@@ -887,17 +1110,41 @@ type VroomChartCoreProps = {
|
|
|
887
1110
|
* motion still snaps.
|
|
888
1111
|
*/
|
|
889
1112
|
intervalTransition?: IntervalTransition;
|
|
1113
|
+
/**
|
|
1114
|
+
* How a live update to the series already on screen animates — a tick to the
|
|
1115
|
+
* in-progress bar, or a newly closed bar arriving. `'none'` (default) snaps,
|
|
1116
|
+
* matching a chart with no streaming at all.
|
|
1117
|
+
*
|
|
1118
|
+
* `'transform'` eases the last bar (and every indicator reading from it) from
|
|
1119
|
+
* its old shape into its new one. When a new bar arrives *and* the view is
|
|
1120
|
+
* still pinned to the newest bar, the window advances with it so the series
|
|
1121
|
+
* translates left. A view panned back into history is never moved.
|
|
1122
|
+
*/
|
|
1123
|
+
streamTransition?: StreamTransition;
|
|
1124
|
+
/**
|
|
1125
|
+
* Duration (ms) of the `streamTransition` animation. Default ~150 — shorter
|
|
1126
|
+
* than `transitionMs`, since ticks can arrive faster than a 300ms curve can
|
|
1127
|
+
* land. `0` snaps. Follows `transitionEasing`. Ignored (snaps) when the OS
|
|
1128
|
+
* requests reduced motion.
|
|
1129
|
+
*/
|
|
1130
|
+
streamTransitionMs?: number;
|
|
890
1131
|
theme?: VroomTheme;
|
|
891
1132
|
/** RSI indicator (pane below the candles). Omit/disable to hide it. */
|
|
892
1133
|
rsi?: RSIConfig;
|
|
893
1134
|
/** MACD indicator (its own pane below the candles). Omit/disable to hide it. */
|
|
894
1135
|
macd?: MACDConfig;
|
|
1136
|
+
/** ATR indicator (its own pane below the candles). Omit/disable to hide it. */
|
|
1137
|
+
atr?: ATRConfig;
|
|
895
1138
|
/** Moving-average overlay lines (SMA/EMA) drawn on the price pane. */
|
|
896
1139
|
movingAverages?: MovingAverageOverlay[];
|
|
897
1140
|
/** VWAP overlay (session anchor, configurable reset). */
|
|
898
1141
|
vwap?: VWAPConfig;
|
|
899
1142
|
/** Bollinger Bands overlay (three lines + fill on the price pane). */
|
|
900
1143
|
bollingerBands?: BollingerBandsConfig;
|
|
1144
|
+
/** Ichimoku Kinko Hyo overlay (five lines + the cloud on the price pane). */
|
|
1145
|
+
ichimoku?: IchimokuConfig;
|
|
1146
|
+
/** Fair Value Gap overlay (shaded imbalance boxes on the price pane). */
|
|
1147
|
+
fairValueGaps?: FairValueGapsConfig;
|
|
901
1148
|
/** Volume bars under the candles. On by default; disable or restyle them here. */
|
|
902
1149
|
volume?: VolumeConfig;
|
|
903
1150
|
/** Resting-order / order-book liquidity bands drawn behind the candles. */
|
|
@@ -1087,8 +1334,9 @@ declare global {
|
|
|
1087
1334
|
* Skia-rendered candlestick chart. Pass OHLCV `candles` and size it via `style`
|
|
1088
1335
|
* (it fills its parent by default). Pan to scroll, pinch to zoom, drag the
|
|
1089
1336
|
* price/time axes to rescale, and long-press for the crosshair. Optional
|
|
1090
|
-
* indicators (`rsi`, `macd`, `movingAverages`, `vwap
|
|
1091
|
-
*
|
|
1337
|
+
* indicators (`rsi`, `macd`, `movingAverages`, `vwap`, `bollingerBands`,
|
|
1338
|
+
* `ichimoku`, and more), colors (`theme`), and events (`onCrosshair`,
|
|
1339
|
+
* `onViewportChange`) are configured through props.
|
|
1092
1340
|
*
|
|
1093
1341
|
* @see {@link VroomChartProps} for the full prop reference.
|
|
1094
1342
|
*/
|
|
@@ -1125,4 +1373,4 @@ declare function classifyTransition(prev: Candle[] | null, next: Candle[], serie
|
|
|
1125
1373
|
*/
|
|
1126
1374
|
declare function timeframeWindow(oldWindow: VisibleRange, oldStepMs: number, oldLastMs: number, newStepMs: number, newLastMs: number): VisibleRange;
|
|
1127
1375
|
|
|
1128
|
-
export { type BollingerBandsConfig, type Candle, type ChartType, type CrosshairEvent, type DataTransition, type DefaultDrawingStyle, type Footprint, type FootprintEvent, type FootprintSide, type FootprintsStyle, type IntervalTransition, type MACDConfig, type MAKind, type MASource, type MovingAverageOverlay, type PlotRect, type PriceLine, type PriceLinesStyle, type RSIConfig, type TransitionEasing, type VWAPConfig, type VisibleRange, type VolumeConfig, VroomChart, type VroomChartProps, type VroomColor, type VroomTheme, classifyTransition, inferStepMs, timeframeWindow };
|
|
1376
|
+
export { type ATRConfig, type ATRSmoothing, type BollingerBandsConfig, type Candle, type ChartType, type CrosshairEvent, type DataTransition, type DefaultDrawingStyle, type FairValueGapsConfig, type Footprint, type FootprintEvent, type FootprintSide, type FootprintsStyle, type IchimokuConfig, type IntervalTransition, type MACDConfig, type MAKind, type MASource, type MovingAverageOverlay, type PlotRect, type PriceLine, type PriceLinesStyle, type RSIConfig, type StreamTransition, type TransitionEasing, type VWAPConfig, type VisibleRange, type VolumeConfig, VroomChart, type VroomChartProps, type VroomColor, type VroomTheme, classifyTransition, inferStepMs, timeframeWindow };
|