acttrader-charts 1.3.0-beta.23 → 1.3.0-beta.24
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 +6 -4
- package/dist/{MACD-B6SoR6iH.d.cts → MACD-BD55Bgdu.d.cts} +8 -7
- package/dist/{MACD-B6SoR6iH.d.ts → MACD-BD55Bgdu.d.ts} +8 -7
- package/dist/index.cjs +5 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -7
- 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 +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1171,9 +1171,11 @@ Sub-pane heights are user-resizable by dragging the separator between panes.
|
|
|
1171
1171
|
|
|
1172
1172
|
### SL/TP bracket labels — price or amount
|
|
1173
1173
|
|
|
1174
|
-
By default an SL/TP pill reads `SL 4159.00
|
|
1175
|
-
it reads `SL -$290.80` — the money the
|
|
1176
|
-
is hit, currency symbol in front
|
|
1174
|
+
By default an SL/TP pill reads `SL @4159.00` — the currency sign is never shown on
|
|
1175
|
+
a price. With `bracketLabelMode: 'amount'` it reads `SL -$290.80` — the money the
|
|
1176
|
+
position gains or loses if that bracket is hit, currency symbol in front and a
|
|
1177
|
+
minus only on a loss. `'priceAndAmount'` shows `SL @4159.00` at rest and
|
|
1178
|
+
`SL @4159.00 -$290.80` while the bracket is dragged.
|
|
1177
1179
|
|
|
1178
1180
|
The chart has no access to contract specs or the account currency, so each level
|
|
1179
1181
|
supplies what the maths needs:
|
|
@@ -1188,7 +1190,7 @@ chart.setLevels([{
|
|
|
1188
1190
|
valuePerPoint: 1, // account-currency value of one price unit
|
|
1189
1191
|
currencySymbol: '$', // optional per-level override
|
|
1190
1192
|
}], 'label', 'price', 'position');
|
|
1191
|
-
// pills render: SL -$290.80 TP
|
|
1193
|
+
// pills render: SL -$290.80 TP $189.20
|
|
1192
1194
|
```
|
|
1193
1195
|
|
|
1194
1196
|
```
|
|
@@ -1177,14 +1177,15 @@ interface ChartConfig {
|
|
|
1177
1177
|
/**
|
|
1178
1178
|
* What the SL/TP bracket pills show.
|
|
1179
1179
|
*
|
|
1180
|
-
* `'price'` (default) renders the bracket price — `SL 4159.00`.
|
|
1180
|
+
* `'price'` (default) renders the bracket price — `SL @4159.00`. The currency
|
|
1181
|
+
* sign is never shown on a price, only on money values.
|
|
1181
1182
|
* `'amount'` renders the money the position gains or loses if that bracket
|
|
1182
|
-
* is hit — `SL -$290.80`
|
|
1183
|
-
*
|
|
1184
|
-
*
|
|
1185
|
-
*
|
|
1186
|
-
*
|
|
1187
|
-
* dragged: `SL
|
|
1183
|
+
* is hit — `SL -$290.80` (a minus only on a loss, no plus on a gain) —
|
|
1184
|
+
* computed from the level's `lots`, `contractSize` and `valuePerPoint`.
|
|
1185
|
+
* Falls back to the price for any level lacking the data needed to compute
|
|
1186
|
+
* it, so a partial rollout degrades gracefully.
|
|
1187
|
+
* `'priceAndAmount'` shows the price at rest — `SL @1.27859` — and appends
|
|
1188
|
+
* the P/L while the bracket is being dragged: `SL @1.27859 -$29.08`.
|
|
1188
1189
|
*/
|
|
1189
1190
|
bracketLabelMode?: 'price' | 'amount' | 'priceAndAmount';
|
|
1190
1191
|
/**
|
|
@@ -1177,14 +1177,15 @@ interface ChartConfig {
|
|
|
1177
1177
|
/**
|
|
1178
1178
|
* What the SL/TP bracket pills show.
|
|
1179
1179
|
*
|
|
1180
|
-
* `'price'` (default) renders the bracket price — `SL 4159.00`.
|
|
1180
|
+
* `'price'` (default) renders the bracket price — `SL @4159.00`. The currency
|
|
1181
|
+
* sign is never shown on a price, only on money values.
|
|
1181
1182
|
* `'amount'` renders the money the position gains or loses if that bracket
|
|
1182
|
-
* is hit — `SL -$290.80`
|
|
1183
|
-
*
|
|
1184
|
-
*
|
|
1185
|
-
*
|
|
1186
|
-
*
|
|
1187
|
-
* dragged: `SL
|
|
1183
|
+
* is hit — `SL -$290.80` (a minus only on a loss, no plus on a gain) —
|
|
1184
|
+
* computed from the level's `lots`, `contractSize` and `valuePerPoint`.
|
|
1185
|
+
* Falls back to the price for any level lacking the data needed to compute
|
|
1186
|
+
* it, so a partial rollout degrades gracefully.
|
|
1187
|
+
* `'priceAndAmount'` shows the price at rest — `SL @1.27859` — and appends
|
|
1188
|
+
* the P/L while the bracket is being dragged: `SL @1.27859 -$29.08`.
|
|
1188
1189
|
*/
|
|
1189
1190
|
bracketLabelMode?: 'price' | 'amount' | 'priceAndAmount';
|
|
1190
1191
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -1935,8 +1935,7 @@ function bracketPnl(input) {
|
|
|
1935
1935
|
function formatMoney(amount, symbol = "$", decimals = 2) {
|
|
1936
1936
|
const rounded = Number(amount.toFixed(decimals));
|
|
1937
1937
|
const magnitude = Math.abs(rounded).toFixed(decimals);
|
|
1938
|
-
|
|
1939
|
-
return `${rounded > 0 ? "+" : "-"}${symbol}${magnitude}`;
|
|
1938
|
+
return `${rounded < 0 ? "-" : ""}${symbol}${magnitude}`;
|
|
1940
1939
|
}
|
|
1941
1940
|
function positionQty(input) {
|
|
1942
1941
|
const { entryPrice, stopPrice, accountSize, riskPercent } = input;
|
|
@@ -2080,13 +2079,12 @@ function bracketBoxLabel(bracketType, price, precision, level, opts = DEFAULT_BR
|
|
|
2080
2079
|
const pnl = amount();
|
|
2081
2080
|
if (pnl !== null) return `${typeLabel} ${formatMoney(pnl, symbol)}`;
|
|
2082
2081
|
}
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
if (!active) return priced;
|
|
2082
|
+
const priced = `${typeLabel} @${price.toFixed(precision)}`;
|
|
2083
|
+
if (opts.mode === "priceAndAmount" && active) {
|
|
2086
2084
|
const pnl = amount();
|
|
2087
|
-
|
|
2085
|
+
if (pnl !== null) return `${priced} ${formatMoney(pnl, symbol)}`;
|
|
2088
2086
|
}
|
|
2089
|
-
return
|
|
2087
|
+
return priced;
|
|
2090
2088
|
}
|
|
2091
2089
|
var BRACKET_BASE_RATIO = 0.68;
|
|
2092
2090
|
var BRACKET_COL_OFFSETS = [0, -0.08, 0.08];
|