hyperprop-charting-library 0.1.20 → 0.1.22
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 +50 -0
- package/dist/hyperprop-charting-library.cjs +704 -12
- package/dist/hyperprop-charting-library.d.ts +50 -1
- package/dist/hyperprop-charting-library.js +704 -12
- package/dist/index.cjs +704 -12
- package/dist/index.d.cts +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +704 -12
- package/docs/API.md +63 -0
- package/docs/RECIPES.md +61 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,6 +76,55 @@ chart.onCrosshairPriceAction((event) => {
|
|
|
76
76
|
});
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
+
## Built-In Indicators
|
|
80
|
+
|
|
81
|
+
Built-ins are part of this package (no extra install):
|
|
82
|
+
|
|
83
|
+
- `volume`
|
|
84
|
+
- `sma`
|
|
85
|
+
- `ema`
|
|
86
|
+
- `rsi`
|
|
87
|
+
- `wma`
|
|
88
|
+
- `vwma`
|
|
89
|
+
- `rma`
|
|
90
|
+
- `hma`
|
|
91
|
+
- `stddev`
|
|
92
|
+
- `atr`
|
|
93
|
+
|
|
94
|
+
Quick usage:
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
const emaId = chart.addIndicator("ema", { length: 34, source: "close" });
|
|
98
|
+
const volumeId = chart.addIndicator("volume", { upOpacity: 0.72, downOpacity: 0.72 }, { paneHeightRatio: 0.16 });
|
|
99
|
+
|
|
100
|
+
// update any indicator instance
|
|
101
|
+
chart.updateIndicator(emaId, { inputs: { length: 55 } });
|
|
102
|
+
chart.updateIndicator(volumeId, { paneHeightRatio: 0.1 });
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Volume note:
|
|
106
|
+
|
|
107
|
+
- `volume` and `vwma` require `OhlcDataPoint.v` for best results.
|
|
108
|
+
|
|
109
|
+
## Custom Indicator Plugins
|
|
110
|
+
|
|
111
|
+
You can register your own indicators in-app:
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
chart.registerIndicator({
|
|
115
|
+
id: "my-line",
|
|
116
|
+
name: "My Line",
|
|
117
|
+
pane: "overlay",
|
|
118
|
+
defaultInputs: { color: "#22d3ee", width: 2 },
|
|
119
|
+
draw: (ctx, rc, inputs) => {
|
|
120
|
+
if (!rc.yFromPrice) return;
|
|
121
|
+
// draw using rc.xFromIndex(...) and rc.yFromPrice(...)
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const myId = chart.addIndicator("my-line");
|
|
126
|
+
```
|
|
127
|
+
|
|
79
128
|
## Full Documentation
|
|
80
129
|
|
|
81
130
|
- API reference: `docs/API.md`
|
|
@@ -92,6 +141,7 @@ chart.onCrosshairPriceAction((event) => {
|
|
|
92
141
|
- `chart.setOrderLines(lines)` / `chart.addOrderLine(line)` / `chart.updateOrderLine(id, patch)` / `chart.removeOrderLine(id)`
|
|
93
142
|
- `chart.onOrderAction(handler)` / `chart.onChartClick(handler)` / `chart.onCrosshairMove(handler)` / `chart.onCrosshairPriceAction(handler)`
|
|
94
143
|
- `chart.setDoubleClickEnabled(enabled)` / `chart.setDoubleClickAction(action)`
|
|
144
|
+
- `chart.registerIndicator(plugin)` / `chart.addIndicator(type, inputs?, options?)` / `chart.updateIndicator(id, patch)` / `chart.removeIndicator(id)`
|
|
95
145
|
- `chart.zoomInX()` / `chart.zoomOutX()` / `chart.panX(bars)` / `chart.resetViewport()`
|
|
96
146
|
- `chart.resize(width, height)` / `chart.destroy()`
|
|
97
147
|
|