openalgo-charts 1.0.28 → 1.0.29
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 +29 -19
- package/dist/index.d.ts +50 -6
- package/dist/indicators/index.d.ts +22 -1
- package/dist/openalgo-charts.draw.mjs.map +1 -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/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
**A from-scratch, dependency-free HTML5-canvas charting engine for OpenAlgo.**
|
|
6
6
|
|
|
7
|
-
Professional interactive charts, indicators, drawing tools, order flow, and on-chart trading — six lazy-loaded tiers, zero runtime dependencies, ~
|
|
7
|
+
Professional interactive charts, indicators, drawing tools, order flow, and on-chart trading — six lazy-loaded tiers, zero runtime dependencies, ~37 KB Brotli for the base engine.
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/openalgo-charts)
|
|
10
10
|
[](./LICENSE)
|
|
11
|
-
[](#size-budget)
|
|
12
|
+
[](#develop)
|
|
13
13
|
[](#principles)
|
|
14
14
|
|
|
15
15
|
[**Documentation**](https://marketcalls.github.io/openalgo-charts/) · [**Live examples**](https://marketcalls.github.io/openalgo-charts/examples) · [**Getting started**](./docs/getting-started.md) · [**Architecture**](./ARCHITECTURE.md)
|
|
@@ -60,14 +60,14 @@ Import only what you use. Each tier is a separate bundle that registers into the
|
|
|
60
60
|
|
|
61
61
|
| Import | Contents | Brotli |
|
|
62
62
|
|---|---|---|
|
|
63
|
-
| `openalgo-charts` | Engine, 13 chart types, panes & scales, primitives, registries, chart state, trading overlay, OpenAlgo feeds |
|
|
64
|
-
| `openalgo-charts/indicators` |
|
|
65
|
-
| `openalgo-charts/draw` | 43 drawing tools + a headless drawing controller | 11.
|
|
63
|
+
| `openalgo-charts` | Engine, 13 chart types, panes & scales, primitives, registries, chart state, trading overlay, OpenAlgo feeds | 37.0 KB |
|
|
64
|
+
| `openalgo-charts/indicators` | 20 built-in indicators + the Tier-2 (external-data) contract | 6.1 KB |
|
|
65
|
+
| `openalgo-charts/draw` | 43 drawing tools + a headless drawing controller | 11.7 KB |
|
|
66
66
|
| `openalgo-charts/transform` | Heikin Ashi, Renko, Range bars, Line Break, Point & Figure, Kagi | 2.7 KB |
|
|
67
67
|
| `openalgo-charts/profile` | Volume Profile, Market Profile (TPO), Footprint, order flow | 10.1 KB |
|
|
68
68
|
| `openalgo-charts/trade` | Order / position / bracket tools + DOM ladder | 6.6 KB |
|
|
69
69
|
|
|
70
|
-
Everything together is **
|
|
70
|
+
Everything together is **74.2 KB Brotli**. Figures are the measured `size-limit` output; the trade tier is a delta over the base, which is why base + trade (43.6 KB) is less than their listed sum.
|
|
71
71
|
|
|
72
72
|
## What's built
|
|
73
73
|
|
|
@@ -84,7 +84,7 @@ const macd = chart.addIndicator('macd', { fastPeriod: 8 }); // gets its own pa
|
|
|
84
84
|
macd.setSettings({ 'macd:width': 2, 'macd:lineStyle': 'dashed' });
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
20 built-ins: SMA, EMA, WMA, VWAP, Bollinger Bands, Supertrend, HalfTrend, Parabolic SAR, Ichimoku Cloud, RSI, MACD, Stochastic, ADX/DMI, CCI, MFI, ATR, William VIX FIX, Volume, OBV, A/D.
|
|
88
88
|
|
|
89
89
|
The chart owns the whole lifecycle — series, pane placement, reference levels, fixed ranges (RSI 0..100), recompute on data change, teardown. Every plot gets colour, opacity, thickness, and line style for free, generated from the descriptor. Write your own with `registerIndicator`, or use the **Tier-2 contract** for indicators whose data isn't derived from OHLCV (open interest, CVD, any external feed).
|
|
90
90
|
|
|
@@ -122,13 +122,13 @@ Enforced in CI by [`size-limit`](./.size-limit.json) — nothing is excluded, be
|
|
|
122
122
|
|
|
123
123
|
| Bundle | Limit | Actual |
|
|
124
124
|
|---|---|---|
|
|
125
|
-
| Base engine |
|
|
126
|
-
| Base + trade |
|
|
127
|
-
| Indicators tier | 9 KB |
|
|
128
|
-
| Draw tier | 14 KB |
|
|
125
|
+
| Base engine | 40 KB | 37.01 KB |
|
|
126
|
+
| Base + trade | 47 KB | 43.59 KB |
|
|
127
|
+
| Indicators tier | 9 KB | 6.08 KB |
|
|
128
|
+
| Draw tier | 14 KB | 11.73 KB |
|
|
129
129
|
| Transform tier | 5 KB | 2.66 KB |
|
|
130
|
-
| Profile tier |
|
|
131
|
-
| **Everything** | **
|
|
130
|
+
| Profile tier | 11 KB | 10.12 KB |
|
|
131
|
+
| **Everything** | **90 KB** | **74.18 KB** |
|
|
132
132
|
|
|
133
133
|
## Documentation
|
|
134
134
|
|
|
@@ -143,6 +143,16 @@ npm run build # build the library (dist/) the live
|
|
|
143
143
|
cd website && npm install && npm run dev # http://localhost:3000/openalgo-charts
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
+
## Agent skills
|
|
147
|
+
|
|
148
|
+
Teach your AI coding assistant this library:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
npx skills add https://github.com/marketcalls/openalgo-charts
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Installs six skills from [`.github/skills/`](./.github/skills) - a reference hub with 18 deep-dive files covering the whole API surface and its foot-guns, plus task skills for scaffolding a chart, adding indicators, building a terminal, writing a plugin, and debugging. Works with Claude Code, Cursor, Codex, Copilot, Gemini CLI and the rest of the `skills` CLI's supported agents.
|
|
155
|
+
|
|
146
156
|
## Examples
|
|
147
157
|
|
|
148
158
|
Runnable demos in [`examples/`](./examples), including a full **yfinance terminal** ([`examples/yfinance`](./examples/yfinance)) with a full terminal shell: symbol search, interval pills, chart-type picker, indicator menu, a vertical drawing rail, a floating properties bar, generated indicator settings, and layout persistence.
|
|
@@ -158,7 +168,7 @@ cd examples/yfinance && pip install -r requirements.txt && python server.py
|
|
|
158
168
|
```bash
|
|
159
169
|
npm install # install dev toolchain
|
|
160
170
|
npm run typecheck # strict TypeScript check
|
|
161
|
-
npm test # unit tests (vitest) -
|
|
171
|
+
npm test # unit tests (vitest) - 620 across 50 files
|
|
162
172
|
npm run build # Rollup -> dist/ (minified ESM per tier + types)
|
|
163
173
|
npm run size # size-limit (Brotli) against the budget
|
|
164
174
|
npm run e2e # Playwright Chromium smoke tests
|
|
@@ -175,14 +185,14 @@ npm run verify # typecheck + test + build + size
|
|
|
175
185
|
|
|
176
186
|
## Status & limitations
|
|
177
187
|
|
|
178
|
-
Version **1.0.
|
|
188
|
+
Version **1.0.29**. All engine build phases are implemented with 620 unit tests across 50 files.
|
|
179
189
|
|
|
180
190
|
Known gaps, stated plainly:
|
|
181
191
|
|
|
182
|
-
-
|
|
183
|
-
- **Footprint
|
|
192
|
+
- **Footprint and order flow need trade-by-trade data classified bid/ask.** OpenAlgo does not store this by default, so it is live-session-only unless you add a tick recorder — `FootprintAggregator` is the live path. See [`ARCHITECTURE.md`](./ARCHITECTURE.md) §6A.
|
|
193
|
+
- **Only `Footprint` is theme-aware among the profile primitives.** `VolumeProfile`, `MarketProfile` and `HorizontalProfile` never read `rc.theme`; their defaults are dark-tuned, so a light theme needs explicit colours. `HorizontalProfile` also hardcodes its POC / value-area line colours and has no `setOptions`.
|
|
184
194
|
- The OpenAlgo **WS/trade adapter wire schemas** ship with injectable transports and offline tests, but the exact field names should be verified against your running OpenAlgo build.
|
|
185
|
-
- Price-scale **`percentage`** and **`indexed-to-100`** modes
|
|
195
|
+
- Price-scale **`percentage`** and **`indexed-to-100`** modes are not implemented. (Hidden overlay scales *are* — add a series with `priceScaleId: ''`.)
|
|
186
196
|
- An optional **DOM chrome package** (toolbar, dialogs, command palette, objects panel) is the next planned piece; today that UI lives in the examples.
|
|
187
197
|
|
|
188
198
|
See [`ARCHITECTURE.md`](./ARCHITECTURE.md) §13a for the full deferred list.
|
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.0.
|
|
2
|
+
declare const VERSION = "1.0.29";
|
|
3
3
|
/** Returns the current library version. */
|
|
4
4
|
declare function version(): string;
|
|
5
5
|
|
|
@@ -109,8 +109,10 @@ interface PriceRange {
|
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
* Price-scale mode. `linear` and `logarithmic` are full coordinate transforms;
|
|
112
|
-
* `percentage`/`indexed-to-100` (rebase to a baseline)
|
|
113
|
-
*
|
|
112
|
+
* `percentage`/`indexed-to-100` (rebase to a baseline) are not yet implemented
|
|
113
|
+
* (see the README known limitations). Overlay scales *are* supported — a series
|
|
114
|
+
* added with `priceScaleId: ''` gets a hidden scale with its own autoscale, see
|
|
115
|
+
* `Pane._scaleFor`.
|
|
114
116
|
*/
|
|
115
117
|
type PriceScaleMode = 'linear' | 'logarithmic';
|
|
116
118
|
interface PriceScaleOptions {
|
|
@@ -591,7 +593,13 @@ interface IPrimitive {
|
|
|
591
593
|
/** Pick the best hit across primitives: nearest distance, then z-order priority. */
|
|
592
594
|
declare function bestHit(hits: readonly (PrimitiveHit | null)[]): PrimitiveHit | null;
|
|
593
595
|
|
|
594
|
-
|
|
596
|
+
/**
|
|
597
|
+
* `labelUp` / `labelDown` are text plates with a tail, for named signals ("Buy",
|
|
598
|
+
* "Sell") rather than bare glyphs. The tail points *at* the anchor price and the
|
|
599
|
+
* body sits clear of it: `labelUp`'s tail points up so its body hangs below the
|
|
600
|
+
* anchor, `labelDown` is the mirror. Both require `text`.
|
|
601
|
+
*/
|
|
602
|
+
type MarkerShape = 'arrowUp' | 'arrowDown' | 'circle' | 'square' | 'triangleUp' | 'triangleDown' | 'diamond' | 'flag' | 'text' | 'labelUp' | 'labelDown';
|
|
595
603
|
type MarkerPosition = 'aboveBar' | 'belowBar' | 'inBar' | 'atPrice';
|
|
596
604
|
type MarkerSize = 'tiny' | 'small' | 'medium' | 'big';
|
|
597
605
|
interface SeriesMarker {
|
|
@@ -609,6 +617,12 @@ declare function markerSizePx(size: MarkerSize): number;
|
|
|
609
617
|
/** Effective glyph px, clamped so it never exceeds the current bar spacing. */
|
|
610
618
|
declare function effectiveMarkerPx(size: MarkerSize, barSpacing: number): number;
|
|
611
619
|
declare function drawShape(ctx: CanvasRenderingContext2D, shape: MarkerShape, cx: number, cy: number, px: number, color: string): void;
|
|
620
|
+
/**
|
|
621
|
+
* A signal label: rounded plate, contrasting text, and a tail that points at
|
|
622
|
+
* `anchorY`. All coordinates are bitmap px — the caller has already applied dpr.
|
|
623
|
+
* `up` puts the tail on the top edge and the body below the anchor.
|
|
624
|
+
*/
|
|
625
|
+
declare function drawLabel(ctx: CanvasRenderingContext2D, up: boolean, cx: number, anchorY: number, text: string, color: string, fontPx: number): void;
|
|
612
626
|
declare class SeriesMarkers implements IPrimitive {
|
|
613
627
|
private readonly _seriesId;
|
|
614
628
|
private _markers;
|
|
@@ -858,6 +872,16 @@ declare function plotStyleKeys(plot: IndicatorPlot): {
|
|
|
858
872
|
* an indicator that already ships colours keeps them.
|
|
859
873
|
*/
|
|
860
874
|
declare function indicatorStyleInputs(descriptor: IndicatorDescriptor): IndicatorInput[];
|
|
875
|
+
/**
|
|
876
|
+
* Chart types a plot can be re-rendered as. A moving average is a line by
|
|
877
|
+
* default, but the same column of numbers reads better as a histogram or an
|
|
878
|
+
* area depending on what you are looking for — and a descriptor cannot know
|
|
879
|
+
* which. Restricted to the types that make sense for a single value column.
|
|
880
|
+
*/
|
|
881
|
+
declare const INDICATOR_PLOT_STYLES: readonly {
|
|
882
|
+
label: string;
|
|
883
|
+
value: string;
|
|
884
|
+
}[];
|
|
861
885
|
/** Canonical option list for a `type: 'source'` input, for settings UIs. */
|
|
862
886
|
declare const INDICATOR_SOURCES: readonly {
|
|
863
887
|
label: string;
|
|
@@ -979,6 +1003,20 @@ interface IndicatorDescriptor {
|
|
|
979
1003
|
* indicator, so implement this for anything meant to run in a busy live pane.
|
|
980
1004
|
*/
|
|
981
1005
|
calcTail?(bars: readonly Bar[], settings: Readonly<IndicatorSettings>, fromIndex: number, previous: IndicatorValues, store: IndicatorStore): IndicatorValues | null;
|
|
1006
|
+
/**
|
|
1007
|
+
* Optional bar-anchored signal markers — a named "Buy"/"Sell" plate, an arrow
|
|
1008
|
+
* at a crossover. Runs after every `calc`, so it reads the values it just
|
|
1009
|
+
* produced rather than recomputing anything.
|
|
1010
|
+
*
|
|
1011
|
+
* A plot cannot express this: a plot is a column of prices drawn as a line or
|
|
1012
|
+
* histogram, whereas a signal is a discrete event with a label. Returning `[]`
|
|
1013
|
+
* (when a `showLabels`-style input is off, say) clears the layer.
|
|
1014
|
+
*/
|
|
1015
|
+
markers?(ctx: {
|
|
1016
|
+
bars: readonly Bar[];
|
|
1017
|
+
values: IndicatorValues;
|
|
1018
|
+
settings: Readonly<IndicatorSettings>;
|
|
1019
|
+
}): readonly SeriesMarker[];
|
|
982
1020
|
/** Optional horizontal reference levels drawn in the indicator's pane. */
|
|
983
1021
|
levels?(settings: Readonly<IndicatorSettings>): readonly IndicatorLevel[];
|
|
984
1022
|
/**
|
|
@@ -1243,6 +1281,12 @@ interface IndicatorHost {
|
|
|
1243
1281
|
/** Attach a band drawn behind the plots (an Ichimoku cloud). */
|
|
1244
1282
|
addIndicatorFill(fill: IndicatorFill, paneIndex: number): void;
|
|
1245
1283
|
removeIndicatorFill(fill: IndicatorFill): void;
|
|
1284
|
+
/**
|
|
1285
|
+
* Detach a signal-marker layer. There is no matching `add`: the layer comes
|
|
1286
|
+
* from `series.createMarkers()` on a plot's own series, so it already lands in
|
|
1287
|
+
* the right pane. Removing a series does not remove its primitives, hence this.
|
|
1288
|
+
*/
|
|
1289
|
+
removeIndicatorMarkers(markers: SeriesMarkers): void;
|
|
1246
1290
|
/** Bars of the primary price series — the calculation input. */
|
|
1247
1291
|
sourceBars(): readonly Bar[];
|
|
1248
1292
|
/** Index of a fresh pane for an indicator that wants its own. */
|
|
@@ -1760,7 +1804,7 @@ interface ChartOptions {
|
|
|
1760
1804
|
schedule: RafScheduler;
|
|
1761
1805
|
cancel?: RafCanceller;
|
|
1762
1806
|
};
|
|
1763
|
-
/** Full palette; pass `
|
|
1807
|
+
/** Full palette; pass `lightTheme` (the default), `darkTheme`, or a custom ChartTheme. */
|
|
1764
1808
|
theme?: ChartTheme;
|
|
1765
1809
|
priceAxisWidth?: number;
|
|
1766
1810
|
timeAxisHeight?: number;
|
|
@@ -3334,4 +3378,4 @@ declare function lerp(a: number, b: number, t: number): number;
|
|
|
3334
3378
|
*/
|
|
3335
3379
|
declare function roundToTick(value: number, step: number): number;
|
|
3336
3380
|
|
|
3337
|
-
export { ALT_PRESET, type AddSeriesOptions, type AggTick, BUILTIN_COMMANDS, type Bar, type BarUpdate, type BarsRequest, BuySellButtons, type BuySellButtonsOptions, CHART_STATE_VERSION, CandleBuilder, type CandleBuilderOptions, type CandleStyle, type CandleUpdate, Chart, type ChartEvent, type ChartOptions, type ChartState, type ChartTheme, type CrosshairMoveEvent, type CustomShortcut, DEFAULT_CANDLE_BUILDER_OPTIONS, DEFAULT_CANDLE_STYLE, DEFAULT_HISTOGRAM_STYLE, DEFAULT_KEYMAP, DEFAULT_PRICE_SCALE_OPTIONS, DEFAULT_THEME, DEFAULT_TIME_NAVIGATOR_OPTIONS, DEFAULT_TIME_SCALE_OPTIONS, DEFAULT_TRADING_COLORS, type DataFeed, DataLayer, type DepthLevel, type DrawItem, EventMarkers, FakeDataFeed, type FeedScheduler, type FillPoint, type HistogramStyle, INDICATOR_LINE_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, InvalidationLevel, type KeymapEntry, type LateTickPolicy, type LegendValue, type LinePoint, type LogicalRange, LogoWatermark, type LogoWatermarkOptions, type LtpEvent, type MarkerPosition, type MarkerShape, type MarkerSize, type MarketDepth, type OpenAlgoConfig, OpenAlgoDataFeed, type OpenAlgoLiveConfig, OpenAlgoLiveDataFeed, type OpenAlgoTradeConfig, OpenAlgoTradeFeed, type OpenAlgoWsConfig, OpenAlgoWsFeed, type OrderSide$1 as OrderSide, type OrderType$1 as OrderType, type OriginalTime, Pane, type PaneInvalidation, PaneLegend, type PaneLegendAction, type PaneLegendOptions, type PaneState, type PlaceOrder, type PositionSide, PriceLine, type PriceLineOptions, type PriceRange, PriceScale, type PriceScaleId, type PriceScaleMode, type PriceScaleOptions, type PriceScaleState, type PrimitiveHit, type PrimitiveHost, type PrimitiveRenderContext, type RendererEntry, type RestoreReport, 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 Tick, TickBarAggregator, 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, type UnsubscribeFn, VERSION, type VolumeMode, type WatermarkPosition, type Whitespace, type WsControlMessage, type WsMode, type WsState, type ZOrder, atr, autoscaleRange, bestHit, bitmapSize, clamp, compactVolume, conflateBars, conflateItems, conflationGroupSize, createChart, darkTheme, drawShape, effectiveMarkerPx, ema, emaSeries, epochMsToUtcSeconds, eventToCombo, formatCombo, formatIstDate, formatIstTime, formatIstTimeSeconds, formatSubscribe, formatUnsubscribe, generateBars, getChartType, getIndicator, hasIndicator, indicatorDefaults, indicatorStyleInputs, intervalToSeconds, isNewIstDay, isReservedCombo, isValidCombo, isWhitespace, istStringToUtcSeconds, lerp, lightTheme, mapHistoryResponse, mapOrder, mapPosition, markerSizePx, mergeBars, niceTicks, normalizeCombo, optimalBarWidth, parseCombo, parseMessage, plotStyleKeys, precisionForStep, registerChartType, registerIndicator, registeredChartTypes, registeredIndicators, roundToTick, rowTimeToUtcSeconds, rsi, rsiSeries, snapToDevicePixel, sourceValue, sourceValues, supertrend, supertrendSeries, toBar, trueRange, utcSecondsToIstDateString, utcSecondsToIstParts, version, verticalGradient, watermarkRect };
|
|
3381
|
+
export { ALT_PRESET, type AddSeriesOptions, type AggTick, BUILTIN_COMMANDS, type Bar, type BarUpdate, type BarsRequest, BuySellButtons, type BuySellButtonsOptions, CHART_STATE_VERSION, CandleBuilder, type CandleBuilderOptions, type CandleStyle, type CandleUpdate, Chart, type ChartEvent, type ChartOptions, type ChartState, type ChartTheme, type CrosshairMoveEvent, type CustomShortcut, DEFAULT_CANDLE_BUILDER_OPTIONS, DEFAULT_CANDLE_STYLE, DEFAULT_HISTOGRAM_STYLE, DEFAULT_KEYMAP, DEFAULT_PRICE_SCALE_OPTIONS, DEFAULT_THEME, DEFAULT_TIME_NAVIGATOR_OPTIONS, DEFAULT_TIME_SCALE_OPTIONS, DEFAULT_TRADING_COLORS, type DataFeed, DataLayer, type DepthLevel, type DrawItem, EventMarkers, FakeDataFeed, type FeedScheduler, type FillPoint, 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, InvalidationLevel, type KeymapEntry, type LateTickPolicy, type LegendValue, type LinePoint, type LogicalRange, LogoWatermark, type LogoWatermarkOptions, type LtpEvent, type MarkerPosition, type MarkerShape, type MarkerSize, type MarketDepth, type OpenAlgoConfig, OpenAlgoDataFeed, type OpenAlgoLiveConfig, OpenAlgoLiveDataFeed, type OpenAlgoTradeConfig, OpenAlgoTradeFeed, type OpenAlgoWsConfig, OpenAlgoWsFeed, type OrderSide$1 as OrderSide, type OrderType$1 as OrderType, type OriginalTime, Pane, type PaneInvalidation, PaneLegend, type PaneLegendAction, type PaneLegendOptions, type PaneState, type PlaceOrder, type PositionSide, PriceLine, type PriceLineOptions, type PriceRange, PriceScale, type PriceScaleId, type PriceScaleMode, type PriceScaleOptions, type PriceScaleState, type PrimitiveHit, type PrimitiveHost, type PrimitiveRenderContext, type RendererEntry, type RestoreReport, 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 Tick, TickBarAggregator, 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, type UnsubscribeFn, VERSION, type VolumeMode, type WatermarkPosition, type Whitespace, type WsControlMessage, type WsMode, type WsState, type ZOrder, atr, autoscaleRange, bestHit, bitmapSize, clamp, compactVolume, conflateBars, conflateItems, conflationGroupSize, createChart, darkTheme, drawLabel, drawShape, effectiveMarkerPx, ema, emaSeries, epochMsToUtcSeconds, eventToCombo, formatCombo, formatIstDate, formatIstTime, formatIstTimeSeconds, formatSubscribe, formatUnsubscribe, generateBars, getChartType, getIndicator, hasIndicator, indicatorDefaults, indicatorStyleInputs, intervalToSeconds, isNewIstDay, isReservedCombo, isValidCombo, isWhitespace, istStringToUtcSeconds, lerp, lightTheme, mapHistoryResponse, mapOrder, mapPosition, markerSizePx, mergeBars, niceTicks, normalizeCombo, optimalBarWidth, parseCombo, parseMessage, plotStyleKeys, precisionForStep, registerChartType, registerIndicator, registeredChartTypes, registeredIndicators, roundToTick, rowTimeToUtcSeconds, rsi, rsiSeries, snapToDevicePixel, sourceValue, sourceValues, supertrend, supertrendSeries, toBar, trueRange, utcSecondsToIstDateString, utcSecondsToIstParts, version, verticalGradient, watermarkRect };
|
|
@@ -8,6 +8,27 @@ declare const VWAP: IndicatorDescriptor;
|
|
|
8
8
|
declare const SUPERTREND: IndicatorDescriptor;
|
|
9
9
|
declare const PARABOLIC_SAR: IndicatorDescriptor;
|
|
10
10
|
declare const ICHIMOKU: IndicatorDescriptor;
|
|
11
|
+
/**
|
|
12
|
+
* HalfTrend — a trend-following level that only moves against the trend once
|
|
13
|
+
* the opposing side of the range genuinely gives way, so it holds flat through
|
|
14
|
+
* noise where a moving average would wobble.
|
|
15
|
+
*
|
|
16
|
+
* Two state machines run at once. `trend` is what is drawn; `nextTrend` is which
|
|
17
|
+
* flip is currently *armed*. While a down-flip is armed the indicator tracks the
|
|
18
|
+
* running maximum of the `amplitude`-bar low; the flip only fires when the mean
|
|
19
|
+
* high drops under that maximum **and** the bar closes below the previous bar's
|
|
20
|
+
* low. The up-flip is the mirror. Requiring both a mean crossing and a close
|
|
21
|
+
* beyond the prior bar's extreme is what keeps the level still.
|
|
22
|
+
*
|
|
23
|
+
* On a flip the new level starts from the level the other side ended on, which
|
|
24
|
+
* is why the line steps rather than jumping to price. `channelDeviation` half-ATR
|
|
25
|
+
* bands ride the level as a channel, and the flip bar is marked half an ATR
|
|
26
|
+
* inside the channel.
|
|
27
|
+
*
|
|
28
|
+
* Original implementation written from the algorithm's published behaviour, per
|
|
29
|
+
* ARCHITECTURE.md §0.1 — not ported from any third-party source.
|
|
30
|
+
*/
|
|
31
|
+
declare const HALFTREND: IndicatorDescriptor;
|
|
11
32
|
|
|
12
33
|
declare const RSI: IndicatorDescriptor;
|
|
13
34
|
declare const MACD: IndicatorDescriptor;
|
|
@@ -146,4 +167,4 @@ declare const BUILTIN_INDICATORS: readonly IndicatorDescriptor[];
|
|
|
146
167
|
*/
|
|
147
168
|
declare function registerBuiltinIndicators(): void;
|
|
148
169
|
|
|
149
|
-
export { ADL, ADX, ATR, BOLLINGER, BUILTIN_INDICATORS, CCI, EMA, ICHIMOKU, INDICATORS_TIER, MACD, MFI, OBV, PARABOLIC_SAR, RSI, SMA, STOCHASTIC, SUPERTREND, type Tier2Context, type Tier2Descriptor, type Tier2Point, VOLUME, VWAP, WILLIAMS_VIX_FIX, WMA, createTier2Indicator, highest, lowest, nulls, registerBuiltinIndicators, rma, sma, stdev, wma };
|
|
170
|
+
export { ADL, ADX, ATR, BOLLINGER, BUILTIN_INDICATORS, CCI, EMA, HALFTREND, ICHIMOKU, INDICATORS_TIER, MACD, MFI, OBV, PARABOLIC_SAR, RSI, SMA, STOCHASTIC, SUPERTREND, type Tier2Context, type Tier2Descriptor, type Tier2Point, VOLUME, VWAP, WILLIAMS_VIX_FIX, WMA, createTier2Indicator, highest, lowest, nulls, registerBuiltinIndicators, rma, sma, stdev, wma };
|