acttrader-charts 1.0.15 → 1.0.16
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 +17 -6
- package/dist/{MACD-DVxcNurb.d.cts → MACD-ucey7UAq.d.cts} +19 -2
- package/dist/{MACD-DVxcNurb.d.ts → MACD-ucey7UAq.d.ts} +19 -2
- package/dist/index.cjs +273 -101
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -8
- package/dist/index.d.ts +20 -8
- package/dist/index.js +273 -101
- package/dist/index.js.map +1 -1
- package/dist/indicators/index.d.cts +2 -2
- package/dist/indicators/index.d.ts +2 -2
- package/dist/webview/chart.html +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -164,9 +164,11 @@ chart.setLevels([], 'label', 'price', 'pending'); // clear all of one type
|
|
|
164
164
|
|
|
165
165
|
```ts
|
|
166
166
|
// Confirmed drag of a pending order entry
|
|
167
|
-
chart.on('tradeLevelEdit', ({ label, type, changes, isFullscreen }) => {
|
|
167
|
+
chart.on('tradeLevelEdit', ({ label, type, data, changes, newLots, isFullscreen }) => {
|
|
168
168
|
for (const c of changes) {
|
|
169
|
-
|
|
169
|
+
// `c.newLots` is present on the MAIN change when qty was edited this session.
|
|
170
|
+
// `data.lots` is also overridden with the new qty for convenience.
|
|
171
|
+
if (c.field === 'MAIN') myApi.modifyOrder(label, { price: c.newPrice, qty: c.newLots ?? (data as any).lots });
|
|
170
172
|
if (c.field === 'SL') myApi.modifyOrder(label, { stopLoss: c.newPrice });
|
|
171
173
|
if (c.field === 'TP') myApi.modifyOrder(label, { takeProfit: c.newPrice });
|
|
172
174
|
}
|
|
@@ -224,6 +226,7 @@ When `enableTrading` is on and live BID/ASK data is streaming, hovering / activa
|
|
|
224
226
|
| `showVolume` | | `true` | Show volume overlay |
|
|
225
227
|
| `showUI` | | `true` | Render top / bottom / left bars. When `false`, the loading overlay is also suppressed (mobile wrappers provide their own) |
|
|
226
228
|
| `showDrawingTools` | | `true` | Show drawing toolbar and pencil button |
|
|
229
|
+
| `showFullscreenButton` | | `true` | Show the fullscreen toggle button in the top bar. Set to `false` to hide it entirely. Mobile wrappers (Android / iOS) default this to `false` |
|
|
227
230
|
| `timeframe` | | `"1D"` | Initial timeframe |
|
|
228
231
|
| `duration` | | — | Initial active duration button |
|
|
229
232
|
| `symbol` | | — | Symbol name shown in the top bar |
|
|
@@ -487,8 +490,11 @@ chart.prependData(bars: OHLCVBar[]): this // prepend historical bars (infinite
|
|
|
487
490
|
chart.correctBar(barTime: number, bar: OHLCVBar): void // replace a bar with authoritative data after close
|
|
488
491
|
chart.setLoading(loading: boolean): this
|
|
489
492
|
|
|
490
|
-
// Reset — clears all bars, the live price line,
|
|
491
|
-
//
|
|
493
|
+
// Reset — clears all bars, the live price line, any in-flight fetch,
|
|
494
|
+
// all user drawings, and all trade/position levels (including pending drafts).
|
|
495
|
+
// Call before switching to a new symbol so no previous symbol state bleeds in.
|
|
496
|
+
// If you only want to clear bars (e.g. refreshing the same symbol), call
|
|
497
|
+
// chart.loadData([]) directly to preserve drawings.
|
|
492
498
|
chart.resetData(): this
|
|
493
499
|
```
|
|
494
500
|
|
|
@@ -530,12 +536,17 @@ chart.setDrawingTool(tool: DrawingToolType | null): this
|
|
|
530
536
|
```ts
|
|
531
537
|
chart.setLevels(levels, labelField, priceField, type): this
|
|
532
538
|
chart.removeLevelByLabel(label: string): this
|
|
533
|
-
chart.
|
|
539
|
+
chart.updateLevelMainPrice(label: string, price: number): this // move an existing level's entry price; stages the edit so it survives subsequent setLevels refreshes until the server echoes the new price or cancelLevelEdit/cancelCurrentEdit is called
|
|
540
|
+
chart.updateLevelBracket(label: string, bracketType: 'sl' | 'tp', price: number | null): this // update or remove a SL/TP bracket on an existing level; same staging semantics as updateLevelMainPrice — pass null to remove
|
|
541
|
+
chart.cancelLevelEdit(label: string): this // drop any staged edit for this level and revert to last confirmed server state
|
|
542
|
+
chart.cancelCurrentEdit(): this // cancel the active draft order or any in-progress level edit; no-op when nothing is active
|
|
534
543
|
chart.addLevelBracket(label: string, bracketType: 'sl' | 'tp'): this // auto-place a SL or TP bracket at a default offset; emits tradeLevelBracketActivated with the computed price
|
|
535
|
-
chart.setDraftBracketPnl(bracketType: 'sl' | 'tp', pnlText: string | null): this // set estimated P&L text on
|
|
544
|
+
chart.setDraftBracketPnl(bracketType: 'sl' | 'tp', pnlText: string | null): this // set estimated P&L text on the active bracket host — the draft order while drafting, or the currently selected existing pending order / position while modifying; pass null to clear
|
|
536
545
|
chart.setTfcActive(enabled: boolean): this // toggle TFC on/off at runtime; hides/shows all trade levels, draft orders, and floating trade button; fires tfcToggle event
|
|
537
546
|
```
|
|
538
547
|
|
|
548
|
+
> **Staging semantics for `updateLevelMainPrice` / `updateLevelBracket`.** Calls to these methods register the change in the chart's pending-edit buffer (the same buffer chart-initiated drags use), so the edit stays visible even when the host app keeps pushing fresh server state via `setLevels` (e.g. per-tick PnL refreshes). When the server echoes back the new price in a later `setLevels` call, the staged edit is auto-released (mobile, i.e. `hideLevelConfirmCancel: true`). If a panel closes without submitting, call `cancelLevelEdit(label)` or `cancelCurrentEdit()` to drop the staged edit — otherwise it will keep overriding server state on the chart.
|
|
549
|
+
|
|
539
550
|
### Trade Button
|
|
540
551
|
|
|
541
552
|
```ts
|
|
@@ -548,6 +548,8 @@ interface ChartConfig {
|
|
|
548
548
|
showDrawingTools?: boolean;
|
|
549
549
|
/** If false, the settings gear button in the top bar is hidden entirely. Default: true */
|
|
550
550
|
showSettings?: boolean;
|
|
551
|
+
/** If false, the fullscreen toggle button in the top bar is hidden entirely. Default: true */
|
|
552
|
+
showFullscreenButton?: boolean;
|
|
551
553
|
timeframe?: Timeframe;
|
|
552
554
|
duration?: Duration;
|
|
553
555
|
symbol?: string;
|
|
@@ -604,10 +606,12 @@ interface ChartConfig {
|
|
|
604
606
|
label: string;
|
|
605
607
|
type: TradeLevelType;
|
|
606
608
|
data: unknown;
|
|
609
|
+
newLots?: number;
|
|
607
610
|
changes: Array<{
|
|
608
611
|
field: 'MAIN' | 'SL' | 'TP' | 'ADD_SL' | 'ADD_TP' | 'REMOVE_SL' | 'REMOVE_TP';
|
|
609
612
|
newPrice: number;
|
|
610
613
|
data: unknown;
|
|
614
|
+
newLots?: number;
|
|
611
615
|
bracketOrderLabel?: string;
|
|
612
616
|
}>;
|
|
613
617
|
}) => void;
|
|
@@ -1139,16 +1143,29 @@ type ChartEventMap = {
|
|
|
1139
1143
|
tradeLevelEdit: {
|
|
1140
1144
|
label: string;
|
|
1141
1145
|
type: TradeLevelType;
|
|
1142
|
-
/**
|
|
1146
|
+
/**
|
|
1147
|
+
* Parent level's data. When the user edited the lot size during this session,
|
|
1148
|
+
* the `lots` field of this object is overridden with the new value for convenience
|
|
1149
|
+
* (so `data.lots` always reflects the effective qty being submitted). The original
|
|
1150
|
+
* server fields (e.g. `Quantity`) are left untouched — use `newLots` when you need
|
|
1151
|
+
* to distinguish "edited" from "unchanged".
|
|
1152
|
+
*/
|
|
1143
1153
|
data: unknown;
|
|
1144
1154
|
/** True when the chart is in fullscreen mode (native or CSS) at the time of the action. */
|
|
1145
1155
|
isFullscreen: boolean;
|
|
1156
|
+
/** Present when the user changed the lot size via the QTY pill flyout during this edit session. */
|
|
1157
|
+
newLots?: number;
|
|
1146
1158
|
changes: Array<{
|
|
1147
1159
|
/** MAIN = entry price edit; SL/TP = bracket edit; ADD_SL/ADD_TP = new bracket placed; REMOVE_SL/REMOVE_TP = bracket removed. */
|
|
1148
1160
|
field: 'MAIN' | 'SL' | 'TP' | 'ADD_SL' | 'ADD_TP' | 'REMOVE_SL' | 'REMOVE_TP';
|
|
1149
1161
|
newPrice: number;
|
|
1150
|
-
/**
|
|
1162
|
+
/**
|
|
1163
|
+
* Bracket order's data when the bracket is a ToClose order; parent's data for inline brackets.
|
|
1164
|
+
* On the MAIN change, `lots` is overridden with the new qty when the user edited it (same rule as the top-level `data`).
|
|
1165
|
+
*/
|
|
1151
1166
|
data: unknown;
|
|
1167
|
+
/** Present on the MAIN change when the user edited the lot size during this session. */
|
|
1168
|
+
newLots?: number;
|
|
1152
1169
|
bracketOrderLabel?: string;
|
|
1153
1170
|
}>;
|
|
1154
1171
|
};
|
|
@@ -548,6 +548,8 @@ interface ChartConfig {
|
|
|
548
548
|
showDrawingTools?: boolean;
|
|
549
549
|
/** If false, the settings gear button in the top bar is hidden entirely. Default: true */
|
|
550
550
|
showSettings?: boolean;
|
|
551
|
+
/** If false, the fullscreen toggle button in the top bar is hidden entirely. Default: true */
|
|
552
|
+
showFullscreenButton?: boolean;
|
|
551
553
|
timeframe?: Timeframe;
|
|
552
554
|
duration?: Duration;
|
|
553
555
|
symbol?: string;
|
|
@@ -604,10 +606,12 @@ interface ChartConfig {
|
|
|
604
606
|
label: string;
|
|
605
607
|
type: TradeLevelType;
|
|
606
608
|
data: unknown;
|
|
609
|
+
newLots?: number;
|
|
607
610
|
changes: Array<{
|
|
608
611
|
field: 'MAIN' | 'SL' | 'TP' | 'ADD_SL' | 'ADD_TP' | 'REMOVE_SL' | 'REMOVE_TP';
|
|
609
612
|
newPrice: number;
|
|
610
613
|
data: unknown;
|
|
614
|
+
newLots?: number;
|
|
611
615
|
bracketOrderLabel?: string;
|
|
612
616
|
}>;
|
|
613
617
|
}) => void;
|
|
@@ -1139,16 +1143,29 @@ type ChartEventMap = {
|
|
|
1139
1143
|
tradeLevelEdit: {
|
|
1140
1144
|
label: string;
|
|
1141
1145
|
type: TradeLevelType;
|
|
1142
|
-
/**
|
|
1146
|
+
/**
|
|
1147
|
+
* Parent level's data. When the user edited the lot size during this session,
|
|
1148
|
+
* the `lots` field of this object is overridden with the new value for convenience
|
|
1149
|
+
* (so `data.lots` always reflects the effective qty being submitted). The original
|
|
1150
|
+
* server fields (e.g. `Quantity`) are left untouched — use `newLots` when you need
|
|
1151
|
+
* to distinguish "edited" from "unchanged".
|
|
1152
|
+
*/
|
|
1143
1153
|
data: unknown;
|
|
1144
1154
|
/** True when the chart is in fullscreen mode (native or CSS) at the time of the action. */
|
|
1145
1155
|
isFullscreen: boolean;
|
|
1156
|
+
/** Present when the user changed the lot size via the QTY pill flyout during this edit session. */
|
|
1157
|
+
newLots?: number;
|
|
1146
1158
|
changes: Array<{
|
|
1147
1159
|
/** MAIN = entry price edit; SL/TP = bracket edit; ADD_SL/ADD_TP = new bracket placed; REMOVE_SL/REMOVE_TP = bracket removed. */
|
|
1148
1160
|
field: 'MAIN' | 'SL' | 'TP' | 'ADD_SL' | 'ADD_TP' | 'REMOVE_SL' | 'REMOVE_TP';
|
|
1149
1161
|
newPrice: number;
|
|
1150
|
-
/**
|
|
1162
|
+
/**
|
|
1163
|
+
* Bracket order's data when the bracket is a ToClose order; parent's data for inline brackets.
|
|
1164
|
+
* On the MAIN change, `lots` is overridden with the new qty when the user edited it (same rule as the top-level `data`).
|
|
1165
|
+
*/
|
|
1151
1166
|
data: unknown;
|
|
1167
|
+
/** Present on the MAIN change when the user edited the lot size during this session. */
|
|
1168
|
+
newLots?: number;
|
|
1152
1169
|
bracketOrderLabel?: string;
|
|
1153
1170
|
}>;
|
|
1154
1171
|
};
|