openalgo-charts 1.6.0 → 1.7.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/README.md +1 -1
- package/dist/index.d.ts +258 -21
- package/dist/indicators/index.d.ts +84 -1
- package/dist/openalgo-charts.indicators.mjs +1 -1
- package/dist/openalgo-charts.indicators.mjs.map +1 -1
- package/dist/openalgo-charts.mjs +1 -1
- package/dist/openalgo-charts.mjs.map +1 -1
- package/dist/openalgo-charts.standalone.js +1 -1
- package/dist/openalgo-charts.standalone.js.map +1 -1
- package/dist/profile/index.d.ts +6 -2
- package/dist/transform/index.d.ts +6 -2
- package/package.json +103 -103
package/README.md
CHANGED
|
@@ -269,7 +269,7 @@ npm run verify # typecheck + test + build + size
|
|
|
269
269
|
|
|
270
270
|
## Status & limitations
|
|
271
271
|
|
|
272
|
-
Version **1.
|
|
272
|
+
Version **1.7.1**. All engine build phases are implemented with 1953 unit tests across 106 files.
|
|
273
273
|
|
|
274
274
|
Known gaps, stated plainly:
|
|
275
275
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Library version string. Matches package.json (published npm release). */
|
|
2
|
-
declare const VERSION = "1.
|
|
2
|
+
declare const VERSION = "1.7.1";
|
|
3
3
|
/** Returns the current library version. */
|
|
4
4
|
declare function version(): string;
|
|
5
5
|
|
|
@@ -403,9 +403,13 @@ interface Bar {
|
|
|
403
403
|
close: number;
|
|
404
404
|
volume?: number;
|
|
405
405
|
/**
|
|
406
|
-
* Per-bar colour override
|
|
406
|
+
* Per-bar colour override, honoured by every Family-A renderer: candles and
|
|
407
|
+
* OHLC bars take it on body, border and wick together, histogram and column
|
|
408
|
+
* on the bar, and line, step, area and the HLC-area close line split their
|
|
409
|
+
* stroke into runs at the bars where it changes. Baseline is the exception,
|
|
410
|
+
* its stroke is already split by the above/below-base rule.
|
|
407
411
|
* A MACD histogram is four colours by momentum, and a conditional study is
|
|
408
|
-
* two
|
|
412
|
+
* two. Neither is expressible with one colour for the whole series.
|
|
409
413
|
*/
|
|
410
414
|
color?: string;
|
|
411
415
|
}
|
|
@@ -796,6 +800,10 @@ declare function drawShape(ctx: CanvasRenderingContext2D, shape: MarkerShape, cx
|
|
|
796
800
|
* A signal label: rounded plate, contrasting text, and a tail that points at
|
|
797
801
|
* `anchorY`. All coordinates are bitmap px — the caller has already applied dpr.
|
|
798
802
|
* `up` puts the tail on the top edge and the body below the anchor.
|
|
803
|
+
*
|
|
804
|
+
* `text` may carry `\n`: the plate widens to the longest row and grows
|
|
805
|
+
* downward-and-upward about its own centre, so it stays centred on `cx` and the
|
|
806
|
+
* tail keeps meeting the anchor price.
|
|
799
807
|
*/
|
|
800
808
|
declare function drawLabel(ctx: CanvasRenderingContext2D, up: boolean, cx: number, anchorY: number, text: string, color: string, fontPx: number): void;
|
|
801
809
|
declare class SeriesMarkers implements IPrimitive {
|
|
@@ -1403,6 +1411,8 @@ type IndicatorInput = {
|
|
|
1403
1411
|
default: IndicatorSource;
|
|
1404
1412
|
group?: string;
|
|
1405
1413
|
};
|
|
1414
|
+
/** Dash pattern for a level, a drawing, or a plot. */
|
|
1415
|
+
type IndicatorLineStyle = 'solid' | 'dashed' | 'dotted';
|
|
1406
1416
|
/** Line-style options, for a settings UI's Style tab. */
|
|
1407
1417
|
declare const INDICATOR_LINE_STYLES: readonly {
|
|
1408
1418
|
label: string;
|
|
@@ -1468,6 +1478,16 @@ interface IndicatorPlot {
|
|
|
1468
1478
|
style?: SeriesStyle;
|
|
1469
1479
|
/** Price axis for this plot. Defaults to 'right'. */
|
|
1470
1480
|
priceScaleId?: PriceScaleId;
|
|
1481
|
+
/**
|
|
1482
|
+
* Draw this one plot on the price pane even though the indicator owns a pane
|
|
1483
|
+
* of its own. An oscillator that also wants a signal
|
|
1484
|
+
* band or a stop line sitting on the candles is the case: the study belongs in
|
|
1485
|
+
* its own pane, one of its columns belongs on price, and splitting it into two
|
|
1486
|
+
* indicators would make the user configure the same inputs twice.
|
|
1487
|
+
*
|
|
1488
|
+
* Ignored for an `'onchart'` descriptor, which is already on the price pane.
|
|
1489
|
+
*/
|
|
1490
|
+
overlay?: boolean;
|
|
1471
1491
|
/**
|
|
1472
1492
|
* Settings key holding this plot's color, so a settings change restyles the
|
|
1473
1493
|
* series without a full rebuild.
|
|
@@ -1478,7 +1498,8 @@ interface IndicatorPlot {
|
|
|
1478
1498
|
* histogram is four colours by sign and direction, a conditional study two.
|
|
1479
1499
|
* Return `undefined` to fall back to the plot's own colour.
|
|
1480
1500
|
*
|
|
1481
|
-
*
|
|
1501
|
+
* Reaches the renderer as `Bar.color`, so every Family-A plot type honours
|
|
1502
|
+
* it: histogram, column, candles, OHLC bars, line, step and area.
|
|
1482
1503
|
*/
|
|
1483
1504
|
colorBy?(ctx: {
|
|
1484
1505
|
value: number;
|
|
@@ -1492,8 +1513,70 @@ interface IndicatorLevel {
|
|
|
1492
1513
|
price: number;
|
|
1493
1514
|
color?: string;
|
|
1494
1515
|
title?: string;
|
|
1516
|
+
/** Legacy two-state dash switch. `lineStyle` wins when both are given. */
|
|
1495
1517
|
dashed?: boolean;
|
|
1518
|
+
lineWidth?: number;
|
|
1519
|
+
lineStyle?: IndicatorLineStyle;
|
|
1496
1520
|
}
|
|
1521
|
+
/** One end of an indicator drawing: a time on the shared axis, a price on the pane's scale. */
|
|
1522
|
+
interface DrawAnchor {
|
|
1523
|
+
time: number;
|
|
1524
|
+
price: number;
|
|
1525
|
+
}
|
|
1526
|
+
/**
|
|
1527
|
+
* A free-standing shape an indicator paints in its own pane, anchored to time
|
|
1528
|
+
* and price rather than to a bar index.
|
|
1529
|
+
*
|
|
1530
|
+
* Plots, levels and markers each answer a different question and none of them
|
|
1531
|
+
* answers this one: a pivot-to-pivot trendline, a supply zone, an order block,
|
|
1532
|
+
* a measured-move projection are all geometry between two arbitrary points, and
|
|
1533
|
+
* a column of one value per bar cannot express any of them. Anchors are times,
|
|
1534
|
+
* so a shape stays put when history is paged in and every logical index shifts.
|
|
1535
|
+
*/
|
|
1536
|
+
type IndicatorDrawing = {
|
|
1537
|
+
kind: 'line';
|
|
1538
|
+
from: DrawAnchor;
|
|
1539
|
+
to: DrawAnchor;
|
|
1540
|
+
color?: string;
|
|
1541
|
+
lineWidth?: number;
|
|
1542
|
+
lineStyle?: IndicatorLineStyle;
|
|
1543
|
+
/** Continue the line past its anchor to the pane edge. */
|
|
1544
|
+
extendLeft?: boolean;
|
|
1545
|
+
extendRight?: boolean;
|
|
1546
|
+
} | {
|
|
1547
|
+
kind: 'box';
|
|
1548
|
+
from: DrawAnchor;
|
|
1549
|
+
to: DrawAnchor;
|
|
1550
|
+
/** Border colour. Omit `fillColor` to draw an outline only. */
|
|
1551
|
+
color?: string;
|
|
1552
|
+
fillColor?: string;
|
|
1553
|
+
/** Fill alpha, 0..1. Defaults to 0.12. */
|
|
1554
|
+
opacity?: number;
|
|
1555
|
+
lineWidth?: number;
|
|
1556
|
+
/** Caption drawn on a plate at the centre of the box; `\n` splits lines. */
|
|
1557
|
+
text?: string;
|
|
1558
|
+
textColor?: string;
|
|
1559
|
+
} | {
|
|
1560
|
+
kind: 'label';
|
|
1561
|
+
at: DrawAnchor;
|
|
1562
|
+
/** `\n` splits lines. */
|
|
1563
|
+
text: string;
|
|
1564
|
+
/** Plate fill. */
|
|
1565
|
+
color?: string;
|
|
1566
|
+
textColor?: string;
|
|
1567
|
+
/** Which edge of the plate sits on the anchor. Defaults to 'center'. */
|
|
1568
|
+
align?: 'left' | 'center' | 'right';
|
|
1569
|
+
} | {
|
|
1570
|
+
kind: 'polyline';
|
|
1571
|
+
points: readonly DrawAnchor[];
|
|
1572
|
+
color?: string;
|
|
1573
|
+
lineWidth?: number;
|
|
1574
|
+
/** Close the path back to the first point (a triangle, a wedge). */
|
|
1575
|
+
closed?: boolean;
|
|
1576
|
+
fillColor?: string;
|
|
1577
|
+
/** Fill alpha, 0..1. Defaults to 0.12. */
|
|
1578
|
+
opacity?: number;
|
|
1579
|
+
};
|
|
1497
1580
|
/** `calc` output: one array per plot key, aligned 1:1 with the input bars. */
|
|
1498
1581
|
type IndicatorValues = Record<string, readonly (number | null)[]>;
|
|
1499
1582
|
/** Per-instance scratch owned by the descriptor (Tier-2 data lands here). */
|
|
@@ -1508,7 +1591,52 @@ interface IndicatorAttachContext {
|
|
|
1508
1591
|
requestRecompute(): void;
|
|
1509
1592
|
/** Scratch this instance owns; the same object `calc` receives. */
|
|
1510
1593
|
store: IndicatorStore;
|
|
1511
|
-
|
|
1594
|
+
/**
|
|
1595
|
+
* The instrument the chart is showing, when the host knows it.
|
|
1596
|
+
*
|
|
1597
|
+
* The engine core has no instrument concept: it is handed bars, never a
|
|
1598
|
+
* symbol, so `chart.addIndicator` leaves this undefined rather than inventing
|
|
1599
|
+
* a name. A host that wraps the chart (a terminal that owns the symbol
|
|
1600
|
+
* picker) supplies it through its own `IndicatorHost`, which is how a Tier-2
|
|
1601
|
+
* indicator fetches the series matching what is on screen.
|
|
1602
|
+
*/
|
|
1603
|
+
symbol?(): string | undefined;
|
|
1604
|
+
/** The chart's timeframe (`'5m'`, `'1d'`), on the same terms as `symbol`. */
|
|
1605
|
+
interval?(): string | undefined;
|
|
1606
|
+
/** The chart's IANA zone, the one its axis is labelled in. */
|
|
1607
|
+
timezone?(): string;
|
|
1608
|
+
/** Chart wall clock in UTC seconds, the same clock the countdown row uses. */
|
|
1609
|
+
now?(): number;
|
|
1610
|
+
/** The pane this instance drew into. Moves when panes are reordered. */
|
|
1611
|
+
paneIndex?(): number;
|
|
1612
|
+
/** Attach a primitive to this indicator's pane, and detach it again. */
|
|
1613
|
+
addPrimitive?(p: IPrimitive): void;
|
|
1614
|
+
removePrimitive?(p: IPrimitive): void;
|
|
1615
|
+
}
|
|
1616
|
+
/**
|
|
1617
|
+
* What `levels` is handed. It carries `bars` and `values` **and** spreads the
|
|
1618
|
+
* settings keys onto itself, so the 91 built-ins written against the original
|
|
1619
|
+
* `levels(settings)` signature keep working unchanged: they read
|
|
1620
|
+
* `ctx.overbought` (or pass `ctx` to a `num(s, key, default)` helper) and find
|
|
1621
|
+
* exactly what they found before. A widened parameter is the only way a level
|
|
1622
|
+
* can be data-derived (yesterday's high, the session VWAP band), and that is a
|
|
1623
|
+
* whole class of level that could not be expressed at all before.
|
|
1624
|
+
*
|
|
1625
|
+
* The three data members are optional for the same backward-compatibility
|
|
1626
|
+
* reason, not because the runtime ever omits them: it always passes all three,
|
|
1627
|
+
* but a caller holding only a settings bag must still be able to invoke
|
|
1628
|
+
* `levels` directly. A descriptor that needs the data should default them
|
|
1629
|
+
* (`ctx.bars ?? []`).
|
|
1630
|
+
*
|
|
1631
|
+
* `settings`, `bars` and `values` are therefore reserved keys, the way
|
|
1632
|
+
* `timezone` already is in the settings a `calc` receives: an input declared
|
|
1633
|
+
* under one of those names is shadowed here.
|
|
1634
|
+
*/
|
|
1635
|
+
type IndicatorLevelContext = IndicatorSettings & {
|
|
1636
|
+
settings?: Readonly<IndicatorSettings>;
|
|
1637
|
+
bars?: readonly Bar[];
|
|
1638
|
+
values?: IndicatorValues;
|
|
1639
|
+
};
|
|
1512
1640
|
interface IndicatorDescriptor {
|
|
1513
1641
|
/** Registry key, e.g. `'macd'`. */
|
|
1514
1642
|
id: string;
|
|
@@ -1590,8 +1718,24 @@ interface IndicatorDescriptor {
|
|
|
1590
1718
|
rows: readonly (readonly TableCell[])[];
|
|
1591
1719
|
options?: Partial<ChartTableOptions>;
|
|
1592
1720
|
} | null;
|
|
1593
|
-
/**
|
|
1594
|
-
|
|
1721
|
+
/**
|
|
1722
|
+
* Optional free-standing shapes drawn in the indicator's pane: trendlines
|
|
1723
|
+
* between pivots, supply and demand boxes, projection labels. Runs after
|
|
1724
|
+
* every `calc`, like `markers` and `table`, and the returned list replaces the
|
|
1725
|
+
* previous one wholesale, so returning `[]` clears the layer.
|
|
1726
|
+
*/
|
|
1727
|
+
draws?(ctx: {
|
|
1728
|
+
bars: readonly Bar[];
|
|
1729
|
+
values: IndicatorValues;
|
|
1730
|
+
settings: Readonly<IndicatorSettings>;
|
|
1731
|
+
}): readonly IndicatorDrawing[];
|
|
1732
|
+
/**
|
|
1733
|
+
* Optional horizontal reference levels drawn in the indicator's pane.
|
|
1734
|
+
* Recomputed after every `calc`, so a level derived from the data (the
|
|
1735
|
+
* previous day's high) tracks it. See `IndicatorLevelContext` for why the
|
|
1736
|
+
* argument still reads as a settings bag.
|
|
1737
|
+
*/
|
|
1738
|
+
levels?(ctx: IndicatorLevelContext): readonly IndicatorLevel[];
|
|
1595
1739
|
/**
|
|
1596
1740
|
* Optional fixed price range for the indicator's own pane (RSI 0..100).
|
|
1597
1741
|
* Applied only when the indicator creates its pane — two indicators sharing a
|
|
@@ -1627,8 +1771,16 @@ declare function sourceValues(bars: readonly Bar[], source: IndicatorSource): nu
|
|
|
1627
1771
|
interface PriceLineOptions {
|
|
1628
1772
|
price: number;
|
|
1629
1773
|
color: string;
|
|
1630
|
-
|
|
1631
|
-
|
|
1774
|
+
/** Line thickness in media px. Default 1. */
|
|
1775
|
+
lineWidth?: number;
|
|
1776
|
+
/** Legacy two-state dash switch, equivalent to `lineStyle: 'dashed'`. */
|
|
1777
|
+
dashed?: boolean;
|
|
1778
|
+
/**
|
|
1779
|
+
* Dash style, the three-way form of `dashed`. Set, it wins over the boolean;
|
|
1780
|
+
* unset, the boolean still decides, so a line built before this existed draws
|
|
1781
|
+
* exactly as it did.
|
|
1782
|
+
*/
|
|
1783
|
+
lineStyle?: CanvasLineStyle;
|
|
1632
1784
|
/** Right-axis tag text. Defaults to the formatted price. */
|
|
1633
1785
|
label?: string;
|
|
1634
1786
|
/** Solid colored badge segment at the start of the pill group (e.g. 'BUY', 'TP', 'SL'). */
|
|
@@ -1871,17 +2023,22 @@ declare class PaneLegend implements IPrimitive {
|
|
|
1871
2023
|
}
|
|
1872
2024
|
|
|
1873
2025
|
/**
|
|
1874
|
-
*
|
|
1875
|
-
*
|
|
2026
|
+
* Vertical gradient across the band, graded between two prices rather than
|
|
2027
|
+
* two pixel rows.
|
|
1876
2028
|
*
|
|
1877
|
-
*
|
|
1878
|
-
*
|
|
1879
|
-
*
|
|
1880
|
-
*
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
*/
|
|
1884
|
-
|
|
2029
|
+
* The stops are anchored in PRICE, not in pixels, because that is what the
|
|
2030
|
+
* shading is claiming: a band graded from its 70 level down to its 30 means
|
|
2031
|
+
* those levels, and a viewport-relative gradient would slide off them the
|
|
2032
|
+
* moment the pane is panned or the scale re-fits.
|
|
2033
|
+
*/
|
|
2034
|
+
interface FillGradient {
|
|
2035
|
+
/** Price the top stop sits at. Omitted: the band's own highest value. */
|
|
2036
|
+
topValue?: number;
|
|
2037
|
+
/** Price the bottom stop sits at. Omitted: the band's own lowest value. */
|
|
2038
|
+
bottomValue?: number;
|
|
2039
|
+
topColor: string;
|
|
2040
|
+
bottomColor: string;
|
|
2041
|
+
}
|
|
1885
2042
|
interface IndicatorFillOptions {
|
|
1886
2043
|
/** Fill colour where the first series is above the second. */
|
|
1887
2044
|
colorUp: string;
|
|
@@ -1889,6 +2046,12 @@ interface IndicatorFillOptions {
|
|
|
1889
2046
|
colorDown: string;
|
|
1890
2047
|
/** 0..1. Defaults to 0.12 — a band must not drown the candles it sits behind. */
|
|
1891
2048
|
opacity?: number;
|
|
2049
|
+
/**
|
|
2050
|
+
* Set to grade the band instead of flat-filling it, in place of
|
|
2051
|
+
* `colorUp`/`colorDown`. A point carrying its own `color` still overrides it.
|
|
2052
|
+
* Unset leaves the two-colour fill exactly as it was.
|
|
2053
|
+
*/
|
|
2054
|
+
gradient?: FillGradient;
|
|
1892
2055
|
}
|
|
1893
2056
|
/** One bar's pair of values; `null` where either plot has no value yet. */
|
|
1894
2057
|
interface FillPoint {
|
|
@@ -1896,6 +2059,13 @@ interface FillPoint {
|
|
|
1896
2059
|
index: number;
|
|
1897
2060
|
a: number | null;
|
|
1898
2061
|
b: number | null;
|
|
2062
|
+
/**
|
|
2063
|
+
* Paints this bar onward in one colour, for a band shaded by something other
|
|
2064
|
+
* than which line leads: trend state, a regime, a third series. The run is
|
|
2065
|
+
* split at the bar where the colour changes, so it is per-bar and not merely
|
|
2066
|
+
* per-crossing. Most specific wins: this, then the gradient, then up/down.
|
|
2067
|
+
*/
|
|
2068
|
+
color?: string;
|
|
1899
2069
|
}
|
|
1900
2070
|
declare class IndicatorFill implements IPrimitive {
|
|
1901
2071
|
private _points;
|
|
@@ -1940,7 +2110,21 @@ interface IndicatorHost {
|
|
|
1940
2110
|
/** How many legends already sit on this pane, so rows stack. */
|
|
1941
2111
|
legendRowsOn(paneIndex: number): number;
|
|
1942
2112
|
addIndicatorSeries(type: string, paneIndex: number, style: Record<string, unknown> | undefined, priceScaleId: string | undefined): SeriesApi;
|
|
1943
|
-
|
|
2113
|
+
/**
|
|
2114
|
+
* Add a reference level. One options object rather than seven positional
|
|
2115
|
+
* arguments: the list grew a width and a dash style in 1.7.1, and a call site
|
|
2116
|
+
* of seven bare values is where the next one gets passed in the wrong slot.
|
|
2117
|
+
*/
|
|
2118
|
+
addIndicatorLevel(level: {
|
|
2119
|
+
price: number;
|
|
2120
|
+
color: string;
|
|
2121
|
+
/** Kept for hosts predating `lineStyle`; always `lineStyle === 'dashed'`. */
|
|
2122
|
+
dashed: boolean;
|
|
2123
|
+
lineWidth: number;
|
|
2124
|
+
lineStyle: IndicatorLineStyle;
|
|
2125
|
+
label: string;
|
|
2126
|
+
id: string;
|
|
2127
|
+
}, paneIndex: number): PriceLine;
|
|
1944
2128
|
removeIndicatorLevel(line: PriceLine): void;
|
|
1945
2129
|
/** Attach a band drawn behind the plots (an Ichimoku cloud). */
|
|
1946
2130
|
addIndicatorFill(fill: IndicatorFill, paneIndex: number): void;
|
|
@@ -1954,6 +2138,16 @@ interface IndicatorHost {
|
|
|
1954
2138
|
/** Attach a corner-pinned summary grid to a pane, and detach it again. */
|
|
1955
2139
|
addIndicatorTable(paneIndex: number): ChartTable;
|
|
1956
2140
|
removeIndicatorTable(table: ChartTable): void;
|
|
2141
|
+
/**
|
|
2142
|
+
* Attach an arbitrary primitive to a pane, and detach it again. Carries both
|
|
2143
|
+
* the descriptor's drawing layer and whatever a Tier-2 `attach` lifecycle
|
|
2144
|
+
* wants to paint, so those two do not need a host method each.
|
|
2145
|
+
*
|
|
2146
|
+
* Optional, like `timezone`, so a host predating it still satisfies this
|
|
2147
|
+
* interface: an indicator that draws simply draws nothing there.
|
|
2148
|
+
*/
|
|
2149
|
+
addIndicatorPrimitive?(primitive: IPrimitive, paneIndex: number): void;
|
|
2150
|
+
removeIndicatorPrimitive?(primitive: IPrimitive): void;
|
|
1957
2151
|
/** Bars of the primary price series — the calculation input. */
|
|
1958
2152
|
sourceBars(): readonly Bar[];
|
|
1959
2153
|
/** Index of a fresh pane for an indicator that wants its own. */
|
|
@@ -1967,6 +2161,16 @@ interface IndicatorHost {
|
|
|
1967
2161
|
* reaches the calculation. See `IndicatorInstance._descriptorSettings`.
|
|
1968
2162
|
*/
|
|
1969
2163
|
timezone?(): string;
|
|
2164
|
+
/**
|
|
2165
|
+
* The instrument and timeframe on screen, when the host knows them. The
|
|
2166
|
+
* engine core does not: it is handed bars and never a symbol, so `Chart`
|
|
2167
|
+
* leaves both out and a descriptor sees `undefined` rather than a guess. A
|
|
2168
|
+
* terminal that owns the symbol picker implements them here.
|
|
2169
|
+
*/
|
|
2170
|
+
symbol?(): string | undefined;
|
|
2171
|
+
interval?(): string | undefined;
|
|
2172
|
+
/** Chart wall clock in UTC seconds. Absent means the system clock. */
|
|
2173
|
+
now?(): number;
|
|
1970
2174
|
/** Pin a pane's price scale to a fixed range, or release it with `null`. */
|
|
1971
2175
|
setPaneRange(paneIndex: number, range: {
|
|
1972
2176
|
min: number;
|
|
@@ -4497,6 +4701,39 @@ declare class CandleBuilder {
|
|
|
4497
4701
|
private _volumeForSameBar;
|
|
4498
4702
|
}
|
|
4499
4703
|
|
|
4704
|
+
/**
|
|
4705
|
+
* Free-standing shapes an indicator paints in its pane (ARCHITECTURE.md §8):
|
|
4706
|
+
* lines, boxes, labels and polylines anchored to time and price.
|
|
4707
|
+
*
|
|
4708
|
+
* One primitive holds the whole list rather than one primitive per shape. A
|
|
4709
|
+
* descriptor rebuilds its shapes on every recompute, so per-shape primitives
|
|
4710
|
+
* would mean attaching and detaching a dozen objects on every live tick, and
|
|
4711
|
+
* the pane would re-sort its z-order for each of them.
|
|
4712
|
+
*
|
|
4713
|
+
* Anchors are **times**, never logical indices: paging history in at the left
|
|
4714
|
+
* edge shifts every index, and a trendline pinned to an index would slide off
|
|
4715
|
+
* its pivots the moment it did.
|
|
4716
|
+
*/
|
|
4717
|
+
|
|
4718
|
+
declare class IndicatorDrawings implements IPrimitive {
|
|
4719
|
+
private _items;
|
|
4720
|
+
private _host;
|
|
4721
|
+
private _visible;
|
|
4722
|
+
attached(host: PrimitiveHost): void;
|
|
4723
|
+
detached(): void;
|
|
4724
|
+
/** Over the series, under the crosshair: these are annotations on the data. */
|
|
4725
|
+
zOrder(): ZOrder;
|
|
4726
|
+
/**
|
|
4727
|
+
* A shape is drawn where the descriptor put it and never argues with the
|
|
4728
|
+
* scale. A projection reaching far above the data would otherwise squash the
|
|
4729
|
+
* study it annotates into a band a few pixels tall.
|
|
4730
|
+
*/
|
|
4731
|
+
autoscaleInfo(): null;
|
|
4732
|
+
setItems(items: readonly IndicatorDrawing[]): void;
|
|
4733
|
+
setVisible(on: boolean): void;
|
|
4734
|
+
draw(ctx: CanvasRenderingContext2D, rc: PrimitiveRenderContext): void;
|
|
4735
|
+
}
|
|
4736
|
+
|
|
4500
4737
|
/**
|
|
4501
4738
|
* Price-level family, built on the primitive API (ARCHITECTURE.md §8). A price
|
|
4502
4739
|
* level is a horizontal line at a meaningful price **and** a matching tag on the
|
|
@@ -6450,4 +6687,4 @@ declare function lerp(a: number, b: number, t: number): number;
|
|
|
6450
6687
|
*/
|
|
6451
6688
|
declare function roundToTick(value: number, step: number): number;
|
|
6452
6689
|
|
|
6453
|
-
export { ALT_PRESET, type AddSeriesOptions, type AggTick, type AxisChromeOptions, BUILTIN_COMMANDS, type Bar, BarCache, type BarCacheOptions, type BarCacheStats, type BarCacheStore, type BarUpdate, type BarsRequest, type Bucketing, BuySellButtons, type BuySellButtonsOptions, CHART_STATE_VERSION, type CachedBars, type CachedBarsRequest, type CalendarBucketing, type CalendarUnit, CandleBuilder, type CandleBuilderOptions, type CandleStyle, type CandleUpdate, type CanvasLineStyle, type CanvasOptions, Chart, type ChartEvent, type ChartEventOptions, type ChartOptions, type ChartSettingsState, type ChartSettingsTab, type ChartSettingsTabId, type ChartSettingsValue, type ChartSettingsValues, type ChartState, ChartTable, type ChartTableOptions, type ChartTheme, type ComparisonAlignment, type ComparisonChartHost, ComparisonController, type ComparisonControllerOptions, type ComparisonHandle, type ComparisonMode, type ComparisonOptions, type ComparisonPane, type ContextMenuEvent, type ContextMenuTarget, type ContextMenuTargetKind, type CrosshairMoveEvent, type CrosshairOptions, type CrosshairStyle, type CustomShortcut, DEFAULT_CANDLE_BUILDER_OPTIONS, DEFAULT_CANDLE_STYLE, DEFAULT_CHART_TABLE_OPTIONS, DEFAULT_HISTOGRAM_STYLE, DEFAULT_KEYMAP, DEFAULT_PRICE_SCALE_OPTIONS, DEFAULT_THEME, DEFAULT_TIMEZONE, DEFAULT_TIME_NAVIGATOR_OPTIONS, DEFAULT_TIME_SCALE_OPTIONS, DEFAULT_TRADING_COLORS, type DataFeed, DataLayer, type DecodedOrder, type DepthLevel, type DrawItem, EventMarkers, FakeDataFeed, type FeedScheduler, type FillPoint, type GridAxisStyle, type GridOptions, type GridStyle, type HistogramStyle, INDICATOR_LINE_STYLES, INDICATOR_PLOT_STYLES, INDICATOR_SOURCES, type IPrimitive, IST_OFFSET_SECONDS, type IndexedBar, type IndicatorApi, type IndicatorAttachContext, type IndicatorDescriptor, IndicatorFill, type IndicatorFillOptions, type IndicatorFillSpec, type IndicatorHost, type IndicatorInput, type IndicatorLevel, type IndicatorPlot, type IndicatorSettings, type IndicatorSource, type IndicatorState, type IndicatorStore, type IndicatorValues, type IntervalBucketing, type IntervalDescriptor, InvalidationLevel, type IstParts, type KeymapEntry, LINK_CROSSHAIR_ALPHA, type LateTickPolicy, type LegendField, type LegendStatusData, type LegendStatusLineOptions, type LegendStatusSource, type LegendTitleMode, type LegendValue, type LinePoint, type LinkChart, LinkCrosshair, type LinkDataLayer, LinkGroup, type LinkMemberOptions, type LinkMissingPolicy, type LinkOptions, type LogicalRange, LogoWatermark, type LogoWatermarkOptions, type LtpEvent, type MarkerPosition, type MarkerShape, type MarkerSize, type MarketDepth, type MarketPhase, type MarketPhaseFn, type MaybePromise, type ModeCheck, type OpenAlgoConfig, OpenAlgoDataFeed, type OpenAlgoLiveConfig, OpenAlgoLiveDataFeed, type OpenAlgoTradeConfig, OpenAlgoTradeFeed, type OpenAlgoWsConfig, OpenAlgoWsFeed, type OrderBookSnapshot, type OrderDecodeCode, type OrderDecodeIssue, type OrderDecodeResult, type OrderSide$1 as OrderSide, type OrderType$1 as OrderType, type OriginalTime, PRICE_LEVEL_KINDS, PRICE_SCALE_MODES, Pane, type PaneInvalidation, PaneLegend, type PaneLegendAction, type PaneLegendOptions, type PaneState, type PlaceOrder, type PlotMarginOptions, type PositionSide, type PriceAxisState, type PriceLevelInput, type PriceLevelKind, type PriceLevelQuote, type PriceLevelStyle, type PriceLevelValues, PriceLevels, type PriceLevelsOptions, PriceLine, type PriceLineOptions, type PriceRange, PriceScale, type PriceScaleId, type PriceScaleMode, type PriceScaleOptions, type PriceScaleState, type PrimitiveAnchor, type PrimitiveHit, type PrimitiveHost, type PrimitivePlacement, type PrimitiveRenderContext, type QuarantinedRow, type RawOrder, type RendererEntry, type ReplayChartHost, ReplayController, type ReplayOptions, type ReplayScheduler, type ReplayState, type ReplayViewport, type ResolvedLinkOptions, type RestoreReport, SCALE_FONT_MAX, SCALE_FONT_MIN, type ScaleCanvasOptions, type SeriesApi, type SeriesDataItem, type SeriesId, type SeriesMarker, SeriesMarkers, type SeriesRenderContext, type SeriesState, type SeriesStyle, type SeriesType, type ShortcutListItem, ShortcutManager, type ShortcutManagerOptions, type ShortcutPreset, type ShortcutScope, type ShortcutTriggerEvent, type Size, type SocketFactory, type SocketLike, type SupertrendPoint, type TableCell, type TablePosition, type Tick, TickBarAggregator, type TickBarOptions, type TickCountBucketing, type TickMarkType, type TickTimeframe, TimeNavigator, type TimeNavigatorAction, type TimeNavigatorOptions, TimeScale, type TimeScaleOp, type TimeScaleOptions, type TradeFeed, type TradeMarkerVariant, TradeMarkersPrimitive, type TradingColors, TradingController, type TradingHost, type TradingLineStyle, type TradingLineVariant, type TradingOrder, type TradingOrderSide, type TradingOrderType, type TradingPosition, type TradingSettings, type TradingSyncPayload, type TradingTrade, type UTCSeconds, UnknownIntervalError, type UnsubscribeFn, VERSION, type VolumeBucketing, type VolumeMode, type WatermarkPosition, type Whitespace, type WsClientWarning, type WsControlMessage, type WsMode, type WsState, type ZOrder, type ZonedParts, type ZonedPeriod, addComparison, alignToPrimary, applyChartSettings, atr, autoscaleRange, backoffDelayMs, barCacheKey, barCloseSec, bestHit, bitmapSize, bucketStartOf, calendarPeriodFlags, chartSettingsSchema, clamp, classifyAuthAck, compactVolume, comparisonController, computePriceLevels, conflateBars, conflateItems, conflationGroupSize, createChart, createLinkGroup, darkTheme, dashPattern, decodeOrder, drawLabel, drawShape, effectiveMarkerPx, ema, emaSeries, epochMsToUtcSeconds, eventToCombo, followerIndex, followerRange, formatCombo, formatIstCrosshairLabel, formatIstDate, formatIstTime, formatIstTimeSeconds, formatSubscribe, formatUnsubscribe, formatZonedCrosshairLabel, formatZonedDate, formatZonedTime, formatZonedTimeSeconds, generateBars, getChartType, getIndicator, hasIndicator, indicatorDefaults, indicatorStyleInputs, intervalToSeconds, isKnownInterval, isNewIstDay, isNewZonedDay, isNewZonedMonth, isNewZonedPeriod, isNewZonedQuarter, isNewZonedWeek, isNewZonedYear, isRebasing, isReservedCombo, isTimeBucketed, isValidCombo, isValidTimezone, isWhitespace, istStringToUtcSeconds, lastPriceLevelFromSeriesStyle, lerp, lightTheme, mapHistoryResponse, mapOrder, mapOrderStatus, mapPosition, markerSizePx, mergeBars, nextBucketStart, niceTicks, normalizeCombo, optimalBarWidth, parseCombo, parseMessage, parseTopic, plotStyleKeys, precisionForStep, readChartSettings, readSequence, registerChartType, registerIndicator, registerInterval, registeredChartTypes, registeredIndicators, registeredIntervals, resolveCrosshairStyle, resolveGridStyle, resolveInterval, resolvePlotMargins, resolveScaleStyle, roundToTick, rowTimeToUtcSeconds, rsi, rsiSeries, seriesStyleForLastPriceLevel, sessionStartFlags, sessionStartIndices, snapToDevicePixel, sourceValue, sourceValues, startOfZonedDay, startOfZonedMonth, startOfZonedWeek, supertrend, supertrendSeries, tableOrigin, toBar, trueRange, tryResolveInterval, unregisterInterval, utcSecondsToIstDateString, utcSecondsToIstParts, utcSecondsToZonedDateString, utcSecondsToZonedParts, version, verticalGradient, watermarkRect, withBarCache, zoneOffsetSeconds, zonedDayIndex, zonedStringToUtcSeconds, zonedWallClockToUtcSeconds, zonedWeekIndex };
|
|
6690
|
+
export { ALT_PRESET, type AddSeriesOptions, type AggTick, type AxisChromeOptions, BUILTIN_COMMANDS, type Bar, BarCache, type BarCacheOptions, type BarCacheStats, type BarCacheStore, type BarUpdate, type BarsRequest, type Bucketing, BuySellButtons, type BuySellButtonsOptions, CHART_STATE_VERSION, type CachedBars, type CachedBarsRequest, type CalendarBucketing, type CalendarUnit, CandleBuilder, type CandleBuilderOptions, type CandleStyle, type CandleUpdate, type CanvasLineStyle, type CanvasOptions, Chart, type ChartEvent, type ChartEventOptions, type ChartOptions, type ChartSettingsState, type ChartSettingsTab, type ChartSettingsTabId, type ChartSettingsValue, type ChartSettingsValues, type ChartState, ChartTable, type ChartTableOptions, type ChartTheme, type ComparisonAlignment, type ComparisonChartHost, ComparisonController, type ComparisonControllerOptions, type ComparisonHandle, type ComparisonMode, type ComparisonOptions, type ComparisonPane, type ContextMenuEvent, type ContextMenuTarget, type ContextMenuTargetKind, type CrosshairMoveEvent, type CrosshairOptions, type CrosshairStyle, type CustomShortcut, DEFAULT_CANDLE_BUILDER_OPTIONS, DEFAULT_CANDLE_STYLE, DEFAULT_CHART_TABLE_OPTIONS, DEFAULT_HISTOGRAM_STYLE, DEFAULT_KEYMAP, DEFAULT_PRICE_SCALE_OPTIONS, DEFAULT_THEME, DEFAULT_TIMEZONE, DEFAULT_TIME_NAVIGATOR_OPTIONS, DEFAULT_TIME_SCALE_OPTIONS, DEFAULT_TRADING_COLORS, type DataFeed, DataLayer, type DecodedOrder, type DepthLevel, type DrawAnchor, type DrawItem, EventMarkers, FakeDataFeed, type FeedScheduler, type FillGradient, type FillPoint, type GridAxisStyle, type GridOptions, type GridStyle, type HistogramStyle, INDICATOR_LINE_STYLES, INDICATOR_PLOT_STYLES, INDICATOR_SOURCES, type IPrimitive, IST_OFFSET_SECONDS, type IndexedBar, type IndicatorApi, type IndicatorAttachContext, type IndicatorDescriptor, type IndicatorDrawing, IndicatorDrawings, IndicatorFill, type IndicatorFillOptions, type IndicatorFillSpec, type IndicatorHost, type IndicatorInput, type IndicatorLevel, type IndicatorLevelContext, type IndicatorLineStyle, type IndicatorPlot, type IndicatorSettings, type IndicatorSource, type IndicatorState, type IndicatorStore, type IndicatorValues, type IntervalBucketing, type IntervalDescriptor, InvalidationLevel, type IstParts, type KeymapEntry, LINK_CROSSHAIR_ALPHA, type LateTickPolicy, type LegendField, type LegendStatusData, type LegendStatusLineOptions, type LegendStatusSource, type LegendTitleMode, type LegendValue, type LinePoint, type LinkChart, LinkCrosshair, type LinkDataLayer, LinkGroup, type LinkMemberOptions, type LinkMissingPolicy, type LinkOptions, type LogicalRange, LogoWatermark, type LogoWatermarkOptions, type LtpEvent, type MarkerPosition, type MarkerShape, type MarkerSize, type MarketDepth, type MarketPhase, type MarketPhaseFn, type MaybePromise, type ModeCheck, type OpenAlgoConfig, OpenAlgoDataFeed, type OpenAlgoLiveConfig, OpenAlgoLiveDataFeed, type OpenAlgoTradeConfig, OpenAlgoTradeFeed, type OpenAlgoWsConfig, OpenAlgoWsFeed, type OrderBookSnapshot, type OrderDecodeCode, type OrderDecodeIssue, type OrderDecodeResult, type OrderSide$1 as OrderSide, type OrderType$1 as OrderType, type OriginalTime, PRICE_LEVEL_KINDS, PRICE_SCALE_MODES, Pane, type PaneInvalidation, PaneLegend, type PaneLegendAction, type PaneLegendOptions, type PaneState, type PlaceOrder, type PlotMarginOptions, type PositionSide, type PriceAxisState, type PriceLevelInput, type PriceLevelKind, type PriceLevelQuote, type PriceLevelStyle, type PriceLevelValues, PriceLevels, type PriceLevelsOptions, PriceLine, type PriceLineOptions, type PriceRange, PriceScale, type PriceScaleId, type PriceScaleMode, type PriceScaleOptions, type PriceScaleState, type PrimitiveAnchor, type PrimitiveHit, type PrimitiveHost, type PrimitivePlacement, type PrimitiveRenderContext, type QuarantinedRow, type RawOrder, type RendererEntry, type ReplayChartHost, ReplayController, type ReplayOptions, type ReplayScheduler, type ReplayState, type ReplayViewport, type ResolvedLinkOptions, type RestoreReport, SCALE_FONT_MAX, SCALE_FONT_MIN, type ScaleCanvasOptions, type SeriesApi, type SeriesDataItem, type SeriesId, type SeriesMarker, SeriesMarkers, type SeriesRenderContext, type SeriesState, type SeriesStyle, type SeriesType, type ShortcutListItem, ShortcutManager, type ShortcutManagerOptions, type ShortcutPreset, type ShortcutScope, type ShortcutTriggerEvent, type Size, type SocketFactory, type SocketLike, type SupertrendPoint, type TableCell, type TablePosition, type Tick, TickBarAggregator, type TickBarOptions, type TickCountBucketing, type TickMarkType, type TickTimeframe, TimeNavigator, type TimeNavigatorAction, type TimeNavigatorOptions, TimeScale, type TimeScaleOp, type TimeScaleOptions, type TradeFeed, type TradeMarkerVariant, TradeMarkersPrimitive, type TradingColors, TradingController, type TradingHost, type TradingLineStyle, type TradingLineVariant, type TradingOrder, type TradingOrderSide, type TradingOrderType, type TradingPosition, type TradingSettings, type TradingSyncPayload, type TradingTrade, type UTCSeconds, UnknownIntervalError, type UnsubscribeFn, VERSION, type VolumeBucketing, type VolumeMode, type WatermarkPosition, type Whitespace, type WsClientWarning, type WsControlMessage, type WsMode, type WsState, type ZOrder, type ZonedParts, type ZonedPeriod, addComparison, alignToPrimary, applyChartSettings, atr, autoscaleRange, backoffDelayMs, barCacheKey, barCloseSec, bestHit, bitmapSize, bucketStartOf, calendarPeriodFlags, chartSettingsSchema, clamp, classifyAuthAck, compactVolume, comparisonController, computePriceLevels, conflateBars, conflateItems, conflationGroupSize, createChart, createLinkGroup, darkTheme, dashPattern, decodeOrder, drawLabel, drawShape, effectiveMarkerPx, ema, emaSeries, epochMsToUtcSeconds, eventToCombo, followerIndex, followerRange, formatCombo, formatIstCrosshairLabel, formatIstDate, formatIstTime, formatIstTimeSeconds, formatSubscribe, formatUnsubscribe, formatZonedCrosshairLabel, formatZonedDate, formatZonedTime, formatZonedTimeSeconds, generateBars, getChartType, getIndicator, hasIndicator, indicatorDefaults, indicatorStyleInputs, intervalToSeconds, isKnownInterval, isNewIstDay, isNewZonedDay, isNewZonedMonth, isNewZonedPeriod, isNewZonedQuarter, isNewZonedWeek, isNewZonedYear, isRebasing, isReservedCombo, isTimeBucketed, isValidCombo, isValidTimezone, isWhitespace, istStringToUtcSeconds, lastPriceLevelFromSeriesStyle, lerp, lightTheme, mapHistoryResponse, mapOrder, mapOrderStatus, mapPosition, markerSizePx, mergeBars, nextBucketStart, niceTicks, normalizeCombo, optimalBarWidth, parseCombo, parseMessage, parseTopic, plotStyleKeys, precisionForStep, readChartSettings, readSequence, registerChartType, registerIndicator, registerInterval, registeredChartTypes, registeredIndicators, registeredIntervals, resolveCrosshairStyle, resolveGridStyle, resolveInterval, resolvePlotMargins, resolveScaleStyle, roundToTick, rowTimeToUtcSeconds, rsi, rsiSeries, seriesStyleForLastPriceLevel, sessionStartFlags, sessionStartIndices, snapToDevicePixel, sourceValue, sourceValues, startOfZonedDay, startOfZonedMonth, startOfZonedWeek, supertrend, supertrendSeries, tableOrigin, toBar, trueRange, tryResolveInterval, unregisterInterval, utcSecondsToIstDateString, utcSecondsToIstParts, utcSecondsToZonedDateString, utcSecondsToZonedParts, version, verticalGradient, watermarkRect, withBarCache, zoneOffsetSeconds, zonedDayIndex, zonedStringToUtcSeconds, zonedWallClockToUtcSeconds, zonedWeekIndex };
|
|
@@ -828,6 +828,89 @@ declare function highest(values: readonly number[], period: number): number[];
|
|
|
828
828
|
declare function lowest(values: readonly number[], period: number): number[];
|
|
829
829
|
/** NaN → null, so a warmup slot serialises as an explicit gap. */
|
|
830
830
|
declare function nulls(values: readonly number[]): (number | null)[];
|
|
831
|
+
/**
|
|
832
|
+
* the reference `ema`: seeded with the **SMA of the first `period` values**, NaN
|
|
833
|
+
* before that. The base bundle's `ema` seeds from `values[0]` and emits from
|
|
834
|
+
* index 0 instead, so the two disagree for roughly the first `period` bars and
|
|
835
|
+
* converge after. Anything reproducing a reference platform plot needs this one.
|
|
836
|
+
*/
|
|
837
|
+
declare function smaSeededEma(values: readonly number[], period: number): number[];
|
|
838
|
+
/** the reference `change(src, n)`: `src - src[n]`. NaN for the first `n` bars. */
|
|
839
|
+
declare function change(values: readonly number[], n?: number): number[];
|
|
840
|
+
/** the reference `roc`: `100 * (src - src[n]) / src[n]`. NaN for the first `n` bars. */
|
|
841
|
+
declare function roc(values: readonly number[], n: number): number[];
|
|
842
|
+
/**
|
|
843
|
+
* the reference `dev`: mean **absolute** deviation from the SMA over `period` — not
|
|
844
|
+
* a standard deviation. CCI's 0.015 constant is calibrated against this.
|
|
845
|
+
*/
|
|
846
|
+
declare function dev(values: readonly number[], period: number): number[];
|
|
847
|
+
/**
|
|
848
|
+
* the reference `percentrank`: the percentage of the **previous** `period` values
|
|
849
|
+
* that are less than or equal to the current one. The current bar is the
|
|
850
|
+
* subject of the comparison, not part of the window, so the first answer lands
|
|
851
|
+
* at index `period`.
|
|
852
|
+
*/
|
|
853
|
+
declare function percentRank(values: readonly number[], period: number): number[];
|
|
854
|
+
/** the reference `alma`: Gaussian-weighted MA, `offset` 0..1 and `sigma` > 0. */
|
|
855
|
+
declare function alma(values: readonly number[], period: number, offset: number, sigma: number): number[];
|
|
856
|
+
/** the reference `vwma`: `sma(src * volume, len) / sma(volume, len)`. */
|
|
857
|
+
declare function vwma(values: readonly number[], volumes: readonly number[], period: number): number[];
|
|
858
|
+
/**
|
|
859
|
+
* the reference `highestbars` / `lowestbars`: the **offset** to the extreme bar
|
|
860
|
+
* in the window, `0` for the current bar and `-(period - 1)` for the oldest.
|
|
861
|
+
* Aroon is built entirely out of these, and the sign convention is why.
|
|
862
|
+
*/
|
|
863
|
+
declare function highestBars(values: readonly number[], period: number): number[];
|
|
864
|
+
declare function lowestBars(values: readonly number[], period: number): number[];
|
|
865
|
+
/** the reference `sum`: rolling sum over `period` bars. NaN during warmup. */
|
|
866
|
+
declare function rollingSum(values: readonly number[], period: number): number[];
|
|
867
|
+
/** the reference `cum`: running total from the first bar. Non-finite terms count as 0. */
|
|
868
|
+
declare function cumulative(values: readonly number[]): number[];
|
|
869
|
+
/**
|
|
870
|
+
* the reference `linreg`: the least-squares regression line fitted over the last
|
|
871
|
+
* `period` values, evaluated `offset` bars back from its right-hand end.
|
|
872
|
+
*
|
|
873
|
+
* x runs 0 (oldest bar in the window) to period-1 (current bar), so the value
|
|
874
|
+
* at the current bar is `intercept + slope * (period - 1)`. A positive `offset`
|
|
875
|
+
* steps back down that line, which is how LSMA's offset input shifts the plot
|
|
876
|
+
* without recomputing the fit.
|
|
877
|
+
*/
|
|
878
|
+
declare function linreg(values: readonly number[], period: number, offset?: number): number[];
|
|
879
|
+
/** the reference `swma`: the fixed 4-bar symmetrically weighted average, 1/2/2/1 over 6. */
|
|
880
|
+
declare function swma(values: readonly number[]): number[];
|
|
881
|
+
/**
|
|
882
|
+
* the reference `stoch(source, high, low, length)`. Note the three series are
|
|
883
|
+
* independent: Stochastic RSI passes the RSI in for all three, which is why
|
|
884
|
+
* this cannot just take bars.
|
|
885
|
+
*/
|
|
886
|
+
declare function stoch(source: readonly number[], high: readonly number[], low: readonly number[], period: number): number[];
|
|
887
|
+
/**
|
|
888
|
+
* the reference `percentile_nearest_rank`. The nearest-rank method returns an
|
|
889
|
+
* actual member of the window rather than interpolating between two, so a
|
|
890
|
+
* 50th percentile over an even-length window is the upper of the two middles,
|
|
891
|
+
* not their mean. That difference is visible on Median's default length of 3.
|
|
892
|
+
*/
|
|
893
|
+
declare function percentileNearestRank(values: readonly number[], period: number, percentage: number): number[];
|
|
894
|
+
/** the reference `correlation`: Pearson correlation of two series over `period`. */
|
|
895
|
+
declare function correlation(a: readonly number[], b: readonly number[], period: number): number[];
|
|
896
|
+
/** the reference `cci`: `(src - sma) / (0.015 * dev)`, where `dev` is the mean absolute deviation. */
|
|
897
|
+
declare function cci(values: readonly number[], period: number): number[];
|
|
898
|
+
/**
|
|
899
|
+
* the reference `pivothigh` / `pivotlow`. A pivot is confirmed `right` bars
|
|
900
|
+
* after it happens, so the answer lands on the confirming bar and refers to the
|
|
901
|
+
* value `right` bars back. Comparisons are strict on both sides, so a tie is
|
|
902
|
+
* not a pivot.
|
|
903
|
+
*/
|
|
904
|
+
declare function pivotHigh(values: readonly number[], left: number, right: number): number[];
|
|
905
|
+
declare function pivotLow(values: readonly number[], left: number, right: number): number[];
|
|
906
|
+
/** the reference `barssince`: bars elapsed since `cond` was last true, NaN before the first. */
|
|
907
|
+
declare function barsSince(cond: readonly boolean[]): number[];
|
|
908
|
+
/**
|
|
909
|
+
* the reference `valuewhen(cond, source, occurrence)`: the value of `source` the
|
|
910
|
+
* n-th most recent time `cond` was true, counting the current bar. Occurrence 0
|
|
911
|
+
* is the latest.
|
|
912
|
+
*/
|
|
913
|
+
declare function valueWhen(cond: readonly boolean[], source: readonly number[], occurrence: number): number[];
|
|
831
914
|
|
|
832
915
|
/**
|
|
833
916
|
* Tier-2 contract — indicators whose data is **not** derived from the chart's
|
|
@@ -911,4 +994,4 @@ declare const BUILTIN_INDICATORS: readonly IndicatorDescriptor[];
|
|
|
911
994
|
*/
|
|
912
995
|
declare function registerBuiltinIndicators(): void;
|
|
913
996
|
|
|
914
|
-
export { ADAPTIVE_INDICATORS, ADL, ADX, ALLIGATOR, ALMA, ALPHATREND, AROON, AROON_OSCILLATOR, ATR, AVERAGE_DAILY_RANGE, AVERAGE_INDICATORS, AWESOME_OSCILLATOR, BALANCE_OF_POWER, BB_TREND, BOLLINGER, BOLLINGER_BANDWIDTH, BOLLINGER_PERCENT_B, BUILTIN_INDICATORS, CCI, CHAIKIN_MONEY_FLOW, CHAIKIN_OSCILLATOR, CHANDELIER_EXIT, CHANDE_KROLL_STOP, CHANDE_MOMENTUM, CHOPPINESS_INDEX, CHOP_ZONE, CONNORS_RSI, COPPOCK_CURVE, CPR, DEMA, DONCHIAN, DPO, EASE_OF_MOVEMENT, ELDER_FORCE_INDEX, EMA, ENVELOPE, FISHER_TRANSFORM, FLOW_INDICATORS, HALFTREND, HISTORICAL_VOLATILITY, HMA, ICHIMOKU, INDEX_INDICATORS, INDICATORS_TIER, KAMA, KELTNER_CHANNEL, KLINGER_OSCILLATOR, KNOW_SURE_THING, LSMA, MACD, MASS_INDEX, MA_CROSS, MA_RIBBON, MCGINLEY_DYNAMIC, MEDIAN, MFI, MOMENTUM, NVI, OBV, OSCILLATOR_INDICATORS, OVERLAY_INDICATORS, PARABOLIC_SAR, PPO, PVI, PVO, PVT, RANGE_ANALYSIS, RANGE_INDICATORS, RELATIVE_VIGOR_INDEX, RELATIVE_VOLATILITY_INDEX, ROC, RSI, RSI_DIVERGENCE, SEASONALITY, SEASONALITY_INDICATORS, SIGNAL_INDICATORS, SMA, SMI, SMI_ERGODIC_INDICATOR, SMI_ERGODIC_OSCILLATOR, SPECIAL_K, STOCHASTIC, STOCHASTIC_RSI, STRENGTH_INDICATORS, STUDY_INDICATORS, SUPERTREND, TEMA, TREND_STRENGTH_INDEX, TRIX, TSI, TWAP, type Tier2Context, type Tier2Descriptor, type Tier2Point, ULCER_INDEX, ULTIMATE_OSCILLATOR, VOLATILITY_INDICATORS, VOLATILITY_STOP, VOLUME, VORTEX, VWAP, VWMA, WAVETREND, WAVETREND_INDICATORS, WILLIAMS_FRACTALS, WILLIAMS_PERCENT_R, WILLIAMS_VIX_FIX, WMA, WOODIES_CCI, connorsStreak, createTier2Indicator, highest, lowest, nulls, registerBuiltinIndicators, rma, sma, stdev, wma };
|
|
997
|
+
export { ADAPTIVE_INDICATORS, ADL, ADX, ALLIGATOR, ALMA, ALPHATREND, AROON, AROON_OSCILLATOR, ATR, AVERAGE_DAILY_RANGE, AVERAGE_INDICATORS, AWESOME_OSCILLATOR, BALANCE_OF_POWER, BB_TREND, BOLLINGER, BOLLINGER_BANDWIDTH, BOLLINGER_PERCENT_B, BUILTIN_INDICATORS, CCI, CHAIKIN_MONEY_FLOW, CHAIKIN_OSCILLATOR, CHANDELIER_EXIT, CHANDE_KROLL_STOP, CHANDE_MOMENTUM, CHOPPINESS_INDEX, CHOP_ZONE, CONNORS_RSI, COPPOCK_CURVE, CPR, DEMA, DONCHIAN, DPO, EASE_OF_MOVEMENT, ELDER_FORCE_INDEX, EMA, ENVELOPE, FISHER_TRANSFORM, FLOW_INDICATORS, HALFTREND, HISTORICAL_VOLATILITY, HMA, ICHIMOKU, INDEX_INDICATORS, INDICATORS_TIER, KAMA, KELTNER_CHANNEL, KLINGER_OSCILLATOR, KNOW_SURE_THING, LSMA, MACD, MASS_INDEX, MA_CROSS, MA_RIBBON, MCGINLEY_DYNAMIC, MEDIAN, MFI, MOMENTUM, NVI, OBV, OSCILLATOR_INDICATORS, OVERLAY_INDICATORS, PARABOLIC_SAR, PPO, PVI, PVO, PVT, RANGE_ANALYSIS, RANGE_INDICATORS, RELATIVE_VIGOR_INDEX, RELATIVE_VOLATILITY_INDEX, ROC, RSI, RSI_DIVERGENCE, SEASONALITY, SEASONALITY_INDICATORS, SIGNAL_INDICATORS, SMA, SMI, SMI_ERGODIC_INDICATOR, SMI_ERGODIC_OSCILLATOR, SPECIAL_K, STOCHASTIC, STOCHASTIC_RSI, STRENGTH_INDICATORS, STUDY_INDICATORS, SUPERTREND, TEMA, TREND_STRENGTH_INDEX, TRIX, TSI, TWAP, type Tier2Context, type Tier2Descriptor, type Tier2Point, ULCER_INDEX, ULTIMATE_OSCILLATOR, VOLATILITY_INDICATORS, VOLATILITY_STOP, VOLUME, VORTEX, VWAP, VWMA, WAVETREND, WAVETREND_INDICATORS, WILLIAMS_FRACTALS, WILLIAMS_PERCENT_R, WILLIAMS_VIX_FIX, WMA, WOODIES_CCI, alma, barsSince, cci, change, connorsStreak, correlation, createTier2Indicator, cumulative, dev, highest, highestBars, linreg, lowest, lowestBars, nulls, percentRank, percentileNearestRank, pivotHigh, pivotLow, registerBuiltinIndicators, rma, roc, rollingSum, sma, smaSeededEma, stdev, stoch, swma, valueWhen, vwma, wma };
|