openalgo-charts 2.6.0 → 2.6.2

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.
@@ -52,8 +52,19 @@ interface FootprintBar {
52
52
  high?: number;
53
53
  low?: number;
54
54
  close?: number;
55
- /** Number of classified trade records, not the number of occupied rows. */
55
+ /** Number of classified trade records counted (those passing any size filter), not occupied rows. */
56
56
  tradeCount?: number;
57
+ /**
58
+ * Bid and ask volume of every print, before any size filter, at the bar's
59
+ * exact high and low prices. An extreme that traded on both sides is an
60
+ * unfinished auction. Absent on manually assembled bars.
61
+ */
62
+ auction?: {
63
+ highBid: number;
64
+ highAsk: number;
65
+ lowBid: number;
66
+ lowAsk: number;
67
+ };
57
68
  }
58
69
  /** Bucket a price to the tick grid. */
59
70
  declare function bucketPrice(price: number, step: number): number;
@@ -731,6 +742,15 @@ interface ClassifiedTrade {
731
742
  /** Whether the print hit the bid (sell-initiated) or the ask (buy-initiated). */
732
743
  side: 'bid' | 'ask';
733
744
  }
745
+ /** Options shared by `computeFootprint` and `FootprintAggregator`. */
746
+ interface FootprintBuildOptions {
747
+ /**
748
+ * Count only single prints of at least this raw quantity. Smaller prints still
749
+ * open their row (it shows zero) and still set the bar's open, high, low and
750
+ * close, so the ladder keeps its full range. 0, the default, counts every print.
751
+ */
752
+ minTradeSize?: number;
753
+ }
734
754
  /**
735
755
  * Build one bar's footprint from its classified trades.
736
756
  *
@@ -739,7 +759,7 @@ interface ClassifiedTrade {
739
759
  * the instrument has a coarser tick. Nifty at 0.1 with 2-point bricks is
740
760
  * `computeFootprint(t, trades, 0.1, 20)`.
741
761
  */
742
- declare function computeFootprint(time: number, trades: readonly ClassifiedTrade[], tickSize: number, rowTicks?: number): FootprintBar;
762
+ declare function computeFootprint(time: number, trades: readonly ClassifiedTrade[], tickSize: number, rowTicks?: number, options?: FootprintBuildOptions): FootprintBar;
743
763
  interface Imbalance {
744
764
  price: number;
745
765
  side: 'buy' | 'sell';
@@ -764,6 +784,125 @@ interface StackedImbalance {
764
784
  /** Runs of minStack+ adjacent diagonal imbalances, tracked independently per side. */
765
785
  declare function stackedImbalances(cells: readonly FootprintCell[], ratio?: number, minStack?: number, rowSize?: number, threshold?: number): StackedImbalance[];
766
786
 
787
+ /**
788
+ * Aggressor classification for raw prints, for feeds that do not mark each trade
789
+ * as hitting the bid or lifting the ask. A footprint is only as honest as this
790
+ * step, so the rule is spelled out rather than guessed per call site.
791
+ */
792
+ /** A raw print. `bid` and `ask` are the quote at the time of the trade, when the feed has it. */
793
+ interface TradePrint {
794
+ price: number;
795
+ qty: number;
796
+ bid?: number;
797
+ ask?: number;
798
+ }
799
+ /**
800
+ * `'tickRule'` decides by the move from the previous print: up is a buy, down a
801
+ * sell, and an unchanged price keeps the previous side. `'quote'` first tests the
802
+ * recorded quote, a print at or above the ask being a buy and at or below the
803
+ * bid a sell, and falls back to the tick rule inside the spread or when the
804
+ * quote is missing or crossed.
805
+ */
806
+ type TradeClassification = 'tickRule' | 'quote';
807
+ /**
808
+ * A stateful classifier: feed prints in time order and it returns the side each
809
+ * one goes to, `'ask'` for buyer-initiated and `'bid'` for seller-initiated.
810
+ * The first print of a fresh classifier is a buy, because a move up from no
811
+ * previous price is the only reading the tick rule has. Make one classifier per
812
+ * instrument, and a new one when the tape restarts.
813
+ */
814
+ declare function createTradeClassifier(mode?: TradeClassification): (print: TradePrint) => 'bid' | 'ask';
815
+
816
+ /**
817
+ * Order flow signals read across footprint bars: multiple nodes, big limit
818
+ * orders, absorption, aggressive delta flips, price/delta divergence, zones that
819
+ * extend right until price deals with them, and unfinished auctions. Pure, so a
820
+ * host can drive alerts or a scanner from it without a chart.
821
+ */
822
+
823
+ /**
824
+ * When a zone stops extending: `'closeInside'` once a closed bar closes inside
825
+ * it or any bar trades right through it, `'traverse'` only when a bar trades
826
+ * through it, `'touch'` as soon as any bar trades into it.
827
+ */
828
+ type FootprintZoneEnd = 'closeInside' | 'traverse' | 'touch';
829
+ type FootprintZoneKind = 'stackedBuy' | 'stackedSell' | 'node' | 'absorption';
830
+ interface FootprintSignalOptions {
831
+ imbalanceRatio: number;
832
+ /** Minimum dominant-side quantity for a diagonal imbalance, raw units. */
833
+ imbalanceThreshold: number;
834
+ /** Adjacent same-side imbalances that form a stacked zone. 0 disables. */
835
+ stackedImbalances: number;
836
+ /** Consecutive bars whose highest-volume row sits at one price. 0 disables, otherwise at least 2. */
837
+ multipleNodeBars: number;
838
+ /** A big limit order is at least this many times the average cell. 0 disables. */
839
+ bigOrderMultiple: number;
840
+ /** Absorption needs bid and ask each at least this many times their average cell. 0 disables. */
841
+ absorptionMultiple: number;
842
+ /** Bars, the current one included, that the average cell is taken over. */
843
+ signalLookback: number;
844
+ /** How near the bar's high or low, in rows, a big order or absorption must be. */
845
+ nearExtremeRows: number;
846
+ /** Bars of opposite delta before an aggressive flip. 0 disables. */
847
+ flipBars: number;
848
+ /** Minimum |delta| of the flip bar, as a percentage of its volume. */
849
+ flipMinDeltaPct: number;
850
+ zoneEnd: FootprintZoneEnd;
851
+ /** Whole bars that must trade completely beyond a zone before it is active for alerts. */
852
+ zoneActiveAfter: number;
853
+ /**
854
+ * The newest bar is still forming: its close is not final, so it cannot end a
855
+ * zone by closing inside it, and its high and low are not final, so it gets no
856
+ * unfinished auction yet.
857
+ */
858
+ formingLastBar: boolean;
859
+ }
860
+ declare const DEFAULT_FOOTPRINT_SIGNAL_OPTIONS: FootprintSignalOptions;
861
+ interface FootprintZone {
862
+ kind: FootprintZoneKind;
863
+ /** Time of the bar the zone starts after. */
864
+ time: number;
865
+ /** Price span, from the outer edge of its lowest row to the outer edge of its highest. */
866
+ low: number;
867
+ high: number;
868
+ /** Time of the bar that ended it, or null while it still extends. */
869
+ endTime: number | null;
870
+ /** Time of the bar that made it active for alerts, or null. */
871
+ activeTime: number | null;
872
+ }
873
+ interface FootprintAuction {
874
+ /** Time of the bar whose extreme traded on both bid and ask. */
875
+ time: number;
876
+ side: 'high' | 'low';
877
+ price: number;
878
+ /** Time of the first later bar that traded beyond the price, or null. */
879
+ endTime: number | null;
880
+ }
881
+ interface FootprintBarSignals {
882
+ time: number;
883
+ /** Its highest-volume row matches a neighbour's: part of a multiple node. */
884
+ node: boolean;
885
+ /** Row price of a big limit order on the bid (near the low) or the ask (near the high). */
886
+ bigBid: number | null;
887
+ bigAsk: number | null;
888
+ /** Row price spans where heavy volume traded on both sides near an extreme. */
889
+ absorption: {
890
+ low: number;
891
+ high: number;
892
+ }[];
893
+ /** +1 aggressive buying flip, -1 aggressive selling flip, 0 none. */
894
+ flip: -1 | 0 | 1;
895
+ /** An up bar with negative delta or a down bar with positive delta. */
896
+ divergence: boolean;
897
+ }
898
+ interface FootprintSignals {
899
+ bars: FootprintBarSignals[];
900
+ zones: FootprintZone[];
901
+ auctions: FootprintAuction[];
902
+ }
903
+ /** Signals for `bars`, oldest first, using {@link DEFAULT_FOOTPRINT_SIGNAL_OPTIONS} for anything not given. */
904
+ declare function footprintSignals(bars: readonly FootprintBar[], options?: Partial<FootprintSignalOptions>): FootprintSignals;
905
+
767
906
  /**
768
907
  * Horizontal profile renderer (ARCHITECTURE.md §6A): volume-at-price / TPO-count
769
908
  * bars drawn sideways with POC + Value-Area lines. A pane primitive that
@@ -804,8 +943,13 @@ type FootprintTextColorMode = 'contrast' | 'side' | 'delta' | 'dominant' | 'imba
804
943
 
805
944
  /** Footprint columns, volume profiles and cluster ladders from classified trades. */
806
945
 
807
- type FootprintStatRow = 'volume' | 'bidVolume' | 'askVolume' | 'delta' | 'minDelta' | 'maxDelta' | 'deltaPct' | 'cvd' | 'trades';
808
- type FootprintDisplayMode = 'bidask' | 'delta' | 'volume';
946
+ type FootprintStatRow = 'volume' | 'bidVolume' | 'askVolume' | 'delta' | 'minDelta' | 'maxDelta' | 'deltaPct' | 'cvd' | 'trades' | 'cumVolume' | 'cvdRatio' | 'session';
947
+ /**
948
+ * `bidask` shades both sides by volume; `imbalance` leaves cells plain and fills
949
+ * only diagonal imbalances, shading the candle body's rows; `delta`, `deltaPct`,
950
+ * `volume` and `volumeDelta` print one value per row.
951
+ */
952
+ type FootprintDisplayMode = 'bidask' | 'imbalance' | 'delta' | 'deltaPct' | 'volume' | 'volumeDelta';
809
953
  type FootprintCellStyle = 'heatmap' | 'profile' | 'ladder';
810
954
 
811
955
  interface FootprintOptions {
@@ -821,8 +965,12 @@ interface FootprintOptions {
821
965
  displayMode: FootprintDisplayMode;
822
966
  /** Display quantities divided by this positive value; 1 shows raw units. Stats remain raw. */
823
967
  volumeDivisor: number;
968
+ /** Abbreviate quantities to three significant figures (12.3K). False prints whole numbers. Default true. */
969
+ compactNumbers: boolean;
824
970
  /** Intensity cells, volume-proportional bars, or square high-contrast cells. */
825
971
  cellStyle: FootprintCellStyle;
972
+ /** Shade against each bar's busiest row, or against the busiest row on screen so clusters stand out. */
973
+ intensityScope: 'bar' | 'visible';
826
974
  /** Text comparisons are independent of the cell background. */
827
975
  textColorMode: FootprintTextColorMode;
828
976
  textColor?: string;
@@ -830,7 +978,7 @@ interface FootprintOptions {
830
978
  sellTextColor?: string;
831
979
  imbalanceRatio: number;
832
980
  imbalanceThreshold: number;
833
- /** Adjacent same-side imbalance run length. 0 disables brackets. */
981
+ /** Adjacent same-side imbalance run length. 0 disables brackets and stacked zones. */
834
982
  stackedImbalances: number;
835
983
  statsRows: readonly FootprintStatRow[];
836
984
  /** Ordered rows for a separate table below the footprints. Empty disables it (default). */
@@ -842,6 +990,14 @@ interface FootprintOptions {
842
990
  statsPosition: 'bottom' | 'bar';
843
991
  /** Cumulative delta preceding the supplied bars, for a rolling window. */
844
992
  cvdOffset: number;
993
+ /** `'session'` restarts cumulative delta and cumulative volume at each session open. */
994
+ cvdReset: 'none' | 'session';
995
+ /** Session that letters and resets count from; omitted means local midnight. */
996
+ sessionWindow?: SessionWindow;
997
+ /** IANA zone for the session calendar; defaults to Asia/Kolkata. */
998
+ timezone?: string;
999
+ /** Length of one session-letter period in minutes. Default 30. */
1000
+ tpoMinutes: number;
845
1001
  /** Draw real OHLC if supplied; legacy bars show a neutral range line. */
846
1002
  showCandle: boolean;
847
1003
  showPoc: boolean;
@@ -850,6 +1006,48 @@ interface FootprintOptions {
850
1006
  /** Fraction of volume in the contiguous value area around the POC. */
851
1007
  valueAreaPercent: number;
852
1008
  valueAreaColor?: string;
1009
+ /** Highlight the POC when this many consecutive bars share it. 0 (default) disables. */
1010
+ multipleNodeBars: number;
1011
+ nodeColor: string;
1012
+ /** Outline a big limit order of at least this many average cells. 0 (default) disables. */
1013
+ bigOrderMultiple: number;
1014
+ bigOrderColor: string;
1015
+ /** Band rows where bid and ask both reach this many average cells. 0 (default) disables. */
1016
+ absorptionMultiple: number;
1017
+ absorptionColor: string;
1018
+ /** Bars the average cell is taken over. Default 10. */
1019
+ signalLookback: number;
1020
+ /** Rows from the high or low a big order or absorption must be within. Default 3. */
1021
+ nearExtremeRows: number;
1022
+ /** Mark an aggressive delta flip after this many opposite bars. 0 (default) disables. */
1023
+ flipBars: number;
1024
+ flipMinDeltaPct: number;
1025
+ /** Extend stacked imbalances, multiple nodes and absorption to the right as zones. Default false. */
1026
+ showZones: boolean;
1027
+ zoneEnd: FootprintZoneEnd;
1028
+ zoneActiveAfter: number;
1029
+ /** Dash-dot line at a high or low that traded on both bid and ask. Default false. */
1030
+ showUnfinishedAuctions: boolean;
1031
+ auctionHighColor?: string;
1032
+ auctionLowColor?: string;
1033
+ /** Bar delta printed under each column. Default false. */
1034
+ showDeltaLabels: boolean;
1035
+ /** Box the delta label when it disagrees with the bar's direction. Default false. */
1036
+ markDivergence: boolean;
1037
+ divergenceColor: string;
1038
+ /** Volume at price of the visible bars against the left edge. Default false. */
1039
+ showVisibleProfile: boolean;
1040
+ profileWidth: number;
1041
+ /**
1042
+ * Draw a 0 x 0 row at every row step a bar's trades skipped, so each column
1043
+ * spans its whole range. Display only: imbalances, the POC, value area and
1044
+ * signals still read the traded rows. Default true.
1045
+ */
1046
+ showEmptyRows: boolean;
1047
+ /** Fill the newest bar's last-price row with this colour. Omitted draws nothing. */
1048
+ lastPriceColor?: string;
1049
+ /** The newest bar is still forming, so it cannot close a zone or set an unfinished auction. Default true. */
1050
+ formingLastBar: boolean;
853
1051
  buyColor?: string;
854
1052
  sellColor?: string;
855
1053
  pocColor: string;
@@ -867,6 +1065,12 @@ interface FootprintBarStats {
867
1065
  maxDelta: number | null;
868
1066
  deltaPct: number;
869
1067
  cvd: number;
1068
+ /** Cumulative volume over the loaded bars, restarting with `cvdReset: 'session'`. */
1069
+ cumVolume: number;
1070
+ /** Cumulative delta divided by cumulative volume; 0 before any volume. */
1071
+ cvdRatio: number;
1072
+ /** Session letter of the period the bar opens in: A for the first `tpoMinutes`, and so on. */
1073
+ session: string;
870
1074
  /** Null when a legacy input does not include an actual trade count. */
871
1075
  trades: number | null;
872
1076
  poc: number;
@@ -887,6 +1091,7 @@ declare class Footprint implements IPrimitive {
887
1091
  private _opts;
888
1092
  private _host;
889
1093
  private _stats;
1094
+ private _signals;
890
1095
  /** Only visible painted rows/cards are interactive, in media pixels. */
891
1096
  private _cols;
892
1097
  private _rc;
@@ -896,10 +1101,17 @@ declare class Footprint implements IPrimitive {
896
1101
  detached(): void;
897
1102
  zOrder(): ZOrder;
898
1103
  private _validateOptions;
1104
+ private _signalOptions;
899
1105
  setBars(bars: readonly FootprintBar[]): void;
900
1106
  setOptions(patch: Partial<FootprintOptions>): void;
901
1107
  options(): FootprintOptions;
902
1108
  stats(): readonly FootprintBarStats[];
1109
+ /**
1110
+ * Multiple nodes, big orders, absorption, flips, divergence, zones and
1111
+ * unfinished auctions for the loaded bars, under the current options. Zones
1112
+ * carry `activeTime` and `endTime`, so a host can raise its own alerts.
1113
+ */
1114
+ signals(): FootprintSignals;
903
1115
  private _step;
904
1116
  autoscaleInfo(): {
905
1117
  min: number;
@@ -908,8 +1120,28 @@ declare class Footprint implements IPrimitive {
908
1120
  private _recomputeStats;
909
1121
  /** Price boundaries, not a minimum pixel size: tiny rows must never overlap. */
910
1122
  private _bounds;
1123
+ /** Quantity text: compact by default, otherwise whole numbers with separators. */
1124
+ private _format;
1125
+ /** The value a cell is shaded by in a single-value mode, and the peak it is measured against. */
1126
+ private _cellMeasure;
1127
+ private _peak;
911
1128
  draw(ctx: CanvasRenderingContext2D, rc: PrimitiveRenderContext): void;
1129
+ /** Zones and unfinished auctions sit behind the columns. */
1130
+ private _drawAcross;
1131
+ /** Imbalance-mode fill: stronger as the ratio passes two and three times the threshold, full against zero. */
1132
+ private _imbalanceStrength;
912
1133
  private _drawColumn;
1134
+ /** Row prices of the drawn cells between the bar's open and close rows, inclusive. */
1135
+ private _bodyRows;
1136
+ /** The row price holding `price`: the nearest row, which on the row grid is the one whose span contains it. */
1137
+ private _rowOf;
1138
+ private _outlineBody;
1139
+ private _drawValueArea;
1140
+ private _drawBrackets;
1141
+ /** Lowest painted edge of a column: its bottom row or its candle's low. */
1142
+ private _columnBottom;
1143
+ /** Delta label and flip marker under (or, for a selling flip, over) the column. */
1144
+ private _drawUnder;
913
1145
  private _drawCandle;
914
1146
  private _cell;
915
1147
  private _drawCard;
@@ -963,12 +1195,17 @@ interface FootprintUpdate {
963
1195
  declare class FootprintAggregator {
964
1196
  private readonly _tf;
965
1197
  private readonly _tickSize;
1198
+ private readonly _rowTicks;
1199
+ private readonly _rowSize;
1200
+ private readonly _minSize;
966
1201
  private _time;
967
1202
  private _cells;
1203
+ private _ticks;
968
1204
  private _delta;
969
1205
  private _minDelta;
970
1206
  private _maxDelta;
971
1207
  private _count;
1208
+ private _prints;
972
1209
  private _volume;
973
1210
  private _open;
974
1211
  private _lastTickTime;
@@ -981,19 +1218,24 @@ declare class FootprintAggregator {
981
1218
  * the market profile uses, so an instrument's real tick stays honest while the
982
1219
  * ladder stays readable. Nifty at 0.1 with 2-point bricks is `(tf, 0.1, 20)`.
983
1220
  */
984
- constructor(tf: TickTimeframe, tickSize: number, rowTicks?: number);
1221
+ constructor(tf: TickTimeframe, tickSize: number, rowTicks?: number, options?: FootprintBuildOptions);
985
1222
  private _snapshot;
986
1223
  current(): FootprintBar | null;
1224
+ /**
1225
+ * An interval bar covers [start, start + seconds): a tick stamped exactly on a
1226
+ * boundary opens the next bar, never the one that just ended.
1227
+ */
987
1228
  private _intervalKey;
988
1229
  /**
989
1230
  * Ticks must arrive in timestamp order (equal timestamps are accepted).
990
1231
  * Count/volume bars coalesce trades sharing their opening timestamp until
991
1232
  * time advances, so chart time keys remain unique. Such bars may exceed the
992
- * requested count/volume; volume trades are never split between bars.
1233
+ * requested count/volume; volume trades are never split between bars. Count and
1234
+ * volume bars close on every print, filtered or not.
993
1235
  */
994
1236
  onTick(tick: FootprintTick): FootprintUpdate;
995
1237
  }
996
1238
 
997
1239
  declare const PROFILE_TIER: "profile";
998
1240
 
999
- export { type ClassifiedTrade, DEFAULT_FOOTPRINT_OPTIONS, DEFAULT_MARKET_PROFILE_OPTIONS, DEFAULT_MARKET_PROFILE_PRIMITIVE_OPTIONS, DEFAULT_VOLUME_PROFILE_FAMILY_OPTIONS, DEFAULT_VOLUME_PROFILE_PRIMITIVE_OPTIONS, type DayType, type DevelopingValue, Footprint, FootprintAggregator, type FootprintBar, type FootprintBarStats, type FootprintCell, type FootprintCellStyle, type FootprintDisplayMode, type FootprintHover, type FootprintOptions, type FootprintStatRow, type FootprintTextColorMode, type FootprintTick, type FootprintUpdate, HorizontalProfile, type HorizontalProfileOptions, type Imbalance, MarketProfile, type MarketProfileHover, type MarketProfileLevel, type MarketProfileOptions, type MarketProfilePeriod, type MarketProfilePrimitiveOptions, type MarketProfileResult, type MarketProfileSession, type MarketProfileSessionResult, type MpBlockDisplay, type MpColorMode, type OpenType, PROFILE_TIER, type ProfileLevel, type SessionWindow, type StackedImbalance, TPO_PERIOD_COLORS, TRADING_HOURS, type TpoResult, type VolumeDisplayMode, VolumeProfile, type VolumeProfileFamilyOptions, type VolumeProfileFamilyResult, type VolumeProfileLevel, type VolumeProfileOptions, type VolumeProfilePrimitiveOptions, type VolumeProfileResult, type VolumeProfileSession, type VolumeProfileSessionResult, type VolumeProfileSide, bucketPrice, compactVol, computeFootprint, computeMarketProfile, computeTpo, computeVolumeProfile, computeVolumeProfileSessions, cumulativeDelta, diagonalImbalances, inWindow, nakedLevels, priceBuckets, rowOf, rowTicksFor, stackedImbalances, tpoLetter };
1241
+ export { type ClassifiedTrade, DEFAULT_FOOTPRINT_OPTIONS, DEFAULT_FOOTPRINT_SIGNAL_OPTIONS, DEFAULT_MARKET_PROFILE_OPTIONS, DEFAULT_MARKET_PROFILE_PRIMITIVE_OPTIONS, DEFAULT_VOLUME_PROFILE_FAMILY_OPTIONS, DEFAULT_VOLUME_PROFILE_PRIMITIVE_OPTIONS, type DayType, type DevelopingValue, Footprint, FootprintAggregator, type FootprintAuction, type FootprintBar, type FootprintBarSignals, type FootprintBarStats, type FootprintBuildOptions, type FootprintCell, type FootprintCellStyle, type FootprintDisplayMode, type FootprintHover, type FootprintOptions, type FootprintSignalOptions, type FootprintSignals, type FootprintStatRow, type FootprintTextColorMode, type FootprintTick, type FootprintUpdate, type FootprintZone, type FootprintZoneEnd, type FootprintZoneKind, HorizontalProfile, type HorizontalProfileOptions, type Imbalance, MarketProfile, type MarketProfileHover, type MarketProfileLevel, type MarketProfileOptions, type MarketProfilePeriod, type MarketProfilePrimitiveOptions, type MarketProfileResult, type MarketProfileSession, type MarketProfileSessionResult, type MpBlockDisplay, type MpColorMode, type OpenType, PROFILE_TIER, type ProfileLevel, type SessionWindow, type StackedImbalance, TPO_PERIOD_COLORS, TRADING_HOURS, type TpoResult, type TradeClassification, type TradePrint, type VolumeDisplayMode, VolumeProfile, type VolumeProfileFamilyOptions, type VolumeProfileFamilyResult, type VolumeProfileLevel, type VolumeProfileOptions, type VolumeProfilePrimitiveOptions, type VolumeProfileResult, type VolumeProfileSession, type VolumeProfileSessionResult, type VolumeProfileSide, bucketPrice, compactVol, computeFootprint, computeMarketProfile, computeTpo, computeVolumeProfile, computeVolumeProfileSessions, createTradeClassifier, cumulativeDelta, diagonalImbalances, footprintSignals, inWindow, nakedLevels, priceBuckets, rowOf, rowTicksFor, stackedImbalances, tpoLetter };
@@ -111,65 +111,6 @@ declare class HeikinAshiTransform implements ISeriesTransform {
111
111
  push(bar: Bar): Bar[];
112
112
  }
113
113
 
114
- /**
115
- * Renko bricks (ARCHITECTURE.md §6A). Each fixed box-size move of the close
116
- * emits one brick. Renders with the candlestick renderer (brick = a body).
117
- * Simplified single-box step (no 2× reversal rule): deterministic and
118
- * incremental for live updates.
119
- */
120
-
121
- interface RenkoOptions {
122
- /** Brick height in price. The constructor throws unless it is above 0. */
123
- boxSize: number;
124
- }
125
- declare class RenkoTransform implements ISeriesTransform {
126
- private readonly _box;
127
- private _edge;
128
- constructor(options: RenkoOptions);
129
- reset(): void;
130
- clone(): RenkoTransform;
131
- push(bar: Bar): Bar[];
132
- }
133
-
134
- /**
135
- * Range bars (ARCHITECTURE.md §6A). A new bar completes when its high−low
136
- * reaches the configured range. Built from the close sequence; renders with the
137
- * candlestick renderer. Incremental: the in-progress bar is emitted by flush().
138
- */
139
-
140
- interface RangeOptions {
141
- /** High-to-low span that closes a bar. The constructor throws unless it is above 0. */
142
- range: number;
143
- }
144
- declare class RangeBarsTransform implements ISeriesTransform {
145
- private readonly _range;
146
- private _cur;
147
- constructor(options: RangeOptions);
148
- reset(): void;
149
- clone(): RangeBarsTransform;
150
- push(bar: Bar): Bar[];
151
- flush(): Bar[];
152
- }
153
-
154
- /**
155
- * Line Break (ARCHITECTURE.md §6A). A new line forms only when the close breaks
156
- * beyond the extreme of the prior N lines (default 3). Renders with the
157
- * candlestick renderer (each line = a body). Incremental.
158
- */
159
-
160
- interface LineBreakOptions {
161
- /** Prior lines a close must break to draw a new one. Below 1 counts as 1. */
162
- lines: number;
163
- }
164
- declare class LineBreakTransform implements ISeriesTransform {
165
- private readonly _n;
166
- private _lines;
167
- constructor(options?: LineBreakOptions);
168
- reset(): void;
169
- clone(): LineBreakTransform;
170
- push(bar: Bar): Bar[];
171
- }
172
-
173
114
  /**
174
115
  * Point & Figure (ARCHITECTURE.md §6A). Columns of X (up) / O (down); a new
175
116
  * column starts only after a reversal of `reversal` boxes.
@@ -184,6 +125,7 @@ declare class LineBreakTransform implements ISeriesTransform {
184
125
  * - `'fixed'`: a constant `boxSize` (the classic).
185
126
  * - `'percent'`: `price × percent / 100`, re-resolved when each column opens.
186
127
  * - `'atr'`: `ATR(period) × multiplier` (Wilder), re-resolved per column.
128
+ * - `'atrPercent'`: `ATR(period) × percent / 100`, a box that is a share of the ATR.
187
129
  *
188
130
  * Each emitted column is a Bar spanning the column's price range, with up =
189
131
  * close ≥ open (X) and down = close < open (O). A column's `high` is the
@@ -194,7 +136,7 @@ declare class LineBreakTransform implements ISeriesTransform {
194
136
  */
195
137
 
196
138
  type PointFigureMethod = 'hl' | 'close';
197
- type PointFigureBoxMode = 'fixed' | 'percent' | 'atr';
139
+ type PointFigureBoxMode = 'fixed' | 'percent' | 'atr' | 'atrPercent';
198
140
  interface PointFigureOptions {
199
141
  /** Box size for `mode: 'fixed'`. Required unless another mode is chosen. */
200
142
  boxSize?: number | undefined;
@@ -204,9 +146,9 @@ interface PointFigureOptions {
204
146
  method?: PointFigureMethod | undefined;
205
147
  /** How the box size is resolved. Default `'fixed'`. */
206
148
  mode?: PointFigureBoxMode | undefined;
207
- /** Box as a percentage of price, for `mode: 'percent'` (e.g. `0.5` = 0.5%). */
149
+ /** Box as a percentage of price for `mode: 'percent'`, or of the ATR for `'atrPercent'` (e.g. `0.5` = 0.5%). */
208
150
  percent?: number | undefined;
209
- /** ATR lookback for `mode: 'atr'`. Default 14; floored, at least 1. */
151
+ /** ATR lookback for `mode: 'atr'` and `'atrPercent'`. Default 14; floored, at least 1. */
210
152
  atrPeriod?: number | undefined;
211
153
  /** ATR multiplier for `mode: 'atr'`. Default 1. */
212
154
  atrMultiplier?: number | undefined;
@@ -250,6 +192,100 @@ declare class PointFigureTransform implements ISeriesTransform {
250
192
  flush(): Bar[];
251
193
  }
252
194
 
195
+ /**
196
+ * Renko bricks (ARCHITECTURE.md §6A). Each box-size move emits one brick.
197
+ * Renders with the candlestick renderer (brick = a body). Simplified
198
+ * single-box step (no 2× reversal rule): deterministic and incremental for
199
+ * live updates.
200
+ *
201
+ * Brick sizing (`mode`), the same choices as point and figure:
202
+ * - `'fixed'` (default): a constant `boxSize`.
203
+ * - `'percent'`: `price × percent / 100`, re-resolved as each brick forms.
204
+ * - `'atr'`: `ATR(atrPeriod) × atrMultiplier` (Wilder), re-resolved as each
205
+ * brick forms.
206
+ * multiplier divided by 100.
207
+ * - `'atrPercent'`: `ATR(atrPeriod) × percent / 100`, a brick that is a share of the ATR.
208
+ *
209
+ * Prices (`method`): `'close'` (default) moves bricks on the close alone;
210
+ * `'hl'` walks the bar's low and high in the order the bar most likely traded
211
+ * them (low first on an up bar, high first on a down bar), so a long wick can
212
+ * form bricks the close never reaches.
213
+ */
214
+
215
+ interface RenkoOptions {
216
+ /** Brick height in price for `mode: 'fixed'`. The constructor throws unless it is above 0. */
217
+ boxSize?: number | undefined;
218
+ /** How the brick height is resolved. Default `'fixed'`. */
219
+ mode?: PointFigureBoxMode | undefined;
220
+ /** Brick as a percentage of price for `mode: 'percent'`, or of the ATR for `'atrPercent'`. */
221
+ percent?: number | undefined;
222
+ /** ATR lookback for `mode: 'atr'` and `'atrPercent'`. Default 14; floored, at least 1. */
223
+ atrPeriod?: number | undefined;
224
+ /** ATR multiplier for `mode: 'atr'`. Default 1. */
225
+ atrMultiplier?: number | undefined;
226
+ /** Which prices move the bricks. Default `'close'`. */
227
+ method?: 'close' | 'hl' | undefined;
228
+ }
229
+ declare class RenkoTransform implements ISeriesTransform {
230
+ private readonly _mode;
231
+ private readonly _fixed;
232
+ private readonly _percent;
233
+ private readonly _atrMult;
234
+ private readonly _method;
235
+ private readonly _atr;
236
+ private _box;
237
+ private _edge;
238
+ constructor(options: RenkoOptions);
239
+ reset(): void;
240
+ clone(): RenkoTransform;
241
+ /**
242
+ * Brick height for a brick starting at `price`. Falls back to the last valid
243
+ * height, then to 1% of price, then to 1, so a degenerate ATR or price never
244
+ * throws or forms a zero-height brick.
245
+ */
246
+ private _resolve;
247
+ push(bar: Bar): Bar[];
248
+ }
249
+
250
+ /**
251
+ * Range bars (ARCHITECTURE.md §6A). A new bar completes when its high−low
252
+ * reaches the configured range. Built from the close sequence; renders with the
253
+ * candlestick renderer. Incremental: the in-progress bar is emitted by flush().
254
+ */
255
+
256
+ interface RangeOptions {
257
+ /** High-to-low span that closes a bar. The constructor throws unless it is above 0. */
258
+ range: number;
259
+ }
260
+ declare class RangeBarsTransform implements ISeriesTransform {
261
+ private readonly _range;
262
+ private _cur;
263
+ constructor(options: RangeOptions);
264
+ reset(): void;
265
+ clone(): RangeBarsTransform;
266
+ push(bar: Bar): Bar[];
267
+ flush(): Bar[];
268
+ }
269
+
270
+ /**
271
+ * Line Break (ARCHITECTURE.md §6A). A new line forms only when the close breaks
272
+ * beyond the extreme of the prior N lines (default 3). Renders with the
273
+ * candlestick renderer (each line = a body). Incremental.
274
+ */
275
+
276
+ interface LineBreakOptions {
277
+ /** Prior lines a close must break to draw a new one. Below 1 counts as 1. */
278
+ lines: number;
279
+ }
280
+ declare class LineBreakTransform implements ISeriesTransform {
281
+ private readonly _n;
282
+ private _lines;
283
+ constructor(options?: LineBreakOptions);
284
+ reset(): void;
285
+ clone(): LineBreakTransform;
286
+ push(bar: Bar): Bar[];
287
+ }
288
+
253
289
  /**
254
290
  * Kagi (ARCHITECTURE.md §6A). A continuous line that reverses direction only
255
291
  * after a move of at least `reversal`. Turning points are emitted as vertices.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openalgo-charts",
3
- "version": "2.6.0",
3
+ "version": "2.6.2",
4
4
  "description": "From-scratch, dependency-free canvas charting engine for OpenAlgo: professional-grade interactive rendering, advanced on-chart trading, and a one-call widget tier that adds the toolbar, drawing rail, dialogs and shortcuts.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "marketcalls",