acttrader-charts 1.0.18 → 1.0.20
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 +12 -0
- package/dist/{MACD-CjgSMwdG.d.cts → MACD-BDbBplVs.d.cts} +27 -0
- package/dist/{MACD-CjgSMwdG.d.ts → MACD-BDbBplVs.d.ts} +27 -0
- package/dist/index.cjs +385 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +385 -66
- 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
|
@@ -177,6 +177,8 @@ chart.setLevels([], 'label', 'price', 'pending'); // clear all of one type
|
|
|
177
177
|
|
|
178
178
|
**Brackets follow entry on drag:** when the entry line of a pending order, draft order, or an open position with `entryPriceEditable: true` is dragged, any existing `stopLossPrice` / `takeProfitPrice` brackets translate along with it by the same price delta. The distance between entry and each bracket is whatever the user currently sees — if they manually drag SL or TP to a new price, that new distance becomes the anchor for the next entry drag. Missing brackets aren't auto-created. On confirm, `tradeLevelEdit` carries all translated fields together in one `changes[]` array; on mobile (`hideLevelConfirmCancel`) the three changes are applied as one atomic event.
|
|
179
179
|
|
|
180
|
+
**Bracket pill auto-offset:** when an SL or TP price sits within about one pill-height of the entry price, the bracket's label pill is pushed vertically away from the entry pill and connected back to its real price line by a dashed leader. The horizontal bracket line itself stays at the true price; only the pill and its `×` button move, and drag targets follow the displaced pill — so grabbing the pill always drags the bracket, grabbing the entry pill always drags the entry, and grabbing the real bracket line still drags the bracket. Works for both buy and sell orders without configuration.
|
|
181
|
+
|
|
180
182
|
**TFC events:**
|
|
181
183
|
|
|
182
184
|
```ts
|
|
@@ -204,6 +206,14 @@ chart.on('tradeLevelClose', ({ label, type, action, isFullscreen }) => {
|
|
|
204
206
|
chart.on('tradeLevelDrag', ({ label, newPrice, bracketType, isFullscreen }) => {
|
|
205
207
|
updatePricePreview(label, newPrice);
|
|
206
208
|
});
|
|
209
|
+
|
|
210
|
+
// Live qty while the user edits the QTY pill flyout — fires before the level edit is
|
|
211
|
+
// confirmed, so host-side Estimated PNL for SL/TP brackets can recompute immediately
|
|
212
|
+
// instead of waiting for `tradeLevelEdit` at ✓ confirm. `type` is `'draft'` for draft
|
|
213
|
+
// orders, otherwise the parent level's type.
|
|
214
|
+
chart.on('tradeLevelQtyChange', ({ label, type, newLots, previousLots }) => {
|
|
215
|
+
updateEstimatedPnl(label, newLots);
|
|
216
|
+
});
|
|
207
217
|
```
|
|
208
218
|
|
|
209
219
|
**Off-viewport level indicators:**
|
|
@@ -784,8 +794,10 @@ chart.on('stateChange', ({ symbol, state }) => {
|
|
|
784
794
|
chart.on('tradeLevelEdit', ({ label, type, data, changes, isFullscreen }) => {});
|
|
785
795
|
chart.on('tradeLevelClose', ({ label, type, action, data, isFullscreen }) => {});
|
|
786
796
|
chart.on('tradeLevelDrag', ({ label, newPrice, data, bracketType, isFullscreen }) => {}); // fires on every mouse-move during drag
|
|
797
|
+
chart.on('tradeLevelQtyChange', ({ label, type, newLots, previousLots, isFullscreen }) => {}); // live qty edit via QTY pill — use to refresh Estimated PNL on SL/TP brackets
|
|
787
798
|
chart.on('tradeLevelEditOpen', ({ label, type, price, side, stopLossPrice, takeProfitPrice, data, isFullscreen }) => {});
|
|
788
799
|
chart.on('tradeLevelConfirmed',({ label, type, isFullscreen }) => {});
|
|
800
|
+
chart.on('tradeLevelEditCancelled', ({ label, type, isFullscreen }) => {}); // ESC / inline ✕ aborted an edit — reset external modify-order panel
|
|
789
801
|
chart.on('draftInitiated', ({ side, price, orderType, isFullscreen }) => {}); // new draft order shown — open buy/sell form
|
|
790
802
|
chart.on('draftCancelled', ({ label, isFullscreen }) => {}); // draft order dismissed without confirming
|
|
791
803
|
chart.on('tfcToggle', ({ enabled }) => {}); // TFC toggled on or off via top bar button or setTfcActive()
|
|
@@ -257,6 +257,8 @@ interface TradeLabels {
|
|
|
257
257
|
stop: string;
|
|
258
258
|
/** Market order type label. */
|
|
259
259
|
market: string;
|
|
260
|
+
/** Separator word between order descriptor and price (e.g. "at"). */
|
|
261
|
+
at: string;
|
|
260
262
|
/** Quantity input label in the draft-order input. */
|
|
261
263
|
qty: string;
|
|
262
264
|
/** Tooltip on the floating trade button (⊕). */
|
|
@@ -397,6 +399,10 @@ interface IndicatorOverlayColors {
|
|
|
397
399
|
}
|
|
398
400
|
/** Colors for trade/position horizontal level lines. */
|
|
399
401
|
interface TradeLevelColors {
|
|
402
|
+
/** Solid accent color for buy-side UI elements (popover text, button, icon). */
|
|
403
|
+
buySide: string;
|
|
404
|
+
/** Solid accent color for sell-side UI elements (popover text, button, icon). */
|
|
405
|
+
sellSide: string;
|
|
400
406
|
/** Line + box border color for open executed trades. */
|
|
401
407
|
tradeLine: string;
|
|
402
408
|
/** Line + box border color for open positions. */
|
|
@@ -1126,6 +1132,14 @@ type ChartEventMap = {
|
|
|
1126
1132
|
type: TradeLevelType | 'draft';
|
|
1127
1133
|
isFullscreen: boolean;
|
|
1128
1134
|
};
|
|
1135
|
+
/** Emitted when an in-progress level edit is cancelled from the chart (ESC key or inline ✕ cancel button).
|
|
1136
|
+
* Mirrors `tradeLevelConfirmed` but for the revert path. Not fired for draft orders (those emit `draftCancelled`).
|
|
1137
|
+
* External panels listen to reset their modify-order form when the user aborts the edit from the chart side. */
|
|
1138
|
+
tradeLevelEditCancelled: {
|
|
1139
|
+
label: string;
|
|
1140
|
+
type: TradeLevelType;
|
|
1141
|
+
isFullscreen: boolean;
|
|
1142
|
+
};
|
|
1129
1143
|
/** Emitted when a draft order is cancelled (Escape, ✕ button, or external revert). */
|
|
1130
1144
|
draftCancelled: {
|
|
1131
1145
|
label: string;
|
|
@@ -1173,6 +1187,19 @@ type ChartEventMap = {
|
|
|
1173
1187
|
uiStateChange: {
|
|
1174
1188
|
hasOpenUI: boolean;
|
|
1175
1189
|
};
|
|
1190
|
+
/** Emitted live while the user edits lot qty via the QTY pill flyout, before the
|
|
1191
|
+
* level edit is confirmed. Use this to recompute qty-derived UI (e.g. Estimated
|
|
1192
|
+
* PNL on SL/TP brackets) in real time. Final committed qty still arrives on
|
|
1193
|
+
* `tradeLevelEdit.newLots` at ✓ confirm (or immediately for draft orders).
|
|
1194
|
+
* `type` is `'draft'` for the in-progress draft order, otherwise the parent level's type.
|
|
1195
|
+
* `previousLots` is the qty at edit-session start (useful for revert-aware previews). */
|
|
1196
|
+
tradeLevelQtyChange: {
|
|
1197
|
+
label: string;
|
|
1198
|
+
type: TradeLevelType | 'draft';
|
|
1199
|
+
newLots: number;
|
|
1200
|
+
previousLots: number;
|
|
1201
|
+
isFullscreen: boolean;
|
|
1202
|
+
};
|
|
1176
1203
|
/** Emitted when the user confirms all edits to a level — replaces separate tradeLevelDragEnd / tradeLevelBracketDrag events. */
|
|
1177
1204
|
tradeLevelEdit: {
|
|
1178
1205
|
label: string;
|
|
@@ -257,6 +257,8 @@ interface TradeLabels {
|
|
|
257
257
|
stop: string;
|
|
258
258
|
/** Market order type label. */
|
|
259
259
|
market: string;
|
|
260
|
+
/** Separator word between order descriptor and price (e.g. "at"). */
|
|
261
|
+
at: string;
|
|
260
262
|
/** Quantity input label in the draft-order input. */
|
|
261
263
|
qty: string;
|
|
262
264
|
/** Tooltip on the floating trade button (⊕). */
|
|
@@ -397,6 +399,10 @@ interface IndicatorOverlayColors {
|
|
|
397
399
|
}
|
|
398
400
|
/** Colors for trade/position horizontal level lines. */
|
|
399
401
|
interface TradeLevelColors {
|
|
402
|
+
/** Solid accent color for buy-side UI elements (popover text, button, icon). */
|
|
403
|
+
buySide: string;
|
|
404
|
+
/** Solid accent color for sell-side UI elements (popover text, button, icon). */
|
|
405
|
+
sellSide: string;
|
|
400
406
|
/** Line + box border color for open executed trades. */
|
|
401
407
|
tradeLine: string;
|
|
402
408
|
/** Line + box border color for open positions. */
|
|
@@ -1126,6 +1132,14 @@ type ChartEventMap = {
|
|
|
1126
1132
|
type: TradeLevelType | 'draft';
|
|
1127
1133
|
isFullscreen: boolean;
|
|
1128
1134
|
};
|
|
1135
|
+
/** Emitted when an in-progress level edit is cancelled from the chart (ESC key or inline ✕ cancel button).
|
|
1136
|
+
* Mirrors `tradeLevelConfirmed` but for the revert path. Not fired for draft orders (those emit `draftCancelled`).
|
|
1137
|
+
* External panels listen to reset their modify-order form when the user aborts the edit from the chart side. */
|
|
1138
|
+
tradeLevelEditCancelled: {
|
|
1139
|
+
label: string;
|
|
1140
|
+
type: TradeLevelType;
|
|
1141
|
+
isFullscreen: boolean;
|
|
1142
|
+
};
|
|
1129
1143
|
/** Emitted when a draft order is cancelled (Escape, ✕ button, or external revert). */
|
|
1130
1144
|
draftCancelled: {
|
|
1131
1145
|
label: string;
|
|
@@ -1173,6 +1187,19 @@ type ChartEventMap = {
|
|
|
1173
1187
|
uiStateChange: {
|
|
1174
1188
|
hasOpenUI: boolean;
|
|
1175
1189
|
};
|
|
1190
|
+
/** Emitted live while the user edits lot qty via the QTY pill flyout, before the
|
|
1191
|
+
* level edit is confirmed. Use this to recompute qty-derived UI (e.g. Estimated
|
|
1192
|
+
* PNL on SL/TP brackets) in real time. Final committed qty still arrives on
|
|
1193
|
+
* `tradeLevelEdit.newLots` at ✓ confirm (or immediately for draft orders).
|
|
1194
|
+
* `type` is `'draft'` for the in-progress draft order, otherwise the parent level's type.
|
|
1195
|
+
* `previousLots` is the qty at edit-session start (useful for revert-aware previews). */
|
|
1196
|
+
tradeLevelQtyChange: {
|
|
1197
|
+
label: string;
|
|
1198
|
+
type: TradeLevelType | 'draft';
|
|
1199
|
+
newLots: number;
|
|
1200
|
+
previousLots: number;
|
|
1201
|
+
isFullscreen: boolean;
|
|
1202
|
+
};
|
|
1176
1203
|
/** Emitted when the user confirms all edits to a level — replaces separate tradeLevelDragEnd / tradeLevelBracketDrag events. */
|
|
1177
1204
|
tradeLevelEdit: {
|
|
1178
1205
|
label: string;
|