@tradecanvas/core 1.10.0 → 1.11.0
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/dist/{WebGLSeriesRenderer-DQOPCwno.js → WebGLSeriesRenderer-DVJBHdfm.js} +266 -169
- package/dist/WebGLSeriesRenderer-DVJBHdfm.js.map +1 -0
- package/dist/WebGLSeriesRenderer-DjkYvHPQ.cjs +429 -0
- package/dist/WebGLSeriesRenderer-DjkYvHPQ.cjs.map +1 -0
- package/dist/charts/DepthHeatmapBuffer.d.ts +6 -3
- package/dist/charts/DepthHeatmapBuffer.d.ts.map +1 -1
- package/dist/charts/MarketProfileRenderer.d.ts +2 -0
- package/dist/charts/MarketProfileRenderer.d.ts.map +1 -1
- package/dist/charts/VolumeCandleRenderer.d.ts.map +1 -1
- package/dist/charts/pixelGrid.d.ts +10 -0
- package/dist/charts/pixelGrid.d.ts.map +1 -1
- package/dist/engine/RenderEngine.d.ts +10 -4
- package/dist/engine/RenderEngine.d.ts.map +1 -1
- package/dist/engine/gpu.d.ts +15 -2
- package/dist/engine/gpu.d.ts.map +1 -1
- package/dist/{gridLines-kFhXyH-u.js → gridLines-BJLaM2d7.js} +28 -24
- package/dist/gridLines-BJLaM2d7.js.map +1 -0
- package/dist/gridLines-CBmfrSCE.cjs +2 -0
- package/dist/gridLines-CBmfrSCE.cjs.map +1 -0
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +735 -709
- package/dist/index.js.map +1 -1
- package/dist/webgl/WebGLSeriesRenderer.d.ts +1 -0
- package/dist/webgl/WebGLSeriesRenderer.d.ts.map +1 -1
- package/dist/webgl/commandDrawer.d.ts.map +1 -1
- package/dist/webgl/recorder.d.ts +18 -1
- package/dist/webgl/recorder.d.ts.map +1 -1
- package/dist/webgl/shaders.d.ts +8 -7
- package/dist/webgl/shaders.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/WebGLSeriesRenderer-DQOPCwno.js.map +0 -1
- package/dist/WebGLSeriesRenderer-DspCYR38.cjs +0 -429
- package/dist/WebGLSeriesRenderer-DspCYR38.cjs.map +0 -1
- package/dist/gridLines-J41F0DQ6.cjs +0 -2
- package/dist/gridLines-J41F0DQ6.cjs.map +0 -1
- package/dist/gridLines-kFhXyH-u.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as e, S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, p as m, r as h, s as g, t as _, u as v, v as y, x as b, y as x } from "./gridLines-BJLaM2d7.js";
|
|
2
2
|
import { DARK_THEME as S, DEFAULT_BAR_SPACING as C, DEFAULT_BAR_WIDTH as w, DEFAULT_FONT_FAMILY as T, DEFAULT_RECONNECT as E, DEFAULT_SIGNAL_STYLE as D, DEFAULT_STREAM_CONFIG as O, DEFAULT_TRADE_ZONE_STYLE as ee, DEFAULT_TRADING_CONFIG as te, LIGHT_THEME as ne, LayerType as k, PRICE_AXIS_WIDTH as A, TC_SERIES_COLORS as re, TIME_AXIS_HEIGHT as ie, autoPricePrecision as j, barsAreDaily as ae, clamp as oe, computePriceRange as se, computeTickStep as ce, formatPrice as M, formatPriceScaleLabel as le, isDateOnly as ue, isPriceSource as de, lerpColor as fe, normalizeBarTime as pe, offsetAt as me, parseIndicatorSource as he, parseTimeframe as ge, pickBaseTimeframe as _e, rankSymbols as ve, readChartTypeOptions as ye, readQuote as be, resampleBars as xe, resolveDrawingOptions as Se, resolveVolumeColors as Ce, sanitizeDrawingOptions as we, sanitizeDrawingStyle as Te, sliceVisibleData as Ee, sourcePrice as De, stepDecimals as Oe, tickBarCount as ke, timeParts as Ae, timeframeBucketStart as N, timeframeToMs as P, tzLabel as je, wallToUtc as Me, withAlpha as Ne, zoneOffsetMinutes as Pe, zonedDateFormatter as Fe } from "@tradecanvas/commons";
|
|
3
3
|
//#region src/engine/CanvasLayer.ts
|
|
4
4
|
var Ie = class {
|
|
@@ -159,23 +159,23 @@ var He = 12, Ue = 14, We = class {
|
|
|
159
159
|
setLocale(e) {
|
|
160
160
|
this.locale = e;
|
|
161
161
|
}
|
|
162
|
-
render(e, t,
|
|
163
|
-
let { chartRect:
|
|
164
|
-
if (
|
|
165
|
-
let d =
|
|
166
|
-
e.strokeStyle =
|
|
167
|
-
let f = Ve(ce(
|
|
168
|
-
for (let e = p; e <=
|
|
162
|
+
render(e, t, r, i = "right", a = []) {
|
|
163
|
+
let { chartRect: o, priceRange: s } = t, l = i === "left", u = l ? o.x : o.x + o.width;
|
|
164
|
+
if (s.max - s.min <= 0) return;
|
|
165
|
+
let d = n(t);
|
|
166
|
+
e.strokeStyle = r.axisLine, e.lineWidth = 1, e.globalAlpha = .65, e.beginPath(), e.moveTo(u + .5, o.y), e.lineTo(u + .5, o.y + o.height), e.stroke(), e.globalAlpha = 1;
|
|
167
|
+
let f = Ve(ce(s.min, s.max, 8), t.priceUnit), p = Math.ceil(s.min / f) * f, m = j(s.min, s.max), h = `500 ${r.font.sizeSmall}px ${r.font.family}`, g = [], _ = l ? null : this.reservedPrice?.() ?? null, v = _ === null ? null : c(_, t);
|
|
168
|
+
for (let e = p; e <= s.max; e += f) {
|
|
169
169
|
let n = d(e);
|
|
170
|
-
v !== null && Math.abs(n - v) < He ||
|
|
170
|
+
v !== null && Math.abs(n - v) < He || a.some((e) => Math.abs(n - e) < Ue) || g.push({
|
|
171
171
|
y: n,
|
|
172
172
|
text: Be(e, t, m, this.locale)
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
|
-
e.font = h, e.textBaseline = "middle", e.textAlign = l ? "right" : "left", e.strokeStyle =
|
|
175
|
+
e.font = h, e.textBaseline = "middle", e.textAlign = l ? "right" : "left", e.strokeStyle = r.axisLine, e.globalAlpha = .45, e.beginPath();
|
|
176
176
|
let y = l ? -1 : 1;
|
|
177
177
|
for (let { y: t } of g) e.moveTo(u + y, t + .5), e.lineTo(u + 4 * y, t + .5);
|
|
178
|
-
e.stroke(), e.globalAlpha = 1, e.fillStyle =
|
|
178
|
+
e.stroke(), e.globalAlpha = 1, e.fillStyle = r.axisLabel;
|
|
179
179
|
for (let { y: t, text: n } of g) e.fillText(n, u + 8 * y, t);
|
|
180
180
|
}
|
|
181
181
|
};
|
|
@@ -292,28 +292,30 @@ function et(e, t, n, r) {
|
|
|
292
292
|
//#endregion
|
|
293
293
|
//#region src/charts/CandlestickRenderer.ts
|
|
294
294
|
var tt = class {
|
|
295
|
-
render(e, t,
|
|
296
|
-
let { from:
|
|
297
|
-
if (
|
|
298
|
-
if (
|
|
299
|
-
|
|
295
|
+
render(e, t, i, a) {
|
|
296
|
+
let { from: o, to: s } = i.visibleRange, c = i.barWidth, l = c + i.barSpacing, d = -i.offset + i.chartRect.x + c / 2, { min: f, max: p } = i.priceRange;
|
|
297
|
+
if (p - f === 0) return;
|
|
298
|
+
if (u(i)) {
|
|
299
|
+
r(e, t, i, a.candleUp, a.candleDown);
|
|
300
300
|
return;
|
|
301
301
|
}
|
|
302
|
-
let
|
|
303
|
-
|
|
304
|
-
let { body: r, wick:
|
|
305
|
-
for (let e =
|
|
306
|
-
let
|
|
307
|
-
(
|
|
308
|
-
let v = n.y(
|
|
309
|
-
(
|
|
302
|
+
let m = n(i);
|
|
303
|
+
v(e, (n) => {
|
|
304
|
+
let { body: r, wick: i } = g(c, n.ratio), u = (r - i) / 2, f = new Path2D(), p = new Path2D(), h = new Path2D(), _ = new Path2D();
|
|
305
|
+
for (let e = o; e <= s && e < t.length; e++) {
|
|
306
|
+
let a = t[e], o = a.close >= a.open, s = n.left(e * l + d, i), c = n.y(m(a.high)), g = n.y(m(a.low));
|
|
307
|
+
(o ? f : p).rect(s, Math.min(c, g), i, Math.max(Math.abs(g - c), 1));
|
|
308
|
+
let v = n.y(m(a.open)), y = n.y(m(a.close));
|
|
309
|
+
(o ? h : _).rect(s - u, Math.min(v, y), r, Math.max(Math.abs(y - v), i));
|
|
310
310
|
}
|
|
311
|
-
e.fillStyle =
|
|
311
|
+
e.fillStyle = a.candleUpWick, e.fill(f), e.fillStyle = a.candleDownWick, e.fill(p), e.fillStyle = a.candleUp, e.fill(h), e.fillStyle = a.candleDown, e.fill(_);
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
314
|
}, nt = 20, rt = 8;
|
|
315
|
-
function it(e) {
|
|
316
|
-
|
|
315
|
+
function it(e, t, n) {
|
|
316
|
+
if (!e) return null;
|
|
317
|
+
let r = e.region(t, { text: !1 });
|
|
318
|
+
return n.every((e) => r.step(e)) ? e : null;
|
|
317
319
|
}
|
|
318
320
|
function at(e) {
|
|
319
321
|
return e < 1 ? Math.ceil(-Math.log10(e)) + 1 : +(e < 10);
|
|
@@ -399,31 +401,35 @@ var ot = class {
|
|
|
399
401
|
t.priceAxis?.render(a, n, r, "right", [...p.map((e) => e.y), ...m.map((e) => e.y)]), Ze(a, m, n.chartRect.x + n.chartRect.width, n.priceAxisWidth ?? A, r), t.leftViewport && (t.leftPriceAxis?.render(a, t.leftViewport, r, "left"), t.indicatorValueLabels !== !1 && this.renderLeftValueLabels(a, t, t.leftViewport)), t.tradingRenderer?.renderAxisBadges(a, n, r), t.priceLines?.renderAxisTags(a, n, r, i), t.currentPriceLine?.render(a, n, r), t.timeAxis?.render(a, n, r, i, t.timeAxisY), this.renderPanelAxes(a, t);
|
|
400
402
|
}
|
|
401
403
|
renderGpu(e, t, n, r, i) {
|
|
402
|
-
let { viewport: a, theme: o, data: s } = t, c = this.layerManager.getDpr(), l = e.recorder?.(c, n) ?? null,
|
|
404
|
+
let { viewport: a, theme: o, data: s } = t, c = this.layerManager.getDpr(), l = this.underSteps(t), u = !!(t.marketProfile?.isVisible() && t.marketProfile.drawsText()), d = l.length > 0 && !u ? it(e.recorder?.(c, n) ?? null, a.chartRect, l) : null, f = l.length > 0 && !d, p = e.recorder?.(c, n) ?? null, m = p ? et(p, a.chartRect, r, i) : $e(r), h = !!(t.volumeProfile?.isVisible() || t.marketProfile?.isVisible()), g = t.watermark?.isVisible() || f ? null : {
|
|
403
405
|
grid: t.gridRenderer?.isVisible() ?? !1,
|
|
404
406
|
rects: [...t.sessionShading?.rects(s, a, o) ?? [], ...t.sessionBreaks?.lineRects(a, o, s) ?? []]
|
|
405
|
-
},
|
|
407
|
+
}, _ = t.volumeRenderer?.isVisible() && !h ? { heightRatio: t.volumeRenderer.getHeightRatio() } : null, v = e.render({
|
|
406
408
|
data: s,
|
|
407
409
|
viewport: a,
|
|
408
410
|
theme: o,
|
|
409
411
|
dpr: c,
|
|
410
412
|
candles: t.chartRenderer instanceof tt,
|
|
411
|
-
volume:
|
|
412
|
-
background:
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
t.depthHeatmap?.render(g.ctx, a, o), d && t.volumeRenderer?.render(g.ctx, s, a, o), t.volumeProfile?.render(g.ctx, s, a, o), t.marketProfile?.render(g.ctx, s, a, o);
|
|
417
|
-
}), {
|
|
413
|
+
volume: _,
|
|
414
|
+
background: g,
|
|
415
|
+
under: d,
|
|
416
|
+
recorded: p
|
|
417
|
+
}), y = v.recorded ? m : $e(r), b = {
|
|
418
418
|
drawn: {
|
|
419
|
-
...
|
|
420
|
-
volume:
|
|
419
|
+
...v,
|
|
420
|
+
volume: v.volume || h
|
|
421
421
|
},
|
|
422
|
-
plan:
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
422
|
+
plan: y
|
|
423
|
+
}, x = g !== null && !!v.background, S = d !== null && v.under ? [] : l;
|
|
424
|
+
return x && S.length === 0 ? (this.layerManager.dropBackLayer(), b) : (this.renderBackCanvas(t, S, !x), b);
|
|
425
|
+
}
|
|
426
|
+
underSteps(e) {
|
|
427
|
+
let { viewport: t, theme: n, data: r } = e, i = [];
|
|
428
|
+
return e.depthHeatmap?.isVisible() && i.push((r) => e.depthHeatmap.render(r, t, n)), (e.volumeProfile?.isVisible() || e.marketProfile?.isVisible()) && (e.volumeRenderer?.isVisible() && i.push((i) => e.volumeRenderer.render(i, r, t, n)), e.volumeProfile?.isVisible() && i.push((i) => e.volumeProfile.render(i, r, t, n)), e.marketProfile?.isVisible() && i.push((i) => e.marketProfile.render(i, r, t, n))), i;
|
|
429
|
+
}
|
|
430
|
+
renderBackCanvas(e, t, n) {
|
|
431
|
+
let r = this.layerManager.backLayer();
|
|
432
|
+
r && (r.clear(), n && this.renderBackground(r.ctx, e), t.length > 0 && this.inPlot(r.ctx, e.viewport, () => t.forEach((e) => e(r.ctx))));
|
|
427
433
|
}
|
|
428
434
|
renderBackground(e, t) {
|
|
429
435
|
let { viewport: n, theme: r, data: i } = t;
|
|
@@ -560,47 +566,47 @@ var ot = class {
|
|
|
560
566
|
renderPanelCrosshair(e, t) {
|
|
561
567
|
let n = t.crosshairHandler?.getPosition();
|
|
562
568
|
if (!n || t.panels.length === 0) return;
|
|
563
|
-
let { theme:
|
|
564
|
-
for (let
|
|
565
|
-
let
|
|
566
|
-
if (n.x <
|
|
567
|
-
let
|
|
568
|
-
if (
|
|
569
|
-
let
|
|
570
|
-
e.save(), e.beginPath(), e.rect(
|
|
569
|
+
let { theme: r } = t;
|
|
570
|
+
for (let i of t.panels) {
|
|
571
|
+
let a = i.rect;
|
|
572
|
+
if (n.x < a.x || n.x > a.x + a.width || n.y < a.y || n.y > a.y + a.height) continue;
|
|
573
|
+
let o = i.viewport;
|
|
574
|
+
if (o.chartRect.height < rt) continue;
|
|
575
|
+
let c = b(n.x, o), l = s(Math.max(0, Math.min((t.data?.length ?? 1) - 1, Math.round(c))), o);
|
|
576
|
+
e.save(), e.beginPath(), e.rect(a.x, a.y, a.width, a.height), e.clip(), e.setLineDash([4, 4]), e.strokeStyle = r.crosshair, e.lineWidth = 1, e.beginPath(), e.moveTo(Math.round(l) + .5, a.y), e.lineTo(Math.round(l) + .5, a.y + a.height), e.stroke(), e.beginPath(), e.moveTo(a.x, Math.round(n.y) + .5), e.lineTo(a.x + a.width, Math.round(n.y) + .5), e.stroke(), e.setLineDash([]), e.restore();
|
|
571
577
|
break;
|
|
572
578
|
}
|
|
573
579
|
}
|
|
574
580
|
renderPanelHoverValues(t, n) {
|
|
575
|
-
let
|
|
576
|
-
if (!
|
|
577
|
-
let { theme:
|
|
578
|
-
for (let
|
|
579
|
-
let
|
|
580
|
-
if (
|
|
581
|
-
let
|
|
582
|
-
if (
|
|
583
|
-
let n = Be(e(
|
|
584
|
-
t.font = `bold ${
|
|
585
|
-
let
|
|
586
|
-
t.fillStyle =
|
|
581
|
+
let r = n.crosshairHandler?.getPosition(), i = n.indicatorEngine;
|
|
582
|
+
if (!r || n.panels.length === 0) return;
|
|
583
|
+
let { theme: a, viewport: o, data: s } = n, c = n.numberLocale ?? "en-US", l = `${a.font.sizeSmall}px ${a.font.family}`, u = i ? this.panelDescriptors(i) : null;
|
|
584
|
+
for (let d of n.panels) {
|
|
585
|
+
let f = d.viewport, p = d.rect, { min: m, max: h } = f.priceRange;
|
|
586
|
+
if (h - m <= 0 || p.height <= 0 || f.chartRect.height < rt) continue;
|
|
587
|
+
let g = p.x + p.width, _ = at(ce(m, h, 4));
|
|
588
|
+
if (r.x >= p.x && r.x <= p.x + p.width && r.y >= p.y && r.y <= p.y + p.height) {
|
|
589
|
+
let n = Be(e(r.y, f), f, _, c);
|
|
590
|
+
t.font = `bold ${a.font.sizeSmall}px ${a.font.family}`;
|
|
591
|
+
let i = t.measureText(n).width, s = Math.min(i + 10, (o.priceAxisWidth ?? A) - 2);
|
|
592
|
+
t.fillStyle = a.crosshair, F(t, g + 1, r.y - 9, s, 18, a), t.fillStyle = a.background, t.textBaseline = "middle", t.textAlign = "left", t.fillText(n, g + 5, r.y);
|
|
587
593
|
}
|
|
588
|
-
if (!
|
|
589
|
-
let
|
|
594
|
+
if (!i || n.paneTitles === !1) continue;
|
|
595
|
+
let v = Math.max(0, Math.min((s?.length ?? 1) - 1, Math.round(b(r.x, f)))), y = i.getOutput(d.instanceId), x = y?.series && v < y.series.length ? y.series[v] : null;
|
|
590
596
|
if (!x) continue;
|
|
591
|
-
let S =
|
|
597
|
+
let S = u?.get(d.instanceId), C = S?.descriptor.plots, w = [];
|
|
592
598
|
if (C) for (let e of C) {
|
|
593
599
|
let t = x[e.key];
|
|
594
|
-
t !== void 0 && Number.isFinite(t) && w.push(`${e.title} ${Be(t,
|
|
600
|
+
t !== void 0 && Number.isFinite(t) && w.push(`${e.title} ${Be(t, f, _, c)}`);
|
|
595
601
|
}
|
|
596
602
|
else for (let e in x) {
|
|
597
603
|
let t = x[e];
|
|
598
|
-
t !== void 0 && w.push(`${e}: ${t.toFixed(
|
|
604
|
+
t !== void 0 && w.push(`${e}: ${t.toFixed(_)}`);
|
|
599
605
|
}
|
|
600
606
|
if (w.length === 0) continue;
|
|
601
|
-
t.font =
|
|
607
|
+
t.font = l;
|
|
602
608
|
let T = S ? t.measureText(S.descriptor.name).width + 14 : 10;
|
|
603
|
-
t.fillStyle =
|
|
609
|
+
t.fillStyle = a.textSecondary, t.textBaseline = "top", t.textAlign = "left", t.fillText(w.join(" "), p.x + T, p.y + 6);
|
|
604
610
|
}
|
|
605
611
|
}
|
|
606
612
|
panelDescriptors(e) {
|
|
@@ -643,7 +649,7 @@ var ot = class {
|
|
|
643
649
|
async function st(e) {
|
|
644
650
|
let t;
|
|
645
651
|
try {
|
|
646
|
-
t = await import("./WebGLSeriesRenderer-
|
|
652
|
+
t = await import("./WebGLSeriesRenderer-DVJBHdfm.js");
|
|
647
653
|
} catch (e) {
|
|
648
654
|
return console.warn("TradeCanvas: the WebGL renderer failed to load, drawing with Canvas 2D.", e), null;
|
|
649
655
|
}
|
|
@@ -946,87 +952,87 @@ function yt(e, t, n, r, i) {
|
|
|
946
952
|
//#endregion
|
|
947
953
|
//#region src/charts/LineRenderer.ts
|
|
948
954
|
var bt = class {
|
|
949
|
-
render(e, t,
|
|
950
|
-
let { from:
|
|
951
|
-
if (
|
|
952
|
-
let
|
|
955
|
+
render(e, t, r, i) {
|
|
956
|
+
let { from: a, to: o } = r.visibleRange;
|
|
957
|
+
if (a > o || t.length === 0) return;
|
|
958
|
+
let s = r.barWidth + r.barSpacing, c = -r.offset + r.chartRect.x + r.barWidth / 2, { min: l, max: u } = r.priceRange;
|
|
953
959
|
if (u - l === 0) return;
|
|
954
|
-
let d =
|
|
955
|
-
e.beginPath(), e.strokeStyle =
|
|
956
|
-
let f = yt(
|
|
960
|
+
let d = n(r);
|
|
961
|
+
e.beginPath(), e.strokeStyle = i.lineColor, e.lineWidth = 2, e.lineJoin = "round";
|
|
962
|
+
let f = yt(a, o, t.length, r.chartRect.width, (e) => t[e].close), p = !1;
|
|
957
963
|
for (let n of f) {
|
|
958
|
-
let r = n *
|
|
964
|
+
let r = n * s + c, i = d(t[n].close);
|
|
959
965
|
p ? e.lineTo(r, i) : (e.moveTo(r, i), p = !0);
|
|
960
966
|
}
|
|
961
967
|
e.stroke();
|
|
962
968
|
}
|
|
963
969
|
}, xt = class {
|
|
964
|
-
render(e, t,
|
|
965
|
-
let { from:
|
|
966
|
-
if (
|
|
967
|
-
let
|
|
970
|
+
render(e, t, r, i) {
|
|
971
|
+
let { from: a, to: o } = r.visibleRange;
|
|
972
|
+
if (a > o || t.length === 0) return;
|
|
973
|
+
let s = r.barWidth + r.barSpacing, c = -r.offset + r.chartRect.x + r.barWidth / 2, { min: l, max: u } = r.priceRange;
|
|
968
974
|
if (u - l === 0) return;
|
|
969
|
-
let d =
|
|
975
|
+
let d = n(r), f = d(l), p = yt(a, o, t.length, r.chartRect.width, (e) => t[e].close);
|
|
970
976
|
if (p.length === 0) return;
|
|
971
|
-
let m = p[0], h = m *
|
|
972
|
-
_.addColorStop(0,
|
|
977
|
+
let m = p[0], h = m * s + c, g = d(t[m].close), _ = e.createLinearGradient(0, d(u), 0, f);
|
|
978
|
+
_.addColorStop(0, i.areaTopColor), _.addColorStop(1, i.areaBottomColor), e.beginPath(), e.moveTo(h, f), e.lineTo(h, g);
|
|
973
979
|
let v = h;
|
|
974
980
|
for (let n = 1; n < p.length; n++) {
|
|
975
981
|
let r = p[n];
|
|
976
|
-
v = r *
|
|
982
|
+
v = r * s + c, e.lineTo(v, d(t[r].close));
|
|
977
983
|
}
|
|
978
|
-
e.lineTo(v, f), e.closePath(), e.fillStyle = _, e.fill(), e.beginPath(), e.strokeStyle =
|
|
984
|
+
e.lineTo(v, f), e.closePath(), e.fillStyle = _, e.fill(), e.beginPath(), e.strokeStyle = i.lineColor, e.lineWidth = 2, e.lineJoin = "round", e.moveTo(h, g);
|
|
979
985
|
for (let n = 1; n < p.length; n++) {
|
|
980
986
|
let r = p[n];
|
|
981
|
-
e.lineTo(r *
|
|
987
|
+
e.lineTo(r * s + c, d(t[r].close));
|
|
982
988
|
}
|
|
983
989
|
e.stroke();
|
|
984
990
|
}
|
|
985
991
|
}, St = class {
|
|
986
|
-
render(e, t,
|
|
987
|
-
let { from:
|
|
988
|
-
if (
|
|
989
|
-
if (
|
|
990
|
-
|
|
992
|
+
render(e, t, i, a) {
|
|
993
|
+
let { from: o, to: s } = i.visibleRange, c = i.barWidth, l = c + i.barSpacing, d = -i.offset + i.chartRect.x + c / 2, { min: f, max: p } = i.priceRange;
|
|
994
|
+
if (p - f === 0) return;
|
|
995
|
+
if (u(i)) {
|
|
996
|
+
r(e, t, i, a.candleUp, a.candleDown);
|
|
991
997
|
return;
|
|
992
998
|
}
|
|
993
|
-
let
|
|
994
|
-
|
|
995
|
-
let { body: r, wick:
|
|
996
|
-
for (let e =
|
|
997
|
-
let r = t[e],
|
|
998
|
-
|
|
999
|
+
let m = n(i);
|
|
1000
|
+
v(e, (n) => {
|
|
1001
|
+
let { body: r, wick: i } = g(c, n.ratio), u = Math.max((r - i) / 2, i), f = new Path2D(), p = new Path2D();
|
|
1002
|
+
for (let e = o; e <= s && e < t.length; e++) {
|
|
1003
|
+
let r = t[e], a = r.close >= r.open ? f : p, o = n.left(e * l + d, i), s = n.y(m(r.high)), c = n.y(m(r.low));
|
|
1004
|
+
a.rect(o, Math.min(s, c), i, Math.max(Math.abs(c - s), i)), a.rect(o - u, n.y(m(r.open)) - Math.floor(i / 2), u, i), a.rect(o + i, n.y(m(r.close)) - Math.floor(i / 2), u, i);
|
|
999
1005
|
}
|
|
1000
|
-
e.fillStyle =
|
|
1006
|
+
e.fillStyle = a.candleUp, e.fill(f), e.fillStyle = a.candleDown, e.fill(p);
|
|
1001
1007
|
});
|
|
1002
1008
|
}
|
|
1003
1009
|
}, Ct = class {
|
|
1004
|
-
render(e, t,
|
|
1005
|
-
let { from:
|
|
1006
|
-
if (
|
|
1007
|
-
if (
|
|
1008
|
-
|
|
1010
|
+
render(e, t, i, a) {
|
|
1011
|
+
let { from: o, to: s } = i.visibleRange, c = i.barWidth, l = c + i.barSpacing, d = -i.offset + i.chartRect.x + c / 2, { min: f, max: p } = i.priceRange;
|
|
1012
|
+
if (p - f === 0) return;
|
|
1013
|
+
if (u(i)) {
|
|
1014
|
+
r(e, t, i, a.candleUp, a.candleDown);
|
|
1009
1015
|
return;
|
|
1010
1016
|
}
|
|
1011
|
-
let
|
|
1012
|
-
|
|
1013
|
-
let { body: r, wick:
|
|
1017
|
+
let m = n(i);
|
|
1018
|
+
v(e, (n) => {
|
|
1019
|
+
let { body: r, wick: i } = g(c, n.ratio), u = (r - i) / 2, f = {
|
|
1014
1020
|
up: new Path2D(),
|
|
1015
1021
|
down: new Path2D()
|
|
1016
|
-
},
|
|
1022
|
+
}, p = {
|
|
1017
1023
|
up: new Path2D(),
|
|
1018
1024
|
down: new Path2D()
|
|
1019
1025
|
}, h = {
|
|
1020
1026
|
up: new Path2D(),
|
|
1021
1027
|
down: new Path2D()
|
|
1022
1028
|
};
|
|
1023
|
-
for (let e =
|
|
1024
|
-
let
|
|
1025
|
-
|
|
1029
|
+
for (let e = o; e <= s && e < t.length; e++) {
|
|
1030
|
+
let a = t[e], o = e === 0 || a.close >= t[e - 1].close ? "up" : "down", s = n.left(e * l + d, i), c = s - u, g = n.y(m(a.high)), _ = n.y(m(a.low)), v = n.y(m(a.open)), y = n.y(m(a.close)), b = Math.min(v, y), x = Math.max(Math.abs(y - v), i);
|
|
1031
|
+
a.close >= a.open ? (b > g && f[o].rect(s, g, i, b - g), _ > b + x && f[o].rect(s, b + x, i, _ - b - x), h[o].rect(c + i / 2, b + i / 2, Math.max(r - i, 0), Math.max(x - i, 0))) : (f[o].rect(s, Math.min(g, _), i, Math.max(Math.abs(_ - g), 1)), p[o].rect(c, b, r, x));
|
|
1026
1032
|
}
|
|
1027
1033
|
for (let t of ["up", "down"]) {
|
|
1028
|
-
let n = t === "up" ?
|
|
1029
|
-
e.fillStyle = n, e.fill(
|
|
1034
|
+
let n = t === "up" ? a.candleUp : a.candleDown;
|
|
1035
|
+
e.fillStyle = n, e.fill(f[t]), e.fill(p[t]), e.strokeStyle = n, e.lineWidth = i, e.stroke(h[t]);
|
|
1030
1036
|
}
|
|
1031
1037
|
});
|
|
1032
1038
|
}
|
|
@@ -1035,13 +1041,13 @@ var bt = class {
|
|
|
1035
1041
|
setBaseline(e) {
|
|
1036
1042
|
this.baselinePrice = e;
|
|
1037
1043
|
}
|
|
1038
|
-
render(e, t,
|
|
1039
|
-
let { from:
|
|
1040
|
-
if (
|
|
1041
|
-
let
|
|
1044
|
+
render(e, t, r, i) {
|
|
1045
|
+
let { from: a, to: o } = r.visibleRange;
|
|
1046
|
+
if (a > o || t.length === 0) return;
|
|
1047
|
+
let s = r.barWidth, c = s / 2, l = s + r.barSpacing, u = -r.offset + r.chartRect.x + c, { min: d, max: f } = r.priceRange;
|
|
1042
1048
|
if (f - d === 0) return;
|
|
1043
|
-
let p = (e) => e * l + u, m =
|
|
1044
|
-
for (let e =
|
|
1049
|
+
let p = (e) => e * l + u, m = n(r), h = m(this.baselinePrice ?? this.computeBaseline(t, a, o)), { chartRect: g } = r, _ = [], v = [];
|
|
1050
|
+
for (let e = a; e <= o && e < t.length; e++) _.push(p(e)), v.push(m(t[e].close));
|
|
1045
1051
|
if (_.length < 2) return;
|
|
1046
1052
|
let y = _.length - 1;
|
|
1047
1053
|
e.save();
|
|
@@ -1050,19 +1056,19 @@ var bt = class {
|
|
|
1050
1056
|
let C = new Path2D();
|
|
1051
1057
|
C.moveTo(_[0], h);
|
|
1052
1058
|
for (let e = 0; e <= y; e++) C.lineTo(_[e], v[e]);
|
|
1053
|
-
C.lineTo(_[y], h), C.closePath(), e.fillStyle = `${
|
|
1059
|
+
C.lineTo(_[y], h), C.closePath(), e.fillStyle = `${i.candleUp}20`, e.fill(C), e.restore(), e.save();
|
|
1054
1060
|
let w = new Path2D();
|
|
1055
1061
|
w.rect(g.x, Math.min(h, x), g.width, Math.abs(x - h)), e.clip(w);
|
|
1056
1062
|
let T = new Path2D();
|
|
1057
1063
|
T.moveTo(_[0], h);
|
|
1058
1064
|
for (let e = 0; e <= y; e++) T.lineTo(_[e], v[e]);
|
|
1059
|
-
T.lineTo(_[y], h), T.closePath(), e.fillStyle = `${
|
|
1065
|
+
T.lineTo(_[y], h), T.closePath(), e.fillStyle = `${i.candleDown}20`, e.fill(T), e.restore();
|
|
1060
1066
|
let E = new Path2D(), D = new Path2D();
|
|
1061
1067
|
for (let e = 1; e <= y; e++) {
|
|
1062
|
-
let t = (
|
|
1068
|
+
let t = (r.invertScale ? v[e] >= h : v[e] <= h) ? E : D;
|
|
1063
1069
|
t.moveTo(_[e - 1], v[e - 1]), t.lineTo(_[e], v[e]);
|
|
1064
1070
|
}
|
|
1065
|
-
e.lineWidth = 2, e.strokeStyle =
|
|
1071
|
+
e.lineWidth = 2, e.strokeStyle = i.candleUp, e.stroke(E), e.strokeStyle = i.candleDown, e.stroke(D), e.setLineDash([6, 4]), e.strokeStyle = i.textSecondary, e.lineWidth = 1;
|
|
1066
1072
|
let O = new Path2D();
|
|
1067
1073
|
O.moveTo(g.x, h), O.lineTo(g.x + g.width, h), e.stroke(O), e.setLineDash([]);
|
|
1068
1074
|
}
|
|
@@ -1072,81 +1078,84 @@ var bt = class {
|
|
|
1072
1078
|
return i > 0 ? r / i : 0;
|
|
1073
1079
|
}
|
|
1074
1080
|
}, Tt = class {
|
|
1075
|
-
render(e, t,
|
|
1076
|
-
let { from:
|
|
1081
|
+
render(e, t, r, i) {
|
|
1082
|
+
let { from: a, to: o } = r.visibleRange, s = r.barWidth, c = s / 2, l = s + r.barSpacing, u = -r.offset + r.chartRect.x + c, { min: d, max: f } = r.priceRange;
|
|
1077
1083
|
if (f - d === 0) return;
|
|
1078
|
-
let p = (e) => e * l + u, m =
|
|
1079
|
-
for (let e =
|
|
1080
|
-
let n = t[e], r = p(e), i = n.close >= n.open, a = m(Math.max(n.open, n.close)),
|
|
1081
|
-
i ? (h.rect(d, l,
|
|
1084
|
+
let p = (e) => e * l + u, m = n(r), h = new Path2D(), g = new Path2D(), _ = new Path2D(), v = new Path2D();
|
|
1085
|
+
for (let e = a; e <= o && e < t.length; e++) {
|
|
1086
|
+
let n = t[e], r = p(e), i = n.close >= n.open, a = m(Math.max(n.open, n.close)), o = m(Math.min(n.open, n.close)), l = Math.min(a, o), u = Math.max(Math.abs(o - a), 1), d = r - c;
|
|
1087
|
+
i ? (h.rect(d, l, s, u), _.rect(d, l, s, u)) : (g.rect(d, l, s, u), v.rect(d, l, s, u));
|
|
1082
1088
|
}
|
|
1083
|
-
e.fillStyle =
|
|
1089
|
+
e.fillStyle = i.candleUp, e.fill(h), e.fillStyle = i.candleDown, e.fill(g), e.lineWidth = 1, e.strokeStyle = i.candleUp, e.stroke(_), e.strokeStyle = i.candleDown, e.stroke(v);
|
|
1084
1090
|
}
|
|
1085
1091
|
}, Et = class {
|
|
1086
|
-
render(e, t,
|
|
1087
|
-
let { from:
|
|
1092
|
+
render(e, t, r, i) {
|
|
1093
|
+
let { from: a, to: o } = r.visibleRange, s = r.barWidth, c = s / 2, l = s + r.barSpacing, u = -r.offset + r.chartRect.x + c, { min: d, max: f } = r.priceRange;
|
|
1088
1094
|
if (f - d === 0) return;
|
|
1089
|
-
let p = (e) => e * l + u, m =
|
|
1090
|
-
for (let e =
|
|
1091
|
-
let n = t[e], r = p(e), i = n.close >= n.open,
|
|
1092
|
-
if (c.moveTo(r,
|
|
1093
|
-
let t = p(e + 1), n = i ? s :
|
|
1095
|
+
let p = (e) => e * l + u, m = n(r), h = new Path2D(), g = new Path2D();
|
|
1096
|
+
for (let e = a; e <= o && e < t.length; e++) {
|
|
1097
|
+
let n = t[e], r = p(e), i = n.close >= n.open, a = m(n.high), s = m(n.low), c = i ? h : g;
|
|
1098
|
+
if (c.moveTo(r, a), c.lineTo(r, s), e < o && e + 1 < t.length) {
|
|
1099
|
+
let t = p(e + 1), n = i ? s : a;
|
|
1094
1100
|
c.moveTo(r, n), c.lineTo(t, n);
|
|
1095
1101
|
}
|
|
1096
1102
|
}
|
|
1097
|
-
e.strokeStyle =
|
|
1103
|
+
e.strokeStyle = i.candleUp, e.lineWidth = 3, e.stroke(h), e.strokeStyle = i.candleDown, e.lineWidth = 1, e.stroke(g);
|
|
1098
1104
|
}
|
|
1099
1105
|
}, Dt = class {
|
|
1100
1106
|
boxSize = 1;
|
|
1101
1107
|
setBoxSize(e) {
|
|
1102
1108
|
this.boxSize = e;
|
|
1103
1109
|
}
|
|
1104
|
-
render(e, t,
|
|
1105
|
-
let { from:
|
|
1110
|
+
render(e, t, r, i) {
|
|
1111
|
+
let { from: a, to: o } = r.visibleRange, s = r.barWidth, c = s / 2, l = s + r.barSpacing, u = -r.offset + r.chartRect.x + c, { min: d, max: f } = r.priceRange, p = f - d;
|
|
1106
1112
|
if (p === 0) return;
|
|
1107
|
-
let m =
|
|
1108
|
-
for (let e =
|
|
1113
|
+
let m = r.chartRect.height / p, h = (e) => e * l + u, g = n(r), _ = Math.abs(this.boxSize * m), v = Math.min(c * .8, _ * .8) * .5, y = new Path2D(), b = new Path2D();
|
|
1114
|
+
for (let e = a; e <= o && e < t.length; e++) {
|
|
1109
1115
|
let n = t[e], r = h(e), i = n.close >= n.open, a = n.high, o = n.low, s = Math.max(1, Math.round((a - o) / this.boxSize));
|
|
1110
1116
|
for (let e = 0; e < s; e++) {
|
|
1111
1117
|
let t = g(o + (e + .5) * this.boxSize);
|
|
1112
1118
|
i ? (y.moveTo(r - v, t - v), y.lineTo(r + v, t + v), y.moveTo(r + v, t - v), y.lineTo(r - v, t + v)) : (b.moveTo(r + v, t), b.arc(r, t, v, 0, Math.PI * 2));
|
|
1113
1119
|
}
|
|
1114
1120
|
}
|
|
1115
|
-
e.lineWidth = 1.5, e.strokeStyle =
|
|
1121
|
+
e.lineWidth = 1.5, e.strokeStyle = i.candleUp, e.stroke(y), e.strokeStyle = i.candleDown, e.stroke(b);
|
|
1116
1122
|
}
|
|
1117
1123
|
}, Ot = class {
|
|
1118
|
-
render(e, t,
|
|
1119
|
-
let { from:
|
|
1120
|
-
if (
|
|
1121
|
-
if (
|
|
1122
|
-
|
|
1124
|
+
render(e, t, i, a) {
|
|
1125
|
+
let { from: o, to: s } = i.visibleRange, { min: c, max: l } = i.priceRange;
|
|
1126
|
+
if (l - c === 0 || o > s || t.length === 0) return;
|
|
1127
|
+
if (u(i)) {
|
|
1128
|
+
r(e, t, i, a.candleUp, a.candleDown);
|
|
1123
1129
|
return;
|
|
1124
1130
|
}
|
|
1125
|
-
let d =
|
|
1126
|
-
for (let e =
|
|
1131
|
+
let d = i.barWidth + i.barSpacing, f = -i.offset + i.chartRect.x + i.barWidth / 2, p = i.barWidth, m = 0;
|
|
1132
|
+
for (let e = o; e <= s && e < t.length; e++) t[e].volume > m && (m = t[e].volume);
|
|
1127
1133
|
m === 0 && (m = 1);
|
|
1128
|
-
let h =
|
|
1129
|
-
|
|
1130
|
-
let
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1134
|
+
let h = (e) => e * d + f, _ = n(i);
|
|
1135
|
+
v(e, (n) => {
|
|
1136
|
+
let { wick: r } = g(p, n.ratio), i = new Path2D(), c = new Path2D(), l = new Path2D(), u = new Path2D();
|
|
1137
|
+
for (let e = o; e <= s && e < t.length; e++) {
|
|
1138
|
+
let a = t[e], o = a.close >= a.open, s = n.left(h(e), r), d = n.y(_(a.high)), f = n.y(_(a.low));
|
|
1139
|
+
(o ? i : c).rect(s, Math.min(d, f), r, Math.max(Math.abs(f - d), 1));
|
|
1140
|
+
let { body: v } = g(p * Math.max(.2, a.volume / m), n.ratio), y = n.y(_(a.open)), b = n.y(_(a.close));
|
|
1141
|
+
(o ? l : u).rect(s - (v - r) / 2, Math.min(y, b), v, Math.max(Math.abs(b - y), r));
|
|
1142
|
+
}
|
|
1143
|
+
e.fillStyle = a.candleUpWick, e.fill(i), e.fillStyle = a.candleDownWick, e.fill(c), e.fillStyle = a.candleUp, e.fill(l), e.fillStyle = a.candleDown, e.fill(u);
|
|
1144
|
+
});
|
|
1136
1145
|
}
|
|
1137
1146
|
}, kt = class {
|
|
1138
|
-
render(e, t,
|
|
1139
|
-
let { from:
|
|
1140
|
-
if (c -
|
|
1141
|
-
let l =
|
|
1142
|
-
for (let e =
|
|
1147
|
+
render(e, t, r, i) {
|
|
1148
|
+
let { from: a, to: o } = r.visibleRange, { min: s, max: c } = r.priceRange;
|
|
1149
|
+
if (c - s === 0 || a > o || t.length === 0) return;
|
|
1150
|
+
let l = r.barWidth + r.barSpacing, u = -r.offset + r.chartRect.x + r.barWidth / 2, d = r.barWidth, f = 0;
|
|
1151
|
+
for (let e = a; e <= o && e < t.length; e++) t[e].volume > f && (f = t[e].volume);
|
|
1143
1152
|
f === 0 && (f = 1);
|
|
1144
|
-
let p = new Path2D(), m = new Path2D(), h = new Path2D(), g = new Path2D(), _ = (e) => e * l + u, v =
|
|
1145
|
-
for (let e =
|
|
1153
|
+
let p = new Path2D(), m = new Path2D(), h = new Path2D(), g = new Path2D(), _ = (e) => e * l + u, v = n(r);
|
|
1154
|
+
for (let e = a; e <= o && e < t.length; e++) {
|
|
1146
1155
|
let n = t[e], r = e > 0 ? t[e - 1] : n, i = _(e), a = v(n.high), o = v(n.low), s = n.close >= r.close, c = d * Math.max(.15, n.volume / f), l = c / 2, u = Math.min(a, o), y = Math.max(Math.abs(o - a), 1), b = s ? p : m, x = s ? h : g;
|
|
1147
1156
|
b.rect(i - l, u, c, y), x.rect(i - l, u, c, y);
|
|
1148
1157
|
}
|
|
1149
|
-
e.fillStyle = At(
|
|
1158
|
+
e.fillStyle = At(i.candleUp, .55), e.fill(p), e.fillStyle = At(i.candleDown, .55), e.fill(m), e.lineWidth = 1, e.strokeStyle = i.candleUpWick, e.stroke(h), e.strokeStyle = i.candleDownWick, e.stroke(g);
|
|
1150
1159
|
}
|
|
1151
1160
|
};
|
|
1152
1161
|
function At(e, t) {
|
|
@@ -1160,13 +1169,13 @@ function At(e, t) {
|
|
|
1160
1169
|
//#endregion
|
|
1161
1170
|
//#region src/charts/HLCAreaRenderer.ts
|
|
1162
1171
|
var jt = class {
|
|
1163
|
-
render(e, t,
|
|
1164
|
-
let { from:
|
|
1165
|
-
if (
|
|
1166
|
-
let { min:
|
|
1167
|
-
if (c -
|
|
1168
|
-
let l =
|
|
1169
|
-
for (let e =
|
|
1172
|
+
render(e, t, r, i) {
|
|
1173
|
+
let { from: a, to: o } = r.visibleRange;
|
|
1174
|
+
if (a > o || t.length === 0) return;
|
|
1175
|
+
let { min: s, max: c } = r.priceRange;
|
|
1176
|
+
if (c - s === 0) return;
|
|
1177
|
+
let l = r.barWidth + r.barSpacing, u = -r.offset + r.chartRect.x + r.barWidth / 2, d = (e) => e * l + u, f = n(r), p = [], m = [];
|
|
1178
|
+
for (let e = a; e <= o && e < t.length; e++) {
|
|
1170
1179
|
let n = d(e);
|
|
1171
1180
|
p.push({
|
|
1172
1181
|
x: n,
|
|
@@ -1177,72 +1186,72 @@ var jt = class {
|
|
|
1177
1186
|
});
|
|
1178
1187
|
}
|
|
1179
1188
|
if (p.length === 0) return;
|
|
1180
|
-
let h = e.createLinearGradient(0, f(c), 0, f(
|
|
1181
|
-
h.addColorStop(0,
|
|
1189
|
+
let h = e.createLinearGradient(0, f(c), 0, f(s));
|
|
1190
|
+
h.addColorStop(0, i.areaTopColor), h.addColorStop(1, i.areaBottomColor), e.beginPath(), e.moveTo(p[0].x, p[0].y);
|
|
1182
1191
|
for (let t = 1; t < p.length; t++) e.lineTo(p[t].x, p[t].y);
|
|
1183
1192
|
for (let t = m.length - 1; t >= 0; t--) e.lineTo(m[t].x, m[t].y);
|
|
1184
|
-
e.closePath(), e.fillStyle = h, e.fill(), e.beginPath(), e.strokeStyle =
|
|
1185
|
-
for (let n =
|
|
1186
|
-
let r = d(n),
|
|
1187
|
-
n ===
|
|
1193
|
+
e.closePath(), e.fillStyle = h, e.fill(), e.beginPath(), e.strokeStyle = i.lineColor, e.lineWidth = 2, e.lineJoin = "round";
|
|
1194
|
+
for (let n = a; n <= o && n < t.length; n++) {
|
|
1195
|
+
let r = d(n), i = f(t[n].close);
|
|
1196
|
+
n === a ? e.moveTo(r, i) : e.lineTo(r, i);
|
|
1188
1197
|
}
|
|
1189
1198
|
e.stroke();
|
|
1190
1199
|
}
|
|
1191
1200
|
}, Mt = class {
|
|
1192
|
-
render(e, t,
|
|
1193
|
-
let { from:
|
|
1194
|
-
if (
|
|
1195
|
-
let { min:
|
|
1196
|
-
if (c -
|
|
1197
|
-
let l =
|
|
1198
|
-
e.beginPath(), e.strokeStyle =
|
|
1201
|
+
render(e, t, r, i) {
|
|
1202
|
+
let { from: a, to: o } = r.visibleRange;
|
|
1203
|
+
if (a > o || t.length === 0) return;
|
|
1204
|
+
let { min: s, max: c } = r.priceRange;
|
|
1205
|
+
if (c - s === 0) return;
|
|
1206
|
+
let l = r.barWidth + r.barSpacing, u = -r.offset + r.chartRect.x + r.barWidth / 2, d = (e) => e * l + u, f = n(r);
|
|
1207
|
+
e.beginPath(), e.strokeStyle = i.lineColor, e.lineWidth = 2, e.lineJoin = "miter";
|
|
1199
1208
|
let p = 0;
|
|
1200
|
-
for (let n =
|
|
1201
|
-
let r = d(n),
|
|
1202
|
-
n ===
|
|
1209
|
+
for (let n = a; n <= o && n < t.length; n++) {
|
|
1210
|
+
let r = d(n), i = f(t[n].close);
|
|
1211
|
+
n === a ? e.moveTo(r, i) : (e.lineTo(r, p), e.lineTo(r, i)), p = i;
|
|
1203
1212
|
}
|
|
1204
1213
|
e.stroke();
|
|
1205
1214
|
}
|
|
1206
1215
|
}, Nt = class {
|
|
1207
|
-
render(e, t,
|
|
1208
|
-
let { from:
|
|
1209
|
-
if (
|
|
1210
|
-
let { min:
|
|
1211
|
-
if (c -
|
|
1212
|
-
let l =
|
|
1213
|
-
e.beginPath(), e.strokeStyle =
|
|
1216
|
+
render(e, t, r, i) {
|
|
1217
|
+
let { from: a, to: o } = r.visibleRange;
|
|
1218
|
+
if (a > o || t.length === 0) return;
|
|
1219
|
+
let { min: s, max: c } = r.priceRange;
|
|
1220
|
+
if (c - s === 0) return;
|
|
1221
|
+
let l = r.barWidth + r.barSpacing, u = -r.offset + r.chartRect.x + r.barWidth / 2, d = (e) => e * l + u, f = n(r);
|
|
1222
|
+
e.beginPath(), e.strokeStyle = i.lineColor, e.lineWidth = 2, e.lineJoin = "round";
|
|
1214
1223
|
let p = [];
|
|
1215
|
-
for (let n =
|
|
1216
|
-
let r = d(n),
|
|
1224
|
+
for (let n = a; n <= o && n < t.length; n++) {
|
|
1225
|
+
let r = d(n), i = f(t[n].close);
|
|
1217
1226
|
p.push({
|
|
1218
1227
|
x: r,
|
|
1219
|
-
y:
|
|
1220
|
-
}), n ===
|
|
1228
|
+
y: i
|
|
1229
|
+
}), n === a ? e.moveTo(r, i) : e.lineTo(r, i);
|
|
1221
1230
|
}
|
|
1222
1231
|
e.stroke();
|
|
1223
|
-
let m = Math.max(2, Math.min(4,
|
|
1232
|
+
let m = Math.max(2, Math.min(4, r.barWidth * .3)), h = new Path2D();
|
|
1224
1233
|
for (let { x: e, y: t } of p) h.moveTo(e + m, t), h.arc(e, t, m, 0, Math.PI * 2);
|
|
1225
|
-
e.fillStyle =
|
|
1234
|
+
e.fillStyle = i.lineColor, e.fill(h), e.strokeStyle = i.background, e.lineWidth = 1, e.stroke(h);
|
|
1226
1235
|
}
|
|
1227
1236
|
}, Pt = 28, Ft = 3, It = class {
|
|
1228
1237
|
priceText = null;
|
|
1229
1238
|
setPriceText(e) {
|
|
1230
1239
|
this.priceText = e;
|
|
1231
1240
|
}
|
|
1232
|
-
render(e, t,
|
|
1233
|
-
let { from:
|
|
1234
|
-
if (
|
|
1235
|
-
if (
|
|
1236
|
-
|
|
1241
|
+
render(e, t, i, a) {
|
|
1242
|
+
let { from: o, to: s } = i.visibleRange, { min: c, max: l } = i.priceRange;
|
|
1243
|
+
if (l === c) return;
|
|
1244
|
+
if (u(i)) {
|
|
1245
|
+
r(e, t, i, a.candleUp, a.candleDown);
|
|
1237
1246
|
return;
|
|
1238
1247
|
}
|
|
1239
|
-
let d =
|
|
1240
|
-
h && (e.font = `${
|
|
1241
|
-
for (let n = Math.max(0,
|
|
1242
|
-
let r = t[n],
|
|
1243
|
-
if (e.fillStyle = r.close >= r.open ?
|
|
1248
|
+
let d = i.barWidth + i.barSpacing, f = -i.offset + i.chartRect.x + i.barWidth / 2, p = n(i), m = Math.max(1, Math.round(i.barWidth * .6)), h = i.barWidth >= Pt, g = j(c, l), _ = (e) => i.formatPrice?.(e) ?? this.priceText?.(e) ?? M(e, g);
|
|
1249
|
+
h && (e.font = `${a.font.sizeSmall}px ${a.font.family}`, e.textAlign = "center");
|
|
1250
|
+
for (let n = Math.max(0, o); n <= s && n < t.length; n++) {
|
|
1251
|
+
let r = t[n], i = n * d + f, o = Math.min(p(r.high), p(r.low)), s = Math.max(p(r.high), p(r.low));
|
|
1252
|
+
if (e.fillStyle = r.close >= r.open ? a.candleUp : a.candleDown, e.fillRect(Math.round(i - m / 2), o, m, Math.max(1, s - o)), !h) continue;
|
|
1244
1253
|
let c = p(r.high) <= p(r.low);
|
|
1245
|
-
e.textBaseline = "bottom", e.fillText(_(c ? r.high : r.low),
|
|
1254
|
+
e.textBaseline = "bottom", e.fillText(_(c ? r.high : r.low), i, o - Ft), e.textBaseline = "top", e.fillText(_(c ? r.low : r.high), i, s + Ft);
|
|
1246
1255
|
}
|
|
1247
1256
|
}
|
|
1248
1257
|
}, Lt = class {
|
|
@@ -1262,28 +1271,28 @@ var jt = class {
|
|
|
1262
1271
|
}
|
|
1263
1272
|
render(e, t, n, r) {
|
|
1264
1273
|
if (!this.visible || t.length === 0) return;
|
|
1265
|
-
let { from: i, to: a } = n.visibleRange, { chartRect: o } = n, s = n.barWidth, c = s + n.barSpacing,
|
|
1266
|
-
for (let e = i; e <= a && e < t.length; e++) t[e].volume >
|
|
1267
|
-
if (
|
|
1268
|
-
let
|
|
1269
|
-
|
|
1270
|
-
let
|
|
1271
|
-
let i = o.y(
|
|
1274
|
+
let { from: i, to: a } = n.visibleRange, { chartRect: o } = n, s = n.barWidth, c = s + n.barSpacing, l = -n.offset + o.x + s / 2, d = 0;
|
|
1275
|
+
for (let e = i; e <= a && e < t.length; e++) t[e].volume > d && (d = t[e].volume);
|
|
1276
|
+
if (d === 0) return;
|
|
1277
|
+
let f = o.y + o.height, p = o.height * this.heightRatio / d;
|
|
1278
|
+
v(e, (o) => {
|
|
1279
|
+
let d = new Path2D(), m = new Path2D(), _ = o.y(f), v = (e, t, n, r) => {
|
|
1280
|
+
let i = o.y(f - r * p);
|
|
1272
1281
|
_ - i >= 1 && e.rect(t, i, n, _ - i);
|
|
1273
1282
|
};
|
|
1274
|
-
if (
|
|
1283
|
+
if (u(n)) h(t, i, a, (e) => e * c + l, (e) => {
|
|
1275
1284
|
let t = o.x(e.x);
|
|
1276
|
-
v(e.close >= e.open ?
|
|
1285
|
+
v(e.close >= e.open ? d : m, t, Math.max(1, o.x(e.x + 1) - t), e.volume);
|
|
1277
1286
|
});
|
|
1278
1287
|
else {
|
|
1279
|
-
let { body: e, wick: n } =
|
|
1288
|
+
let { body: e, wick: n } = g(s, o.ratio), r = (e - n) / 2;
|
|
1280
1289
|
for (let s = i; s <= a && s < t.length; s++) {
|
|
1281
1290
|
let i = t[s];
|
|
1282
|
-
v(i.close >= i.open ?
|
|
1291
|
+
v(i.close >= i.open ? d : m, o.left(s * c + l, n) - r, e, i.volume);
|
|
1283
1292
|
}
|
|
1284
1293
|
}
|
|
1285
1294
|
let y = Ce(r);
|
|
1286
|
-
e.fillStyle = y.up, e.fill(
|
|
1295
|
+
e.fillStyle = y.up, e.fill(d), e.fillStyle = y.down, e.fill(m);
|
|
1287
1296
|
});
|
|
1288
1297
|
}
|
|
1289
1298
|
}, Rt = class {
|
|
@@ -1310,29 +1319,29 @@ var jt = class {
|
|
|
1310
1319
|
setHighlightPoC(e) {
|
|
1311
1320
|
this.highlightPoC = e;
|
|
1312
1321
|
}
|
|
1313
|
-
render(e, t,
|
|
1322
|
+
render(e, t, r, i) {
|
|
1314
1323
|
if (!this.visible || t.length === 0) return;
|
|
1315
|
-
let { from:
|
|
1316
|
-
if (
|
|
1317
|
-
let
|
|
1318
|
-
for (let e =
|
|
1324
|
+
let { from: a, to: o } = r.visibleRange, { chartRect: s, priceRange: c } = r, u = c.max - c.min;
|
|
1325
|
+
if (u <= 0) return;
|
|
1326
|
+
let d = new Float64Array(this.buckets), f = new Float64Array(this.buckets), p = new Float64Array(this.buckets);
|
|
1327
|
+
for (let e = a; e <= o && e < t.length; e++) {
|
|
1319
1328
|
let n = t[e];
|
|
1320
1329
|
if (n.volume <= 0) continue;
|
|
1321
1330
|
let r = Math.max(n.low, c.min), i = Math.min(n.high, c.max);
|
|
1322
1331
|
if (i <= r) continue;
|
|
1323
|
-
let a = (r - c.min) /
|
|
1324
|
-
for (let e = s; e <=
|
|
1332
|
+
let a = (r - c.min) / u, o = (i - c.min) / u, s = Math.max(0, Math.floor(a * this.buckets)), l = Math.min(this.buckets - 1, Math.floor(o * this.buckets)), m = Math.max(1, l - s + 1), h = n.volume / m, g = n.close >= n.open;
|
|
1333
|
+
for (let e = s; e <= l; e++) d[e] += h, g ? f[e] += h : p[e] += h;
|
|
1325
1334
|
}
|
|
1326
1335
|
let m = 0, h = -1;
|
|
1327
|
-
for (let e = 0; e <
|
|
1336
|
+
for (let e = 0; e < d.length; e++) d[e] > m && (m = d[e], h = e);
|
|
1328
1337
|
if (m === 0) return;
|
|
1329
|
-
let g =
|
|
1338
|
+
let g = s.width * this.widthRatio, _ = s.x + s.width, v = n(r), y = 1 / m;
|
|
1330
1339
|
e.save(), e.globalAlpha = this.opacity;
|
|
1331
1340
|
for (let t = 0; t < this.buckets; t++) {
|
|
1332
|
-
let
|
|
1333
|
-
if (
|
|
1334
|
-
let a =
|
|
1335
|
-
c > 0 && (e.fillStyle =
|
|
1341
|
+
let n = d[t];
|
|
1342
|
+
if (n === 0) continue;
|
|
1343
|
+
let a = l(t, this.buckets, r, v), o = n * y * g, c = f[t] * y * g, u = p[t] * y * g;
|
|
1344
|
+
c > 0 && (e.fillStyle = i.candleUp, e.fillRect(_ - c, a.top + .5, c, a.height - 1)), u > 0 && (e.fillStyle = i.candleDown, e.fillRect(_ - o, a.top + .5, u, a.height - 1)), this.highlightPoC && t === h && (e.globalAlpha = 1, e.strokeStyle = i.crosshair, e.lineWidth = 1, e.setLineDash([3, 2]), e.beginPath(), e.moveTo(s.x, a.mid + .5), e.lineTo(_ - o - 2, a.mid + .5), e.stroke(), e.setLineDash([]), e.globalAlpha = this.opacity);
|
|
1336
1345
|
}
|
|
1337
1346
|
e.restore();
|
|
1338
1347
|
}
|
|
@@ -1457,16 +1466,19 @@ var Wt = class {
|
|
|
1457
1466
|
setLetters(e) {
|
|
1458
1467
|
this.letters = e;
|
|
1459
1468
|
}
|
|
1469
|
+
drawsText() {
|
|
1470
|
+
return this.splitBySession ? this.letters : this.showStats;
|
|
1471
|
+
}
|
|
1460
1472
|
getStats() {
|
|
1461
1473
|
return this.lastStats;
|
|
1462
1474
|
}
|
|
1463
|
-
render(e, t,
|
|
1475
|
+
render(e, t, r, i) {
|
|
1464
1476
|
if (!this.visible || t.length === 0) return;
|
|
1465
|
-
let { from:
|
|
1466
|
-
if (
|
|
1467
|
-
let f = t.slice(
|
|
1477
|
+
let { from: a, to: o } = r.visibleRange, { chartRect: s, priceRange: c } = r, u = Math.max(0, a), d = Math.min(o, t.length - 1);
|
|
1478
|
+
if (d < u) return;
|
|
1479
|
+
let f = t.slice(u, d + 1);
|
|
1468
1480
|
if (this.splitBySession) {
|
|
1469
|
-
this.lastStats = null, this.renderSplit(e, f,
|
|
1481
|
+
this.lastStats = null, this.renderSplit(e, f, u, r, i);
|
|
1470
1482
|
return;
|
|
1471
1483
|
}
|
|
1472
1484
|
let p = Bt(f, c.min, c.max, {
|
|
@@ -1484,55 +1496,55 @@ var Wt = class {
|
|
|
1484
1496
|
val: p.valueAreaLow,
|
|
1485
1497
|
valueAreaPct: this.valueAreaPct
|
|
1486
1498
|
};
|
|
1487
|
-
let h = p.buckets.length, g =
|
|
1499
|
+
let h = p.buckets.length, g = s.width * this.widthRatio, _ = s.x, v = n(r), y = 1 / p.maxCount;
|
|
1488
1500
|
e.save();
|
|
1489
1501
|
for (let t = 0; t < h; t++) {
|
|
1490
|
-
let
|
|
1491
|
-
if (
|
|
1492
|
-
let a =
|
|
1493
|
-
e.globalAlpha = s ? Math.min(1, this.opacity + .18) : this.opacity, e.fillStyle = s ?
|
|
1502
|
+
let n = p.buckets[t];
|
|
1503
|
+
if (n.count === 0) continue;
|
|
1504
|
+
let a = l(t, h, r, v), o = n.count * y * g, s = n.mid >= p.valueAreaLow && n.mid <= p.valueAreaHigh;
|
|
1505
|
+
e.globalAlpha = s ? Math.min(1, this.opacity + .18) : this.opacity, e.fillStyle = s ? i.candleUp : i.textSecondary, e.fillRect(_, a.top + .5, o, a.height - 1);
|
|
1494
1506
|
}
|
|
1495
|
-
e.globalAlpha = .6, e.strokeStyle =
|
|
1507
|
+
e.globalAlpha = .6, e.strokeStyle = i.candleUp, e.lineWidth = 1, e.setLineDash([1, 3]);
|
|
1496
1508
|
for (let t of [p.valueAreaHigh, p.valueAreaLow]) {
|
|
1497
1509
|
let n = v(t);
|
|
1498
|
-
e.beginPath(), e.moveTo(_, Math.round(n) + .5), e.lineTo(
|
|
1510
|
+
e.beginPath(), e.moveTo(_, Math.round(n) + .5), e.lineTo(s.x + s.width, Math.round(n) + .5), e.stroke();
|
|
1499
1511
|
}
|
|
1500
1512
|
if (e.setLineDash([]), this.highlightPoC) {
|
|
1501
1513
|
let t = v(m);
|
|
1502
|
-
e.globalAlpha = 1, e.strokeStyle =
|
|
1514
|
+
e.globalAlpha = 1, e.strokeStyle = i.crosshair, e.lineWidth = 1, e.setLineDash([3, 2]), e.beginPath(), e.moveTo(_, Math.round(t) + .5), e.lineTo(s.x + s.width, Math.round(t) + .5), e.stroke(), e.setLineDash([]);
|
|
1503
1515
|
}
|
|
1504
|
-
this.showStats && this.drawStats(e,
|
|
1516
|
+
this.showStats && this.drawStats(e, s.x + 6, s.y + 6, m, p.valueAreaHigh, p.valueAreaLow, i), e.restore();
|
|
1505
1517
|
}
|
|
1506
|
-
renderSplit(e, t,
|
|
1507
|
-
let { chartRect: o, priceRange: c } =
|
|
1518
|
+
renderSplit(e, t, r, i, a) {
|
|
1519
|
+
let { chartRect: o, priceRange: c } = i, u = Ut(t, c.min, c.max, {
|
|
1508
1520
|
buckets: this.buckets,
|
|
1509
1521
|
valueAreaPct: this.valueAreaPct
|
|
1510
1522
|
});
|
|
1511
|
-
if (
|
|
1512
|
-
let
|
|
1523
|
+
if (u.length === 0) return;
|
|
1524
|
+
let d = n(i), f = i.barWidth / 2;
|
|
1513
1525
|
e.save();
|
|
1514
|
-
for (let
|
|
1515
|
-
let
|
|
1526
|
+
for (let n of u) {
|
|
1527
|
+
let u = n.profile, p = u.buckets.length, m = o.height / p, h = s(r + n.startIndex, i) - f, g = s(r + n.endIndex, i) + f, _ = Math.max(2, g - h), v = 1 / u.maxCount, y = this.letters && m >= 7, b = y ? Ht(t.slice(n.startIndex, n.endIndex + 1), c.min, c.max, this.buckets) : null;
|
|
1516
1528
|
if (y && b) {
|
|
1517
1529
|
e.font = `${Math.min(11, Math.floor(m))}px ui-monospace, monospace`, e.textBaseline = "middle", e.textAlign = "left";
|
|
1518
1530
|
let t = Math.max(1, Math.floor(_ / 6));
|
|
1519
1531
|
for (let n = 0; n < p; n++) {
|
|
1520
|
-
let
|
|
1521
|
-
if (
|
|
1522
|
-
let o =
|
|
1523
|
-
e.globalAlpha = s ? .95 : .6, e.fillStyle = s ?
|
|
1524
|
-
let c = Math.min(
|
|
1525
|
-
for (let t = 0; t < c; t++) e.fillText(Vt(
|
|
1532
|
+
let r = b[n];
|
|
1533
|
+
if (r.length === 0) continue;
|
|
1534
|
+
let o = l(n, p, i, d).mid, s = u.buckets[n].mid >= u.valueAreaLow && u.buckets[n].mid <= u.valueAreaHigh;
|
|
1535
|
+
e.globalAlpha = s ? .95 : .6, e.fillStyle = s ? a.candleUp : a.textSecondary;
|
|
1536
|
+
let c = Math.min(r.length, t);
|
|
1537
|
+
for (let t = 0; t < c; t++) e.fillText(Vt(r[t]), h + t * 6, o);
|
|
1526
1538
|
}
|
|
1527
1539
|
} else for (let t = 0; t < p; t++) {
|
|
1528
|
-
let n =
|
|
1540
|
+
let n = u.buckets[t];
|
|
1529
1541
|
if (n.count === 0) continue;
|
|
1530
|
-
let
|
|
1531
|
-
e.globalAlpha = s ? Math.min(1, this.opacity + .18) : this.opacity, e.fillStyle = s ?
|
|
1542
|
+
let r = l(t, p, i, d), o = n.count * v * _, s = n.mid >= u.valueAreaLow && n.mid <= u.valueAreaHigh;
|
|
1543
|
+
e.globalAlpha = s ? Math.min(1, this.opacity + .18) : this.opacity, e.fillStyle = s ? a.candleUp : a.textSecondary, e.fillRect(h, r.top + .5, o, r.height - 1);
|
|
1532
1544
|
}
|
|
1533
1545
|
if (this.highlightPoC) {
|
|
1534
|
-
let t = u
|
|
1535
|
-
e.globalAlpha = 1, e.strokeStyle =
|
|
1546
|
+
let t = d(u.buckets[u.pocIndex].mid);
|
|
1547
|
+
e.globalAlpha = 1, e.strokeStyle = a.crosshair, e.lineWidth = 1, e.setLineDash([3, 2]), e.beginPath(), e.moveTo(h, Math.round(t) + .5), e.lineTo(Math.min(g, o.x + o.width), Math.round(t) + .5), e.stroke(), e.setLineDash([]);
|
|
1536
1548
|
}
|
|
1537
1549
|
}
|
|
1538
1550
|
e.restore();
|
|
@@ -1708,11 +1720,11 @@ var $t = class {
|
|
|
1708
1720
|
if (!this.visible || t.length === 0) return;
|
|
1709
1721
|
let i = Qt(t, this.left, this.right);
|
|
1710
1722
|
if (i.length === 0) return;
|
|
1711
|
-
let
|
|
1723
|
+
let a = this.structureLabels ? Zt(i) : i, { from: o, to: l } = n.visibleRange;
|
|
1712
1724
|
e.save(), e.font = `10px ${r.font.family}`, e.textAlign = "center";
|
|
1713
|
-
for (let t of
|
|
1714
|
-
if (t.index <
|
|
1715
|
-
let i =
|
|
1725
|
+
for (let t of a) {
|
|
1726
|
+
if (t.index < o - 1 || t.index > l + 1) continue;
|
|
1727
|
+
let i = s(t.index, n), a = c(t.price, n), u = t.type === "high", d = u ? r.candleDown : r.candleUp, f = u !== (n.invertScale === !0), p = f ? a - 8 : a + 8;
|
|
1716
1728
|
e.fillStyle = d, e.beginPath(), f ? (e.moveTo(i - 5, p - 5), e.lineTo(i + 5, p - 5), e.lineTo(i, p)) : (e.moveTo(i - 5, p + 5), e.lineTo(i + 5, p + 5), e.lineTo(i, p)), e.closePath(), e.fill();
|
|
1717
1729
|
let m = this.structureLabels && "label" in t ? String(t.label) : this.showLabels ? n.formatPrice?.(t.price) ?? en(t.price) : null;
|
|
1718
1730
|
m && (e.textBaseline = f ? "bottom" : "top", e.fillText(m, i, f ? p - 5 - 1 : p + 5 + 1));
|
|
@@ -1736,8 +1748,22 @@ var tn = class {
|
|
|
1736
1748
|
time: e,
|
|
1737
1749
|
bids: t.bids.map((e) => ({ ...e })),
|
|
1738
1750
|
asks: t.asks.map((e) => ({ ...e }))
|
|
1739
|
-
}, r = this.
|
|
1740
|
-
|
|
1751
|
+
}, r = this.indexAfter(e);
|
|
1752
|
+
if (r > 0 && this.buffer[r - 1].time === e) {
|
|
1753
|
+
this.buffer[r - 1] = n;
|
|
1754
|
+
return;
|
|
1755
|
+
}
|
|
1756
|
+
this.buffer.splice(r, 0, n), this.buffer.length > this.capacity && (this.buffer = this.buffer.slice(this.buffer.length - this.capacity));
|
|
1757
|
+
}
|
|
1758
|
+
indexAfter(e) {
|
|
1759
|
+
let t = this.buffer;
|
|
1760
|
+
if (t.length === 0 || t[t.length - 1].time <= e) return t.length;
|
|
1761
|
+
let n = 0, r = t.length;
|
|
1762
|
+
for (; n < r;) {
|
|
1763
|
+
let i = n + r >> 1;
|
|
1764
|
+
t[i].time <= e ? n = i + 1 : r = i;
|
|
1765
|
+
}
|
|
1766
|
+
return n;
|
|
1741
1767
|
}
|
|
1742
1768
|
snapshots() {
|
|
1743
1769
|
return this.buffer;
|
|
@@ -1790,7 +1816,7 @@ var tn = class {
|
|
|
1790
1816
|
let a = 1 / i, { chartRect: o } = t, s = Math.max(2, t.barWidth + t.barSpacing), c = o.x, l = o.x + o.width, u = o.y, d = o.y + o.height;
|
|
1791
1817
|
e.save();
|
|
1792
1818
|
for (let i of r) {
|
|
1793
|
-
let r =
|
|
1819
|
+
let r = x(i.time, t);
|
|
1794
1820
|
if (r < c - s || r > l + s) continue;
|
|
1795
1821
|
let o = r - s / 2;
|
|
1796
1822
|
this.drawSide(e, i.bids, n.candleUp, o, s, t, a, u, d), this.drawSide(e, i.asks, n.candleDown, o, s, t, a, u, d);
|
|
@@ -1947,17 +1973,17 @@ var an = class {
|
|
|
1947
1973
|
let i = this.line(t, n, r);
|
|
1948
1974
|
if (!i) return;
|
|
1949
1975
|
e.strokeStyle = t.color, e.lineWidth = t.lineWidth ?? 1.5, e.lineJoin = "round", e.beginPath();
|
|
1950
|
-
let
|
|
1976
|
+
let a = 0, o = null;
|
|
1951
1977
|
for (let t = i.from; t <= i.to; t++) {
|
|
1952
1978
|
let n = i.priceAt(t);
|
|
1953
1979
|
if (n === null) continue;
|
|
1954
|
-
let l =
|
|
1955
|
-
|
|
1980
|
+
let l = s(t, r), u = c(n, r);
|
|
1981
|
+
a === 0 ? e.moveTo(l, u) : e.lineTo(l, u), (a === 2 || a === 0 && o === null) && (o = {
|
|
1956
1982
|
x: l + 4,
|
|
1957
1983
|
y: u - 4
|
|
1958
|
-
}),
|
|
1984
|
+
}), a++;
|
|
1959
1985
|
}
|
|
1960
|
-
e.stroke(),
|
|
1986
|
+
e.stroke(), o && (e.fillStyle = t.color, e.font = "bold 10px sans-serif", e.textBaseline = "bottom", e.textAlign = "left", e.fillText(t.label, o.x, o.y));
|
|
1961
1987
|
}
|
|
1962
1988
|
};
|
|
1963
1989
|
//#endregion
|
|
@@ -2282,17 +2308,17 @@ function Sn(e, t, n, r) {
|
|
|
2282
2308
|
function Cn(e) {
|
|
2283
2309
|
return !!e?.some((e) => e.kind === "histogram");
|
|
2284
2310
|
}
|
|
2285
|
-
function wn(e, t,
|
|
2286
|
-
let
|
|
2287
|
-
if (!
|
|
2288
|
-
let
|
|
2289
|
-
if (c <
|
|
2290
|
-
let l =
|
|
2291
|
-
for (let t = 0; t <
|
|
2292
|
-
let
|
|
2311
|
+
function wn(e, t, r, i, a) {
|
|
2312
|
+
let o = t.series;
|
|
2313
|
+
if (!o) return;
|
|
2314
|
+
let s = Math.max(0, r.visibleRange.from), c = Math.min(r.visibleRange.to, o.length - 1);
|
|
2315
|
+
if (c < s) return;
|
|
2316
|
+
let l = n(r);
|
|
2317
|
+
for (let t = 0; t < a.length; t++) {
|
|
2318
|
+
let n = a[t], u = i.lineWidths[t] ?? i.lineWidths[0] ?? 1.5, d = n.kind ?? "line", f = n.tone && n.downColor !== void 0 ? [!0, !1] : [null];
|
|
2293
2319
|
for (let t of f) {
|
|
2294
|
-
let
|
|
2295
|
-
d === "histogram" ? On(e,
|
|
2320
|
+
let a = i.colors[n.color] ?? i.colors[0], f = t === !1 ? i.colors[n.downColor] ?? a : a, p = (e) => t === null || vn(n, e) === t;
|
|
2321
|
+
d === "histogram" ? On(e, o, n.key, s, c, r, l, f, p) : d === "dots" ? Dn(e, o, n.key, s, c, r, l, f, p) : En(e, o, n.key, s, c, r, l, f, u, d === "step", t === null ? null : p);
|
|
2296
2322
|
}
|
|
2297
2323
|
}
|
|
2298
2324
|
}
|
|
@@ -2300,58 +2326,58 @@ function Tn(e, t) {
|
|
|
2300
2326
|
let n = e?.[t];
|
|
2301
2327
|
return n !== void 0 && Number.isFinite(n) ? n : void 0;
|
|
2302
2328
|
}
|
|
2303
|
-
function En(e, t, n, r, i,
|
|
2304
|
-
let f = new L(e, c, l, I(
|
|
2329
|
+
function En(e, t, n, r, i, a, o, c, l, u, d) {
|
|
2330
|
+
let f = new L(e, c, l, I(a)), p = 0, m = 0, h = !1;
|
|
2305
2331
|
for (let e = r; e <= i; e++) {
|
|
2306
2332
|
let r = t[e], i = Tn(r, n);
|
|
2307
2333
|
if (i === void 0) {
|
|
2308
2334
|
h = !1, f.gap();
|
|
2309
2335
|
continue;
|
|
2310
2336
|
}
|
|
2311
|
-
let c =
|
|
2337
|
+
let c = s(e, a), l = o(i);
|
|
2312
2338
|
d ? h && d(r) && (u ? (f.segment(p, m, c, m), f.add(c, l)) : f.segment(p, m, c, l)) : (h && u && f.add(c, m), f.add(c, l)), p = c, m = l, h = !0;
|
|
2313
2339
|
}
|
|
2314
2340
|
f.finish();
|
|
2315
2341
|
}
|
|
2316
|
-
function Dn(e, t, n, r, i,
|
|
2317
|
-
let u = Math.max(1.5,
|
|
2342
|
+
function Dn(e, t, n, r, i, a, o, c, l) {
|
|
2343
|
+
let u = Math.max(1.5, a.barWidth * .15), d = I(a), f = NaN;
|
|
2318
2344
|
e.beginPath(), e.fillStyle = c;
|
|
2319
2345
|
for (let c = r; c <= i; c++) {
|
|
2320
2346
|
let r = t[c], i = Tn(r, n);
|
|
2321
2347
|
if (i === void 0 || !l(r)) continue;
|
|
2322
|
-
let p =
|
|
2348
|
+
let p = s(c, a);
|
|
2323
2349
|
if (d) {
|
|
2324
2350
|
let e = Math.floor(p);
|
|
2325
2351
|
if (e === f) continue;
|
|
2326
2352
|
f = e;
|
|
2327
2353
|
}
|
|
2328
|
-
let m =
|
|
2354
|
+
let m = o(i);
|
|
2329
2355
|
e.moveTo(p + u, m), e.arc(p, m, u, 0, Math.PI * 2);
|
|
2330
2356
|
}
|
|
2331
2357
|
e.fill();
|
|
2332
2358
|
}
|
|
2333
|
-
function On(e, t, n, r, i,
|
|
2334
|
-
let u =
|
|
2335
|
-
if (e.beginPath(), e.fillStyle = c, I(
|
|
2359
|
+
function On(e, t, n, r, i, a, o, c, l) {
|
|
2360
|
+
let u = o(0);
|
|
2361
|
+
if (e.beginPath(), e.fillStyle = c, I(a)) {
|
|
2336
2362
|
let c = NaN, d = 0, f = () => {
|
|
2337
2363
|
if (Number.isNaN(c)) return;
|
|
2338
|
-
let t =
|
|
2364
|
+
let t = o(d);
|
|
2339
2365
|
e.rect(c, Math.min(t, u), 1, Math.max(1, Math.abs(t - u)));
|
|
2340
2366
|
};
|
|
2341
2367
|
for (let e = r; e <= i; e++) {
|
|
2342
2368
|
let r = t[e], i = Tn(r, n);
|
|
2343
2369
|
if (i === void 0 || !l(r)) continue;
|
|
2344
|
-
let
|
|
2345
|
-
|
|
2370
|
+
let o = Math.floor(s(e, a));
|
|
2371
|
+
o === c ? Math.abs(i) > Math.abs(d) && (d = i) : (f(), c = o, d = i);
|
|
2346
2372
|
}
|
|
2347
2373
|
f(), e.fill();
|
|
2348
2374
|
return;
|
|
2349
2375
|
}
|
|
2350
|
-
let d = Math.max(1,
|
|
2376
|
+
let d = Math.max(1, a.barWidth);
|
|
2351
2377
|
for (let c = r; c <= i; c++) {
|
|
2352
2378
|
let r = t[c], i = Tn(r, n);
|
|
2353
2379
|
if (i === void 0 || !l(r)) continue;
|
|
2354
|
-
let f =
|
|
2380
|
+
let f = s(c, a), p = o(i);
|
|
2355
2381
|
e.rect(f - d / 2, Math.min(p, u), d, Math.max(1, Math.abs(p - u)));
|
|
2356
2382
|
}
|
|
2357
2383
|
e.fill();
|
|
@@ -2398,12 +2424,12 @@ var R = class {
|
|
|
2398
2424
|
}
|
|
2399
2425
|
}
|
|
2400
2426
|
valuesToPoints(e, t, n, r) {
|
|
2401
|
-
let i = [], { from:
|
|
2402
|
-
for (let l =
|
|
2403
|
-
let
|
|
2404
|
-
|
|
2405
|
-
x:
|
|
2406
|
-
y: c(
|
|
2427
|
+
let i = [], { from: a, to: o } = r.visibleRange;
|
|
2428
|
+
for (let l = a; l <= o && l < n.length; l++) {
|
|
2429
|
+
let a = e.values.get(n[l].time);
|
|
2430
|
+
a && a[t] !== void 0 && i.push({
|
|
2431
|
+
x: s(l, r),
|
|
2432
|
+
y: c(a[t], r)
|
|
2407
2433
|
});
|
|
2408
2434
|
}
|
|
2409
2435
|
return i;
|
|
@@ -2974,12 +3000,12 @@ var Bn = class extends R {
|
|
|
2974
3000
|
render(e, t, n, r) {
|
|
2975
3001
|
let i = t.series;
|
|
2976
3002
|
if (!i) return;
|
|
2977
|
-
let { from:
|
|
2978
|
-
for (let e =
|
|
3003
|
+
let { from: a, to: o } = n.visibleRange, l = new L(e, r.colors[0], r.lineWidths[0], I(n));
|
|
3004
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
2979
3005
|
let t = i[e];
|
|
2980
3006
|
if (!t || t.value === void 0) continue;
|
|
2981
|
-
let r =
|
|
2982
|
-
l.add(r,
|
|
3007
|
+
let r = s(e, n), a = c(t.value, n);
|
|
3008
|
+
l.add(r, a);
|
|
2983
3009
|
}
|
|
2984
3010
|
l.finish();
|
|
2985
3011
|
}
|
|
@@ -3028,12 +3054,12 @@ var Bn = class extends R {
|
|
|
3028
3054
|
render(e, t, n, r) {
|
|
3029
3055
|
let i = t.series;
|
|
3030
3056
|
if (!i) return;
|
|
3031
|
-
let { from:
|
|
3032
|
-
for (let e =
|
|
3057
|
+
let { from: a, to: o } = n.visibleRange, l = new L(e, r.colors[0], r.lineWidths[0], I(n));
|
|
3058
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
3033
3059
|
let t = i[e];
|
|
3034
3060
|
if (!t || t.value === void 0) continue;
|
|
3035
|
-
let r =
|
|
3036
|
-
l.add(r,
|
|
3061
|
+
let r = s(e, n), a = c(t.value, n);
|
|
3062
|
+
l.add(r, a);
|
|
3037
3063
|
}
|
|
3038
3064
|
l.finish();
|
|
3039
3065
|
}
|
|
@@ -3114,10 +3140,10 @@ var Bn = class extends R {
|
|
|
3114
3140
|
render(e, t, n, r) {
|
|
3115
3141
|
let i = t.series;
|
|
3116
3142
|
if (!i) return;
|
|
3117
|
-
let { from:
|
|
3118
|
-
for (let e =
|
|
3143
|
+
let { from: a, to: o } = n.visibleRange, l = 0, u = o - a + 1, d = new Float64Array(u), f = new Float64Array(u), p = new Float64Array(u), m = new Float64Array(u);
|
|
3144
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
3119
3145
|
let t = i[e];
|
|
3120
|
-
!t || t.upper === void 0 || (d[l] =
|
|
3146
|
+
!t || t.upper === void 0 || (d[l] = s(e, n), f[l] = c(t.upper, n), p[l] = c(t.middle, n), m[l] = c(t.lower, n), l++);
|
|
3121
3147
|
}
|
|
3122
3148
|
if (l < 2) return;
|
|
3123
3149
|
let h = I(n), g = d.subarray(0, l);
|
|
@@ -3165,12 +3191,12 @@ var Bn = class extends R {
|
|
|
3165
3191
|
render(e, t, n, r) {
|
|
3166
3192
|
let i = t.series;
|
|
3167
3193
|
if (!i) return;
|
|
3168
|
-
let { from:
|
|
3169
|
-
for (let e =
|
|
3194
|
+
let { from: a, to: o } = n.visibleRange, l = new L(e, r.colors[0], r.lineWidths[0], I(n));
|
|
3195
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
3170
3196
|
let t = i[e];
|
|
3171
3197
|
if (!t || t.value === void 0) continue;
|
|
3172
|
-
let r =
|
|
3173
|
-
l.add(r,
|
|
3198
|
+
let r = s(e, n), a = c(t.value, n);
|
|
3199
|
+
l.add(r, a);
|
|
3174
3200
|
}
|
|
3175
3201
|
l.finish();
|
|
3176
3202
|
}
|
|
@@ -3234,11 +3260,11 @@ var Bn = class extends R {
|
|
|
3234
3260
|
render(e, t, n, r) {
|
|
3235
3261
|
let i = t.series;
|
|
3236
3262
|
if (!i) return;
|
|
3237
|
-
let { from:
|
|
3238
|
-
for (let e =
|
|
3263
|
+
let { from: a, to: o } = n.visibleRange, l = o - a + 1, u = new Float64Array(l), d = new Float64Array(l), f = 0, p = new Float64Array(l), m = new Float64Array(l), h = 0, g = new Float64Array(l), _ = new Float64Array(l), v = 0, y = new Float64Array(l), b = new Float64Array(l), x = 0;
|
|
3264
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
3239
3265
|
let t = i[e];
|
|
3240
3266
|
if (!t) continue;
|
|
3241
|
-
let r =
|
|
3267
|
+
let r = s(e, n);
|
|
3242
3268
|
t.tenkan !== void 0 && (u[f] = r, d[f] = c(t.tenkan, n), f++), t.kijun !== void 0 && (p[h] = r, m[h] = c(t.kijun, n), h++), t.senkouA !== void 0 && (g[v] = r, _[v] = c(t.senkouA, n), v++), t.senkouB !== void 0 && (y[x] = r, b[x] = c(t.senkouB, n), x++);
|
|
3243
3269
|
}
|
|
3244
3270
|
if (v > 1 && x > 1) {
|
|
@@ -3304,12 +3330,12 @@ var Bn = class extends R {
|
|
|
3304
3330
|
render(e, t, n, r) {
|
|
3305
3331
|
let i = t.series;
|
|
3306
3332
|
if (!i) return;
|
|
3307
|
-
let { from:
|
|
3308
|
-
for (let t =
|
|
3309
|
-
let
|
|
3310
|
-
if (!
|
|
3311
|
-
let
|
|
3312
|
-
e.beginPath(), e.arc(
|
|
3333
|
+
let { from: a, to: o } = n.visibleRange, l = Math.max(1.5, n.barWidth * .15);
|
|
3334
|
+
for (let t = a; t <= o && t < i.length; t++) {
|
|
3335
|
+
let a = i[t];
|
|
3336
|
+
if (!a || a.value === void 0) continue;
|
|
3337
|
+
let o = s(t, n), u = c(a.value, n);
|
|
3338
|
+
e.beginPath(), e.arc(o, u, l, 0, Math.PI * 2), e.fillStyle = a.trend === 1 ? r.colors[0] : r.colors[1] ?? "#e8505b", e.fill();
|
|
3313
3339
|
}
|
|
3314
3340
|
}
|
|
3315
3341
|
}, Kn = class extends R {
|
|
@@ -3360,14 +3386,14 @@ var Bn = class extends R {
|
|
|
3360
3386
|
render(e, t, n, r) {
|
|
3361
3387
|
let i = t.series;
|
|
3362
3388
|
if (!i) return;
|
|
3363
|
-
let { from:
|
|
3389
|
+
let { from: a, to: o } = n.visibleRange, l = r.colors[0], u = r.colors[1] ?? "#e8505b", d = I(n), f = r.lineWidths[0] + .5;
|
|
3364
3390
|
for (let [t, r] of [[l, 1], [u, -1]]) {
|
|
3365
3391
|
let l = new L(e, t, f, d), u = 0, p = 0, m = !1;
|
|
3366
|
-
for (let e =
|
|
3392
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
3367
3393
|
let t = i[e];
|
|
3368
3394
|
if (!t || t.value === void 0) continue;
|
|
3369
|
-
let
|
|
3370
|
-
m && (t.trend ?? 1) === r && l.segment(u, p,
|
|
3395
|
+
let a = s(e, n), o = c(t.value, n);
|
|
3396
|
+
m && (t.trend ?? 1) === r && l.segment(u, p, a, o), u = a, p = o, m = !0;
|
|
3371
3397
|
}
|
|
3372
3398
|
l.finish();
|
|
3373
3399
|
}
|
|
@@ -3429,11 +3455,11 @@ var Bn = class extends R {
|
|
|
3429
3455
|
render(e, t, n, r) {
|
|
3430
3456
|
let i = t.series;
|
|
3431
3457
|
if (!i) return;
|
|
3432
|
-
let { from:
|
|
3433
|
-
for (let e =
|
|
3458
|
+
let { from: a, to: o } = n.visibleRange, l = [], u = [], d = [];
|
|
3459
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
3434
3460
|
let t = i[e];
|
|
3435
3461
|
if (!t) continue;
|
|
3436
|
-
let r =
|
|
3462
|
+
let r = s(e, n);
|
|
3437
3463
|
t.upper !== void 0 && l.push({
|
|
3438
3464
|
x: r,
|
|
3439
3465
|
y: c(t.upper, n)
|
|
@@ -3492,11 +3518,11 @@ var Bn = class extends R {
|
|
|
3492
3518
|
render(e, t, n, r) {
|
|
3493
3519
|
let i = t.series;
|
|
3494
3520
|
if (!i) return;
|
|
3495
|
-
let { from:
|
|
3496
|
-
for (let e =
|
|
3521
|
+
let { from: a, to: o } = n.visibleRange, l = [], u = [], d = [];
|
|
3522
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
3497
3523
|
let t = i[e];
|
|
3498
3524
|
if (!t) continue;
|
|
3499
|
-
let r =
|
|
3525
|
+
let r = s(e, n);
|
|
3500
3526
|
t.upper !== void 0 && l.push({
|
|
3501
3527
|
x: r,
|
|
3502
3528
|
y: c(t.upper, n)
|
|
@@ -3591,15 +3617,15 @@ var Bn = class extends R {
|
|
|
3591
3617
|
render(e, t, n, r) {
|
|
3592
3618
|
let i = t.series;
|
|
3593
3619
|
if (!i) return;
|
|
3594
|
-
let { from:
|
|
3620
|
+
let { from: a, to: o } = n.visibleRange, l = r.colors[0], u = r.colors[1] ?? "#e8505b", d = r.colors[2] ?? "#1fa874", f = r.lineWidths[0], p = (e) => e === "pp" ? l : e.startsWith("r") ? u : d;
|
|
3595
3621
|
for (let t of Yn) {
|
|
3596
3622
|
e.beginPath(), e.strokeStyle = p(t), e.lineWidth = t === "pp" ? f : Math.max(1, f - 1), t !== "pp" && e.setLineDash([4, 3]);
|
|
3597
3623
|
let r = !1;
|
|
3598
|
-
for (let l =
|
|
3599
|
-
let
|
|
3600
|
-
if (
|
|
3601
|
-
let
|
|
3602
|
-
r ? e.lineTo(
|
|
3624
|
+
for (let l = a; l <= o && l < i.length; l++) {
|
|
3625
|
+
let a = i[l]?.[t];
|
|
3626
|
+
if (a === void 0) continue;
|
|
3627
|
+
let o = s(l, n), u = c(a, n);
|
|
3628
|
+
r ? e.lineTo(o, u) : (e.moveTo(o, u), r = !0);
|
|
3603
3629
|
}
|
|
3604
3630
|
e.stroke(), e.setLineDash([]);
|
|
3605
3631
|
}
|
|
@@ -3639,12 +3665,12 @@ var Bn = class extends R {
|
|
|
3639
3665
|
render(e, t, n, r) {
|
|
3640
3666
|
let i = t.series;
|
|
3641
3667
|
if (!i) return;
|
|
3642
|
-
let { from:
|
|
3643
|
-
for (let e =
|
|
3668
|
+
let { from: a, to: o } = n.visibleRange, l = new L(e, r.colors[0], r.lineWidths[0], I(n));
|
|
3669
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
3644
3670
|
let t = i[e];
|
|
3645
3671
|
if (!t || t.value === void 0) continue;
|
|
3646
|
-
let r =
|
|
3647
|
-
l.add(r,
|
|
3672
|
+
let r = s(e, n), a = c(t.value, n);
|
|
3673
|
+
l.add(r, a);
|
|
3648
3674
|
}
|
|
3649
3675
|
l.finish();
|
|
3650
3676
|
}
|
|
@@ -3713,8 +3739,8 @@ var Bn = class extends R {
|
|
|
3713
3739
|
if (!(!i || i.length < 2)) {
|
|
3714
3740
|
e.beginPath(), e.strokeStyle = r.colors[0], e.lineWidth = r.lineWidths[0], e.lineJoin = "round";
|
|
3715
3741
|
for (let t = 0; t < i.length; t++) {
|
|
3716
|
-
let r = i[t],
|
|
3717
|
-
t === 0 ? e.moveTo(
|
|
3742
|
+
let r = i[t], a = s(r.idx, n), o = c(r.price, n);
|
|
3743
|
+
t === 0 ? e.moveTo(a, o) : e.lineTo(a, o);
|
|
3718
3744
|
}
|
|
3719
3745
|
e.stroke();
|
|
3720
3746
|
}
|
|
@@ -3784,11 +3810,11 @@ var Bn = class extends R {
|
|
|
3784
3810
|
render(e, t, n, r) {
|
|
3785
3811
|
let i = t.series;
|
|
3786
3812
|
if (!i) return;
|
|
3787
|
-
let { from:
|
|
3788
|
-
for (let e =
|
|
3813
|
+
let { from: a, to: o } = n.visibleRange, l = [], u = [], d = [];
|
|
3814
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
3789
3815
|
let t = i[e];
|
|
3790
3816
|
if (!t) continue;
|
|
3791
|
-
let r =
|
|
3817
|
+
let r = s(e, n);
|
|
3792
3818
|
t.middle !== void 0 && u.push({
|
|
3793
3819
|
x: r,
|
|
3794
3820
|
y: c(t.middle, n)
|
|
@@ -3839,12 +3865,12 @@ var Bn = class extends R {
|
|
|
3839
3865
|
render(e, t, n, r) {
|
|
3840
3866
|
let i = t.series;
|
|
3841
3867
|
if (!i) return;
|
|
3842
|
-
let { from:
|
|
3843
|
-
for (let e =
|
|
3868
|
+
let { from: a, to: o } = n.visibleRange, l = new L(e, r.colors[0], r.lineWidths[0], I(n));
|
|
3869
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
3844
3870
|
let t = i[e];
|
|
3845
3871
|
if (!t || t.value === void 0) continue;
|
|
3846
|
-
let r =
|
|
3847
|
-
l.add(r,
|
|
3872
|
+
let r = s(e, n), a = c(t.value, n);
|
|
3873
|
+
l.add(r, a);
|
|
3848
3874
|
}
|
|
3849
3875
|
l.finish();
|
|
3850
3876
|
}
|
|
@@ -3923,12 +3949,12 @@ var rr = class extends R {
|
|
|
3923
3949
|
render(e, t, n, r) {
|
|
3924
3950
|
let i = t.series;
|
|
3925
3951
|
if (!i) return;
|
|
3926
|
-
let { from:
|
|
3927
|
-
for (let e =
|
|
3952
|
+
let { from: a, to: o } = n.visibleRange, l = new L(e, r.colors[0], r.lineWidths[0], I(n));
|
|
3953
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
3928
3954
|
let t = i[e];
|
|
3929
3955
|
if (!t || t.value === void 0) continue;
|
|
3930
|
-
let r =
|
|
3931
|
-
l.add(r,
|
|
3956
|
+
let r = s(e, n), a = c(t.value, n);
|
|
3957
|
+
l.add(r, a);
|
|
3932
3958
|
}
|
|
3933
3959
|
l.finish();
|
|
3934
3960
|
}
|
|
@@ -4013,18 +4039,18 @@ var rr = class extends R {
|
|
|
4013
4039
|
for (let t = 1; t <= 3; t++) this.strokeBandSeries(e, i, n, a, o, (e) => e[`u${t}`]), this.strokeBandSeries(e, i, n, a, o, (e) => e[`l${t}`]);
|
|
4014
4040
|
e.setLineDash([]), e.globalAlpha = 1, e.strokeStyle = r.colors[0], e.lineWidth = r.lineWidths[0], e.lineJoin = "round", this.strokeBandSeries(e, i, n, a, o, (e) => e.value);
|
|
4015
4041
|
}
|
|
4016
|
-
strokeBandSeries(e, t, n, r, i,
|
|
4017
|
-
let
|
|
4042
|
+
strokeBandSeries(e, t, n, r, i, a) {
|
|
4043
|
+
let o = new L(e, String(e.strokeStyle), e.lineWidth, I(n)), l;
|
|
4018
4044
|
for (let e = r; e <= i && e < t.length; e++) {
|
|
4019
|
-
let r = t[e], i = r ?
|
|
4045
|
+
let r = t[e], i = r ? a(r) : void 0;
|
|
4020
4046
|
if (r === null || i === void 0) {
|
|
4021
|
-
|
|
4047
|
+
o.gap();
|
|
4022
4048
|
continue;
|
|
4023
4049
|
}
|
|
4024
|
-
let u =
|
|
4025
|
-
r.session !== l &&
|
|
4050
|
+
let u = s(e, n), d = c(i, n);
|
|
4051
|
+
r.session !== l && o.gap(), o.add(u, d), l = r.session;
|
|
4026
4052
|
}
|
|
4027
|
-
|
|
4053
|
+
o.finish();
|
|
4028
4054
|
}
|
|
4029
4055
|
}, ar = class extends R {
|
|
4030
4056
|
descriptor = {
|
|
@@ -4078,17 +4104,17 @@ var rr = class extends R {
|
|
|
4078
4104
|
render(e, t, n, r) {
|
|
4079
4105
|
let i = t.series;
|
|
4080
4106
|
if (!i) return;
|
|
4081
|
-
let { from:
|
|
4107
|
+
let { from: a, to: o } = n.visibleRange, l = (t, l) => {
|
|
4082
4108
|
e.beginPath(), e.strokeStyle = l, e.lineWidth = r.lineWidths[0], e.lineJoin = "round", e.setLineDash([5, 3]);
|
|
4083
4109
|
let u = !1;
|
|
4084
|
-
for (let r =
|
|
4085
|
-
let
|
|
4086
|
-
if (!
|
|
4110
|
+
for (let r = a; r <= o && r < i.length; r++) {
|
|
4111
|
+
let a = i[r];
|
|
4112
|
+
if (!a || a[t] === void 0) {
|
|
4087
4113
|
u = !1;
|
|
4088
4114
|
continue;
|
|
4089
4115
|
}
|
|
4090
|
-
let
|
|
4091
|
-
u ? e.lineTo(
|
|
4116
|
+
let o = s(r, n), l = c(a[t], n);
|
|
4117
|
+
u ? e.lineTo(o, l) : (e.moveTo(o, l), u = !0);
|
|
4092
4118
|
}
|
|
4093
4119
|
e.stroke(), e.setLineDash([]);
|
|
4094
4120
|
};
|
|
@@ -4147,16 +4173,16 @@ var rr = class extends R {
|
|
|
4147
4173
|
render(e, t, n, r) {
|
|
4148
4174
|
let i = t.series;
|
|
4149
4175
|
if (!i) return;
|
|
4150
|
-
let { from:
|
|
4176
|
+
let { from: a, to: o } = n.visibleRange, l = (t, l) => {
|
|
4151
4177
|
let u = new L(e, l, r.lineWidths[0], I(n));
|
|
4152
|
-
for (let e =
|
|
4178
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
4153
4179
|
let r = i[e];
|
|
4154
4180
|
if (!r || r[t] === void 0) {
|
|
4155
4181
|
u.gap();
|
|
4156
4182
|
continue;
|
|
4157
4183
|
}
|
|
4158
|
-
let
|
|
4159
|
-
u.add(
|
|
4184
|
+
let a = s(e, n), o = c(r[t], n);
|
|
4185
|
+
u.add(a, o);
|
|
4160
4186
|
}
|
|
4161
4187
|
u.finish();
|
|
4162
4188
|
};
|
|
@@ -4227,12 +4253,12 @@ var cr = class extends R {
|
|
|
4227
4253
|
render(e, t, n, r) {
|
|
4228
4254
|
let i = t.series;
|
|
4229
4255
|
if (!i) return;
|
|
4230
|
-
let { from:
|
|
4231
|
-
for (let e =
|
|
4256
|
+
let { from: a, to: o } = n.visibleRange, l = new L(e, r.colors[0], r.lineWidths[0], I(n));
|
|
4257
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
4232
4258
|
let t = i[e];
|
|
4233
4259
|
if (!t || t.value === void 0) continue;
|
|
4234
|
-
let r =
|
|
4235
|
-
l.add(r,
|
|
4260
|
+
let r = s(e, n), a = c(t.value, n);
|
|
4261
|
+
l.add(r, a);
|
|
4236
4262
|
}
|
|
4237
4263
|
l.finish();
|
|
4238
4264
|
}
|
|
@@ -4284,12 +4310,12 @@ var cr = class extends R {
|
|
|
4284
4310
|
render(e, t, n, r) {
|
|
4285
4311
|
let i = t.series;
|
|
4286
4312
|
if (!i) return;
|
|
4287
|
-
let { from:
|
|
4288
|
-
for (let e =
|
|
4313
|
+
let { from: a, to: o } = n.visibleRange, l = new L(e, r.colors[0], r.lineWidths[0], I(n));
|
|
4314
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
4289
4315
|
let t = i[e];
|
|
4290
4316
|
if (!t || t.value === void 0) continue;
|
|
4291
|
-
let r =
|
|
4292
|
-
l.add(r,
|
|
4317
|
+
let r = s(e, n), a = c(t.value, n);
|
|
4318
|
+
l.add(r, a);
|
|
4293
4319
|
}
|
|
4294
4320
|
l.finish();
|
|
4295
4321
|
}
|
|
@@ -4360,11 +4386,11 @@ var cr = class extends R {
|
|
|
4360
4386
|
render(e, t, n, r) {
|
|
4361
4387
|
let i = t.series;
|
|
4362
4388
|
if (!i) return;
|
|
4363
|
-
let { from:
|
|
4364
|
-
for (let e =
|
|
4389
|
+
let { from: a, to: o } = n.visibleRange, l = [], u = [], d = [];
|
|
4390
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
4365
4391
|
let t = i[e];
|
|
4366
4392
|
if (!t || t.upper === void 0) continue;
|
|
4367
|
-
let r =
|
|
4393
|
+
let r = s(e, n);
|
|
4368
4394
|
l.push({
|
|
4369
4395
|
x: r,
|
|
4370
4396
|
y: c(t.upper, n)
|
|
@@ -4438,12 +4464,12 @@ var mr = class extends R {
|
|
|
4438
4464
|
render(e, t, n, r) {
|
|
4439
4465
|
let i = t.series;
|
|
4440
4466
|
if (!i) return;
|
|
4441
|
-
let { from:
|
|
4442
|
-
for (let e =
|
|
4467
|
+
let { from: a, to: o } = n.visibleRange, l = new L(e, r.colors[0], r.lineWidths[0], I(n));
|
|
4468
|
+
for (let e = a; e <= o && e < i.length; e++) {
|
|
4443
4469
|
let t = i[e];
|
|
4444
4470
|
if (!t || t.value === void 0) continue;
|
|
4445
|
-
let r =
|
|
4446
|
-
l.add(r,
|
|
4471
|
+
let r = s(e, n), a = c(t.value, n);
|
|
4472
|
+
l.add(r, a);
|
|
4447
4473
|
}
|
|
4448
4474
|
l.finish();
|
|
4449
4475
|
}
|
|
@@ -5616,25 +5642,25 @@ var Hr = class extends R {
|
|
|
5616
5642
|
series: i
|
|
5617
5643
|
};
|
|
5618
5644
|
}
|
|
5619
|
-
render(e, t,
|
|
5620
|
-
let
|
|
5621
|
-
if (!
|
|
5622
|
-
let o = Math.max(0,
|
|
5645
|
+
render(e, t, r, i) {
|
|
5646
|
+
let a = t.series;
|
|
5647
|
+
if (!a) return;
|
|
5648
|
+
let o = Math.max(0, r.visibleRange.from), c = Math.min(r.visibleRange.to, a.length - 1), l = n(r), u = l(0), d = Math.max(1, r.barWidth / 2), f = [[
|
|
5623
5649
|
"bull",
|
|
5624
|
-
|
|
5650
|
+
i.colors[0],
|
|
5625
5651
|
-d
|
|
5626
5652
|
], [
|
|
5627
5653
|
"bear",
|
|
5628
|
-
|
|
5654
|
+
i.colors[1] ?? i.colors[0],
|
|
5629
5655
|
0
|
|
5630
5656
|
]];
|
|
5631
|
-
for (let [t,
|
|
5632
|
-
e.beginPath(), e.fillStyle =
|
|
5633
|
-
for (let
|
|
5634
|
-
let o =
|
|
5657
|
+
for (let [t, n, i] of f) {
|
|
5658
|
+
e.beginPath(), e.fillStyle = n;
|
|
5659
|
+
for (let n = o; n <= c; n++) {
|
|
5660
|
+
let o = a[n]?.[t];
|
|
5635
5661
|
if (o === void 0 || !Number.isFinite(o)) continue;
|
|
5636
5662
|
let c = l(o);
|
|
5637
|
-
e.rect(
|
|
5663
|
+
e.rect(s(n, r) + i, Math.min(c, u), d, Math.max(1, Math.abs(c - u)));
|
|
5638
5664
|
}
|
|
5639
5665
|
e.fill();
|
|
5640
5666
|
}
|
|
@@ -6632,13 +6658,13 @@ var di = class extends R {
|
|
|
6632
6658
|
}
|
|
6633
6659
|
};
|
|
6634
6660
|
}
|
|
6635
|
-
render(e, t,
|
|
6636
|
-
let { chartRect:
|
|
6637
|
-
if (!
|
|
6638
|
-
let { minPrice:
|
|
6661
|
+
render(e, t, r, i) {
|
|
6662
|
+
let { chartRect: a } = r, o = t.meta;
|
|
6663
|
+
if (!o || o.maxVolume === 0) return;
|
|
6664
|
+
let { minPrice: s, rows: c, rowHeight: l, bins: u, maxVolume: d } = o, f = a.width * .3, p = n(r);
|
|
6639
6665
|
for (let t = 0; t < c; t++) {
|
|
6640
|
-
let n = p(
|
|
6641
|
-
e.fillStyle = u[t] > d * .7 ?
|
|
6666
|
+
let n = p(s + t * l), r = p(s + (t + 1) * l), o = u[t] / d * f;
|
|
6667
|
+
e.fillStyle = u[t] > d * .7 ? i.colors[1] ?? "rgba(242, 169, 59, 0.5)" : i.colors[0] ?? "rgba(76, 141, 255, 0.3)", e.fillRect(a.x, Math.min(n, r), o, Math.max(Math.abs(n - r) - 1, 1));
|
|
6642
6668
|
}
|
|
6643
6669
|
}
|
|
6644
6670
|
}, _i = class extends R {
|
|
@@ -8072,24 +8098,24 @@ var ha = class {
|
|
|
8072
8098
|
this.timeFormatter = e;
|
|
8073
8099
|
}
|
|
8074
8100
|
render(e, t, n, r, i) {
|
|
8075
|
-
let { chartRect: a } = t,
|
|
8076
|
-
e.strokeStyle = n.axisLine, e.lineWidth = 1, e.globalAlpha = .65, e.beginPath(), e.moveTo(a.x,
|
|
8077
|
-
let
|
|
8078
|
-
e.font =
|
|
8079
|
-
let
|
|
8101
|
+
let { chartRect: a } = t, s = i ?? a.y + a.height;
|
|
8102
|
+
e.strokeStyle = n.axisLine, e.lineWidth = 1, e.globalAlpha = .65, e.beginPath(), e.moveTo(a.x, s + .5), e.lineTo(a.x + a.width, s + .5), e.stroke(), e.globalAlpha = 1;
|
|
8103
|
+
let c = t.barWidth + t.barSpacing, l = Math.max(1, Math.ceil(80 / c)), u = -t.offset + a.x + t.barWidth / 2, d = Math.floor(t.offset / c), f = Math.ceil((t.offset + a.width) / c), p = r.length > 0 ? o(Math.min(f, r.length - 1), r) : Date.now(), m = je(this.tz, p > 0xe8d4a51000 ? p : p * 1e3), h = `500 ${n.font.sizeSmall - 1}px ${n.font.family}`, g = a.x + a.width - 4;
|
|
8104
|
+
e.font = h;
|
|
8105
|
+
let _ = g - e.measureText(m).width - 8;
|
|
8080
8106
|
e.font = `500 ${n.font.sizeSmall}px ${n.font.family}`, e.textBaseline = "top", e.textAlign = "center", e.fillStyle = n.axisLabel;
|
|
8081
|
-
let
|
|
8082
|
-
for (let t =
|
|
8083
|
-
if (t %
|
|
8084
|
-
let n = t *
|
|
8085
|
-
|
|
8107
|
+
let v = ae(r), y = -1;
|
|
8108
|
+
for (let t = d; t <= f && r.length > 0; t++) {
|
|
8109
|
+
if (t % l !== 0) continue;
|
|
8110
|
+
let n = t * c + u, i = o(t, r), a = i > 0xe8d4a51000 ? i : i * 1e3, d = Ae(a, this.tz), { year: f, day: p, month: m, hours: h, minutes: g } = d, b;
|
|
8111
|
+
v ?? ue(d) ? b = "date" : p === y ? b = "time" : (b = "day", y = p);
|
|
8086
8112
|
let x = this.timeFormatter ? this.timeFormatter(a, {
|
|
8087
8113
|
kind: b,
|
|
8088
8114
|
timeZone: this.tz
|
|
8089
|
-
}) : b === "date" ? `${
|
|
8090
|
-
n + e.measureText(x).width / 2 >
|
|
8115
|
+
}) : b === "date" ? `${m}/${p}/${f}` : b === "day" ? `${m}/${p}` : `${ba(h)}:${ba(g)}`;
|
|
8116
|
+
n + e.measureText(x).width / 2 > _ || e.fillText(x, n, s + 7);
|
|
8091
8117
|
}
|
|
8092
|
-
e.font =
|
|
8118
|
+
e.font = h, e.textAlign = "right", e.textBaseline = "top", e.globalAlpha = .75, e.fillStyle = n.textSecondary, e.fillText(m, g, s + 7), e.globalAlpha = 1;
|
|
8093
8119
|
}
|
|
8094
8120
|
}, Sa = /* @__PURE__ */ new Set(), Ca = null;
|
|
8095
8121
|
function wa() {
|
|
@@ -8872,59 +8898,59 @@ var Ba = class {
|
|
|
8872
8898
|
this.syncedSlot !== null && this.renderSynced(e, t, n, this.syncedSlot);
|
|
8873
8899
|
return;
|
|
8874
8900
|
}
|
|
8875
|
-
let { chartRect:
|
|
8876
|
-
if (
|
|
8877
|
-
let
|
|
8878
|
-
if (
|
|
8879
|
-
let
|
|
8880
|
-
if (this.magnetMode && (
|
|
8881
|
-
x:
|
|
8882
|
-
y:
|
|
8883
|
-
}, this.lastCallbackBarIndex =
|
|
8884
|
-
this.magnetMode &&
|
|
8885
|
-
let
|
|
8886
|
-
e.lineWidth =
|
|
8887
|
-
}
|
|
8888
|
-
renderAxisLabels(t, n,
|
|
8901
|
+
let { chartRect: r } = t, { x: i, y: a } = this.position;
|
|
8902
|
+
if (i < r.x || i > r.x + r.width) return;
|
|
8903
|
+
let o = r.y + r.height;
|
|
8904
|
+
if (a < Math.min(this.reportTop ?? r.y, r.y) || a > Math.max(this.reportBottom ?? o, o)) return;
|
|
8905
|
+
let c = a >= r.y && a <= o, l = b(i, t), u = Math.max(0, Math.min(this.data.length - 1, l)), f = l >= 0 && l < this.data.length;
|
|
8906
|
+
if (this.magnetMode && (i = s(l, t)), u !== this.lastCallbackBarIndex && (this.pendingBarIndex = u, this.pendingPoint = {
|
|
8907
|
+
x: i,
|
|
8908
|
+
y: a
|
|
8909
|
+
}, this.lastCallbackBarIndex = u, this.scheduleCallback()), !c) return;
|
|
8910
|
+
this.magnetMode && f && Va(e, i, t, n), Ha(e, i, r, n), e.setLineDash([4, 4]);
|
|
8911
|
+
let p = d(e, a, 1);
|
|
8912
|
+
e.lineWidth = p.width, e.beginPath(), e.moveTo(r.x, p.y), e.lineTo(r.x + r.width, p.y), e.stroke(), e.setLineDash([]);
|
|
8913
|
+
}
|
|
8914
|
+
renderAxisLabels(t, n, r, i, a) {
|
|
8889
8915
|
if (this.mode === "hidden") return;
|
|
8890
8916
|
if (!this.position) {
|
|
8891
|
-
this.syncedSlot !== null && this.renderSyncedTimeLabel(t, n,
|
|
8917
|
+
this.syncedSlot !== null && this.renderSyncedTimeLabel(t, n, r, i, this.syncedSlot, a);
|
|
8892
8918
|
return;
|
|
8893
8919
|
}
|
|
8894
|
-
let { chartRect:
|
|
8895
|
-
if (
|
|
8896
|
-
let
|
|
8897
|
-
this.magnetMode && (
|
|
8898
|
-
let
|
|
8920
|
+
let { chartRect: o } = n, { x: c, y: l } = this.position;
|
|
8921
|
+
if (c < o.x || c > o.x + o.width || l < o.y || l > o.y + o.height) return;
|
|
8922
|
+
let u = b(c, n);
|
|
8923
|
+
this.magnetMode && (c = s(u, n));
|
|
8924
|
+
let d = `600 ${r.font.sizeSmall}px ${r.font.family}`;
|
|
8899
8925
|
Ua(t, {
|
|
8900
|
-
text: Be(e(
|
|
8901
|
-
anchorX:
|
|
8902
|
-
anchorY:
|
|
8926
|
+
text: Be(e(l, n), n, this.pricePrecision ?? j(n.priceRange.min, n.priceRange.max), this.locale),
|
|
8927
|
+
anchorX: o.x + o.width,
|
|
8928
|
+
anchorY: l,
|
|
8903
8929
|
orientation: "right",
|
|
8904
|
-
bg:
|
|
8905
|
-
fg:
|
|
8906
|
-
theme:
|
|
8907
|
-
font:
|
|
8908
|
-
}), this.drawTimePill(t, n,
|
|
8930
|
+
bg: r.text,
|
|
8931
|
+
fg: r.background,
|
|
8932
|
+
theme: r,
|
|
8933
|
+
font: d
|
|
8934
|
+
}), this.drawTimePill(t, n, r, i, u, c, a);
|
|
8909
8935
|
}
|
|
8910
8936
|
renderSynced(e, t, n, r) {
|
|
8911
|
-
let i =
|
|
8912
|
-
i <
|
|
8937
|
+
let i = s(r, t), { chartRect: a } = t;
|
|
8938
|
+
i < a.x || i > a.x + a.width || (this.magnetMode && r >= 0 && r < this.data.length && Va(e, i, t, n), Ha(e, i, a, n));
|
|
8913
8939
|
}
|
|
8914
|
-
renderSyncedTimeLabel(e, t, n, r, i,
|
|
8915
|
-
let
|
|
8916
|
-
|
|
8940
|
+
renderSyncedTimeLabel(e, t, n, r, i, a) {
|
|
8941
|
+
let o = s(i, t), { chartRect: c } = t;
|
|
8942
|
+
o < c.x || o > c.x + c.width || this.drawTimePill(e, t, n, r, i, o, a);
|
|
8917
8943
|
}
|
|
8918
|
-
drawTimePill(e, t, n, r, i, a,
|
|
8944
|
+
drawTimePill(e, t, n, r, i, a, s) {
|
|
8919
8945
|
if (r.length === 0) return;
|
|
8920
|
-
let
|
|
8946
|
+
let c = o(i, r);
|
|
8921
8947
|
Ua(e, {
|
|
8922
|
-
text: this.timeFormatter ? this.timeFormatter(
|
|
8948
|
+
text: this.timeFormatter ? this.timeFormatter(c > 0xe8d4a51000 ? c : c * 1e3, {
|
|
8923
8949
|
kind: "crosshair",
|
|
8924
8950
|
timeZone: this.tz
|
|
8925
|
-
}) : Wa(
|
|
8951
|
+
}) : Wa(c, this.tz, ae(r)),
|
|
8926
8952
|
anchorX: a,
|
|
8927
|
-
anchorY:
|
|
8953
|
+
anchorY: s ?? t.chartRect.y + t.chartRect.height,
|
|
8928
8954
|
orientation: "bottom",
|
|
8929
8955
|
bg: n.text,
|
|
8930
8956
|
fg: n.background,
|
|
@@ -8947,7 +8973,7 @@ function Va(e, t, n, r) {
|
|
|
8947
8973
|
}
|
|
8948
8974
|
function Ha(e, t, n, r) {
|
|
8949
8975
|
e.setLineDash([4, 4]), e.strokeStyle = r.crosshair;
|
|
8950
|
-
let i =
|
|
8976
|
+
let i = a(e, t, 1);
|
|
8951
8977
|
e.lineWidth = i.width, e.beginPath(), e.moveTo(i.x, n.y), e.lineTo(i.x, n.y + n.height), e.stroke(), e.setLineDash([]);
|
|
8952
8978
|
}
|
|
8953
8979
|
function Ua(e, t) {
|
|
@@ -9253,9 +9279,9 @@ var ao = class {
|
|
|
9253
9279
|
}
|
|
9254
9280
|
reposition(e, t, n, r) {
|
|
9255
9281
|
if (!this.el || !this.pinnedBar) return;
|
|
9256
|
-
let i =
|
|
9282
|
+
let i = s(this.pinnedIndex, e), a = c(this.pinnedBar.close, e), o = e.chartRect, l = i >= o.x - 4 && i <= o.x + o.width + 4;
|
|
9257
9283
|
this.el.style.opacity = l ? "1" : "0.35";
|
|
9258
|
-
let u = Math.max(
|
|
9284
|
+
let u = Math.max(o.x, Math.min(o.x + o.width - 180, i + 8)), d = Math.max(o.y, Math.min(o.y + o.height - 90, a - 64));
|
|
9259
9285
|
if (this.el.style.transform = `translate(${Math.round(u)}px, ${Math.round(d)}px)`, this.el.style.left = "0", this.el.style.top = "0", this.deltaEl) if (t && n !== null && n !== this.pinnedIndex) {
|
|
9260
9286
|
let e = t.close - this.pinnedBar.close, i = this.pinnedBar.close === 0 ? 0 : e / this.pinnedBar.close * 100, a = e > 0 ? "+" : e < 0 ? "−" : "", o = n - this.pinnedIndex, s = e >= 0 ? r.candleUp : r.candleDown;
|
|
9261
9287
|
this.deltaEl.style.color = s, this.deltaEl.innerHTML = `Δ ${a}${this.fmt(Math.abs(e))} <span style="opacity:.7">(${a}${Math.abs(i).toFixed(2)}%)</span> · ${o > 0 ? "+" : ""}${o} bars`, this.deltaEl.style.display = "block";
|
|
@@ -9328,11 +9354,11 @@ var uo = class {
|
|
|
9328
9354
|
};
|
|
9329
9355
|
function po(e) {
|
|
9330
9356
|
if (!e) return fo;
|
|
9331
|
-
let { min:
|
|
9357
|
+
let { min: t, max: n } = e.priceRange, r = e.logScale === !0 && t > 0 && n > 0;
|
|
9332
9358
|
return {
|
|
9333
|
-
at: (
|
|
9334
|
-
value:
|
|
9335
|
-
price:
|
|
9359
|
+
at: (t) => y(t, e),
|
|
9360
|
+
value: r ? (e) => Math.log(Math.max(e, 2 ** -52)) : (e) => e,
|
|
9361
|
+
price: r ? Math.exp : (e) => e
|
|
9336
9362
|
};
|
|
9337
9363
|
}
|
|
9338
9364
|
function mo(e, t, n) {
|
|
@@ -9394,14 +9420,14 @@ var K = class {
|
|
|
9394
9420
|
}
|
|
9395
9421
|
anchorToPixel(e, t) {
|
|
9396
9422
|
return {
|
|
9397
|
-
x:
|
|
9423
|
+
x: x(e.time, t),
|
|
9398
9424
|
y: c(e.price, t)
|
|
9399
9425
|
};
|
|
9400
9426
|
}
|
|
9401
|
-
pixelToAnchor(
|
|
9427
|
+
pixelToAnchor(n, r) {
|
|
9402
9428
|
return {
|
|
9403
|
-
time:
|
|
9404
|
-
price: e(
|
|
9429
|
+
time: t(n.x, r),
|
|
9430
|
+
price: e(n.y, r)
|
|
9405
9431
|
};
|
|
9406
9432
|
}
|
|
9407
9433
|
applyLineStyle(e, t) {
|
|
@@ -9418,11 +9444,11 @@ var K = class {
|
|
|
9418
9444
|
}
|
|
9419
9445
|
}
|
|
9420
9446
|
strokeHorizontal(e, t, n, r) {
|
|
9421
|
-
let
|
|
9422
|
-
e.lineWidth =
|
|
9447
|
+
let i = d(e, r, Number(e.lineWidth) || 1);
|
|
9448
|
+
e.lineWidth = i.width, e.beginPath(), e.moveTo(t, i.y), e.lineTo(n, i.y), e.stroke();
|
|
9423
9449
|
}
|
|
9424
9450
|
strokeVertical(e, t, n, r) {
|
|
9425
|
-
let i =
|
|
9451
|
+
let i = a(e, t, Number(e.lineWidth) || 1);
|
|
9426
9452
|
e.lineWidth = i.width, e.beginPath(), e.moveTo(i.x, n), e.lineTo(i.x, r), e.stroke();
|
|
9427
9453
|
}
|
|
9428
9454
|
resetLineStyle(e) {
|
|
@@ -9620,28 +9646,28 @@ var Lo = class {
|
|
|
9620
9646
|
this.drawing.anchors.push(e), this.preview = null, this.lastPos = t;
|
|
9621
9647
|
}
|
|
9622
9648
|
}, Ro = 30;
|
|
9623
|
-
function zo(e, t, n, r,
|
|
9649
|
+
function zo(e, t, n, r, a) {
|
|
9624
9650
|
if (n === "none" || r.length === 0) return {
|
|
9625
9651
|
time: e,
|
|
9626
9652
|
price: t
|
|
9627
9653
|
};
|
|
9628
|
-
let
|
|
9629
|
-
if (
|
|
9654
|
+
let o = !!(a?.data && a.data.length > 0), s = Math.round(o ? i(e, r) : e);
|
|
9655
|
+
if (s < 0 || s > r.length - 1) return {
|
|
9630
9656
|
time: e,
|
|
9631
9657
|
price: t
|
|
9632
9658
|
};
|
|
9633
|
-
let
|
|
9659
|
+
let l = r[s], u = o ? l.time : s, d = l.open;
|
|
9634
9660
|
for (let e of [
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
]) Math.abs(t - e) < Math.abs(t -
|
|
9639
|
-
return n === "magnet" &&
|
|
9640
|
-
time:
|
|
9661
|
+
l.high,
|
|
9662
|
+
l.low,
|
|
9663
|
+
l.close
|
|
9664
|
+
]) Math.abs(t - e) < Math.abs(t - d) && (d = e);
|
|
9665
|
+
return n === "magnet" && a && Math.abs(c(t, a) - c(d, a)) > Ro ? {
|
|
9666
|
+
time: u,
|
|
9641
9667
|
price: t
|
|
9642
9668
|
} : {
|
|
9643
|
-
time:
|
|
9644
|
-
price:
|
|
9669
|
+
time: u,
|
|
9670
|
+
price: d
|
|
9645
9671
|
};
|
|
9646
9672
|
}
|
|
9647
9673
|
//#endregion
|
|
@@ -9736,18 +9762,18 @@ var Bo = class {
|
|
|
9736
9762
|
});
|
|
9737
9763
|
return this.start = null, this.handle = -1, this.grabbed = [], e;
|
|
9738
9764
|
}
|
|
9739
|
-
translate(
|
|
9740
|
-
let
|
|
9741
|
-
if (Math.hypot(
|
|
9742
|
-
let s =
|
|
9743
|
-
let
|
|
9744
|
-
return u && u.length > 0 ?
|
|
9765
|
+
translate(t, n) {
|
|
9766
|
+
let r = this.start, i = t.x - r.x, a = t.y - r.y;
|
|
9767
|
+
if (Math.hypot(i, a) < Vo && this.unmoved()) return !0;
|
|
9768
|
+
let s = n.barWidth + n.barSpacing, l = s > 0 ? Math.round(i / s) : 0, u = n.data, d = (e) => {
|
|
9769
|
+
let t = y(e, n) + l;
|
|
9770
|
+
return u && u.length > 0 ? o(t, u) : t;
|
|
9745
9771
|
};
|
|
9746
|
-
for (let { id: t, anchors:
|
|
9772
|
+
for (let { id: t, anchors: r } of this.grabbed) {
|
|
9747
9773
|
let i = this.find(t);
|
|
9748
|
-
!i || i.locked || (i.anchors =
|
|
9774
|
+
!i || i.locked || (i.anchors = r.map((t) => ({
|
|
9749
9775
|
time: l === 0 ? t.time : d(t.time),
|
|
9750
|
-
price:
|
|
9776
|
+
price: a === 0 ? t.price : e(c(t.price, n) + a, n)
|
|
9751
9777
|
})));
|
|
9752
9778
|
}
|
|
9753
9779
|
return !0;
|
|
@@ -9758,17 +9784,17 @@ var Bo = class {
|
|
|
9758
9784
|
return !n || n.every((e, n) => e.time === t[n]?.time && e.price === t[n]?.price);
|
|
9759
9785
|
});
|
|
9760
9786
|
}
|
|
9761
|
-
reshape(
|
|
9762
|
-
let
|
|
9763
|
-
if (!
|
|
9764
|
-
let
|
|
9765
|
-
time:
|
|
9766
|
-
price: e(
|
|
9787
|
+
reshape(n, r, i) {
|
|
9788
|
+
let a = this.find(this.grabbed[0].id);
|
|
9789
|
+
if (!a) return !1;
|
|
9790
|
+
let o = {
|
|
9791
|
+
time: t(n.x, r),
|
|
9792
|
+
price: e(n.y, r)
|
|
9767
9793
|
};
|
|
9768
|
-
if (
|
|
9769
|
-
let e =
|
|
9770
|
-
|
|
9771
|
-
} else this.handle <
|
|
9794
|
+
if (i?.moveHandle) {
|
|
9795
|
+
let e = i.moveHandle(q(a), this.handle, o);
|
|
9796
|
+
a.anchors = e.anchors, a.options = e.options && Object.keys(e.options).length > 0 ? we(i.descriptor.options, e.options) : void 0;
|
|
9797
|
+
} else this.handle < a.anchors.length && (a.anchors[this.handle] = o);
|
|
9772
9798
|
return !0;
|
|
9773
9799
|
}
|
|
9774
9800
|
}, Uo = {
|
|
@@ -9929,7 +9955,7 @@ var Bo = class {
|
|
|
9929
9955
|
this.selection.clear(), this.state = "idle";
|
|
9930
9956
|
let n = Math.min(e.x0, e.x1), r = Math.max(e.x0, e.x1), i = Math.min(e.y0, e.y1), a = Math.max(e.y0, e.y1);
|
|
9931
9957
|
for (let e of this.drawings) e.visible && e.anchors.some((e) => {
|
|
9932
|
-
let o =
|
|
9958
|
+
let o = x(e.time, t), s = c(e.price, t);
|
|
9933
9959
|
return o >= n && o <= r && s >= i && s <= a;
|
|
9934
9960
|
}) && this.addToSelection(e.id);
|
|
9935
9961
|
return this.requestRender?.(), this.getSelectedDrawingIds().length;
|
|
@@ -10399,12 +10425,12 @@ var Bo = class {
|
|
|
10399
10425
|
for (let e = n + 1; e < t.length; e++) r.push(t[e].time - t[e - 1].time);
|
|
10400
10426
|
return r.length === 0 ? e : (r.sort((e, t) => e - t), e * r[Math.floor(r.length / 2)]);
|
|
10401
10427
|
}
|
|
10402
|
-
creationAnchor(
|
|
10403
|
-
let
|
|
10404
|
-
return this.registry.get(
|
|
10405
|
-
time:
|
|
10406
|
-
price:
|
|
10407
|
-
} : this.snapToOHLC(
|
|
10428
|
+
creationAnchor(n, r, i) {
|
|
10429
|
+
let a = t(r.x, i), o = e(r.y, i);
|
|
10430
|
+
return this.registry.get(n)?.descriptor.creation === "freehand" ? {
|
|
10431
|
+
time: a,
|
|
10432
|
+
price: o
|
|
10433
|
+
} : this.snapToOHLC(a, o, i);
|
|
10408
10434
|
}
|
|
10409
10435
|
handleCreationClick(e, t) {
|
|
10410
10436
|
let n = this.activeTool, r = n ? this.registry.get(n) : void 0;
|
|
@@ -10419,7 +10445,7 @@ var Bo = class {
|
|
|
10419
10445
|
options: this.initialOptions(n)
|
|
10420
10446
|
});
|
|
10421
10447
|
return this.creationPressAt = Date.now(), this.afterCreationStep(this.creator.press(r, i, this.creationAnchor(n, e, t), e, (e) => ({
|
|
10422
|
-
x:
|
|
10448
|
+
x: x(e.time, t),
|
|
10423
10449
|
y: c(e.price, t)
|
|
10424
10450
|
}))), !0;
|
|
10425
10451
|
}
|
|
@@ -10562,9 +10588,9 @@ function us(e) {
|
|
|
10562
10588
|
function ds(e) {
|
|
10563
10589
|
return !!e.data && e.data.length > 0;
|
|
10564
10590
|
}
|
|
10565
|
-
function fs(e, n, r
|
|
10566
|
-
let
|
|
10567
|
-
return Math.round(Math.abs(
|
|
10591
|
+
function fs(e, t, n, r) {
|
|
10592
|
+
let i = y(e.anchors[t].time, r), a = y(e.anchors[n].time, r);
|
|
10593
|
+
return Math.round(Math.abs(a - i));
|
|
10568
10594
|
}
|
|
10569
10595
|
function ps(e, t, n, r) {
|
|
10570
10596
|
return ds(r) ? us(e.anchors[n].time - e.anchors[t].time) : null;
|
|
@@ -10913,25 +10939,25 @@ function js(e, t, n, r, i = (e) => e.toFixed(2)) {
|
|
|
10913
10939
|
let a = `${(e * 100).toFixed(1)}%`, o = i(t);
|
|
10914
10940
|
return n && r ? `${a} (${o})` : n ? a : r ? o : "";
|
|
10915
10941
|
}
|
|
10916
|
-
function Ms(e, t, n, r,
|
|
10917
|
-
let
|
|
10918
|
-
if (
|
|
10919
|
-
let
|
|
10920
|
-
for (let r = 0; r <
|
|
10921
|
-
let
|
|
10922
|
-
d && (e.fillStyle = d, e.globalAlpha = u ? .07 : .05 + r * .02, e.fillRect(
|
|
10942
|
+
function Ms(e, t, n, r, i, a) {
|
|
10943
|
+
let o = i.x1 - i.x0;
|
|
10944
|
+
if (i.background && r.length > 1) {
|
|
10945
|
+
let a = [...r].sort((e, t) => e.level.value - t.level.value);
|
|
10946
|
+
for (let r = 0; r < a.length - 1; r++) {
|
|
10947
|
+
let s = c(a[r].price, n), l = c(a[r + 1].price, n), u = a[r + 1].level.color, d = u ?? t.style.fillColor;
|
|
10948
|
+
d && (e.fillStyle = d, e.globalAlpha = u ? .07 : .05 + r * .02, e.fillRect(i.x0, Math.min(s, l), o, Math.abs(l - s)));
|
|
10923
10949
|
}
|
|
10924
10950
|
e.globalAlpha = 1;
|
|
10925
10951
|
}
|
|
10926
|
-
e.font = J(11), e.textBaseline = "bottom", e.textAlign =
|
|
10927
|
-
let
|
|
10928
|
-
for (let { level:
|
|
10929
|
-
let r = c(
|
|
10930
|
-
|
|
10931
|
-
let f =
|
|
10932
|
-
e.lineWidth = f.width, e.beginPath(), e.moveTo(
|
|
10933
|
-
let p = js(
|
|
10934
|
-
p && (e.globalAlpha = 1, e.fillStyle =
|
|
10952
|
+
e.font = J(11), e.textBaseline = "bottom", e.textAlign = i.labelPosition === "right" ? "right" : "left";
|
|
10953
|
+
let s = i.labelPosition === "right" ? i.x1 - 4 : i.x0 + 4;
|
|
10954
|
+
for (let { level: o, price: l } of r) {
|
|
10955
|
+
let r = c(l, n), u = o.color ?? t.style.color;
|
|
10956
|
+
a(u), e.globalAlpha = o.value === 0 || o.value === 1 ? 1 : .8;
|
|
10957
|
+
let f = d(e, r, Number(e.lineWidth) || 1);
|
|
10958
|
+
e.lineWidth = f.width, e.beginPath(), e.moveTo(i.x0, f.y), e.lineTo(i.x1, f.y), e.stroke();
|
|
10959
|
+
let p = js(o.value, l, i.showLevels, i.showPrices, (e) => cs(e, e, n));
|
|
10960
|
+
p && (e.globalAlpha = 1, e.fillStyle = u, Y(e, p, s, r - 3));
|
|
10935
10961
|
}
|
|
10936
10962
|
e.globalAlpha = 1;
|
|
10937
10963
|
}
|
|
@@ -11380,12 +11406,12 @@ var Ks = { degree: {
|
|
|
11380
11406
|
name: "Date Range",
|
|
11381
11407
|
requiredAnchors: 2
|
|
11382
11408
|
};
|
|
11383
|
-
render(e, n, r
|
|
11384
|
-
if (
|
|
11385
|
-
let
|
|
11386
|
-
e.fillStyle = "rgba(76, 141, 255, 0.08)", e.fillRect(
|
|
11387
|
-
let
|
|
11388
|
-
e.font = J(12), e.fillStyle =
|
|
11409
|
+
render(e, t, n, r) {
|
|
11410
|
+
if (t.anchors.length < 2) return;
|
|
11411
|
+
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), { chartRect: o } = n, s = Math.min(i.x, a.x), c = Math.max(i.x, a.x);
|
|
11412
|
+
e.fillStyle = "rgba(76, 141, 255, 0.08)", e.fillRect(s, o.y, c - s, o.height), this.applyLineStyle(e, t.style), e.beginPath(), e.moveTo(s, o.y), e.lineTo(s, o.y + o.height), e.stroke(), e.beginPath(), e.moveTo(c, o.y), e.lineTo(c, o.y + o.height), e.stroke(), this.resetLineStyle(e);
|
|
11413
|
+
let l = y(t.anchors[0].time, n), u = y(t.anchors[1].time, n), d = Math.max(0, Math.round(Math.abs(u - l)));
|
|
11414
|
+
e.font = J(12), e.fillStyle = t.style.color, e.textAlign = "center", e.textBaseline = "top", e.fillText(`${d} bars`, (s + c) / 2, o.y + 4), r && this.renderAnchorHandles(e, t, n);
|
|
11389
11415
|
}
|
|
11390
11416
|
hitTest(e, t, n, r) {
|
|
11391
11417
|
if (t.anchors.length < 2) return !1;
|
|
@@ -11398,16 +11424,16 @@ var Ks = { degree: {
|
|
|
11398
11424
|
name: "Measure",
|
|
11399
11425
|
requiredAnchors: 2
|
|
11400
11426
|
};
|
|
11401
|
-
render(e, n, r
|
|
11402
|
-
if (
|
|
11403
|
-
let
|
|
11404
|
-
this.applyLineStyle(e,
|
|
11405
|
-
let
|
|
11427
|
+
render(e, t, n, r) {
|
|
11428
|
+
if (t.anchors.length < 2) return;
|
|
11429
|
+
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n);
|
|
11430
|
+
this.applyLineStyle(e, t.style), e.setLineDash([4, 4]), e.beginPath(), e.moveTo(i.x, i.y), e.lineTo(a.x, a.y), e.stroke(), this.resetLineStyle(e);
|
|
11431
|
+
let o = y(t.anchors[0].time, n), s = y(t.anchors[1].time, n), c = Math.max(0, Math.round(Math.abs(s - o))), l = [`Price: ${ls(t.anchors[0].price, t.anchors[1].price, n)}`, `Bars: ${c}`], u = (i.x + a.x) / 2, d = (i.y + a.y) / 2;
|
|
11406
11432
|
e.font = J(11), e.textAlign = "center", e.textBaseline = "bottom";
|
|
11407
|
-
let
|
|
11408
|
-
e.fillStyle = "rgba(0, 0, 0, 0.7)", e.fillRect(
|
|
11409
|
-
for (let t = 0; t <
|
|
11410
|
-
|
|
11433
|
+
let f = Math.max(...l.map((t) => e.measureText(t).width));
|
|
11434
|
+
e.fillStyle = "rgba(0, 0, 0, 0.7)", e.fillRect(u - f / 2 - 6, d - l.length * 14 - 4, f + 12, l.length * 14 + 8), e.fillStyle = "#FFFFFF";
|
|
11435
|
+
for (let t = 0; t < l.length; t++) e.fillText(l[t], u, d - (l.length - 1 - t) * 14);
|
|
11436
|
+
r && this.renderAnchorHandles(e, t, n);
|
|
11411
11437
|
}
|
|
11412
11438
|
hitTest(e, t, n, r) {
|
|
11413
11439
|
if (t.anchors.length < 2) return !1;
|
|
@@ -11601,26 +11627,26 @@ var ic = class extends K {
|
|
|
11601
11627
|
setShowBands(e) {
|
|
11602
11628
|
this.showBands = e;
|
|
11603
11629
|
}
|
|
11604
|
-
render(e, n, r
|
|
11605
|
-
if (
|
|
11606
|
-
let
|
|
11607
|
-
if (
|
|
11608
|
-
let { vwap:
|
|
11609
|
-
if (this.applyLineStyle(e,
|
|
11610
|
-
let
|
|
11611
|
-
i >=
|
|
11630
|
+
render(e, t, n, r) {
|
|
11631
|
+
if (t.anchors.length < 1 || !this.dataGetter) return;
|
|
11632
|
+
let i = this.dataGetter(), a = Math.max(0, Math.round(y(t.anchors[0].time, n)));
|
|
11633
|
+
if (a >= i.length) return;
|
|
11634
|
+
let { vwap: o, upper1: l, lower1: u, upper2: d, lower2: f } = this.computeVWAP(i, a), { chartRect: p } = n, m = n.barWidth + n.barSpacing;
|
|
11635
|
+
if (this.applyLineStyle(e, t.style), e.lineWidth = t.style.lineWidth + .5, this.drawLine(e, o, a, n, p, m), this.showBands && o.length > 1 && (e.globalAlpha = .4, e.lineWidth = Math.max(.5, t.style.lineWidth * .6), e.setLineDash([4, 3]), this.drawLine(e, l, a, n, p, m), this.drawLine(e, u, a, n, p, m), e.globalAlpha = .25, this.drawLine(e, d, a, n, p, m), this.drawLine(e, f, a, n, p, m), e.globalAlpha = 1), this.resetLineStyle(e), o.length > 0) {
|
|
11636
|
+
let r = o[o.length - 1], i = s(a + o.length - 1, n), l = c(r, n);
|
|
11637
|
+
i >= p.x && i <= p.x + p.width && (e.fillStyle = t.style.color, e.font = J(9, "bold"), e.textAlign = "left", e.textBaseline = "middle", e.fillText(`AVWAP ${cs(r, r, n)}`, i + 6, l));
|
|
11612
11638
|
}
|
|
11613
|
-
|
|
11639
|
+
r && this.renderAnchorHandles(e, t, n);
|
|
11614
11640
|
}
|
|
11615
|
-
drawLine(e, t, n, r, i,
|
|
11641
|
+
drawLine(e, t, n, r, i, a) {
|
|
11616
11642
|
e.beginPath();
|
|
11617
|
-
let
|
|
11643
|
+
let o = !1;
|
|
11618
11644
|
for (let l = 0; l < t.length; l++) {
|
|
11619
|
-
let u =
|
|
11620
|
-
if (u < i.x -
|
|
11621
|
-
if (u > i.x + i.width +
|
|
11645
|
+
let u = s(n + l, r);
|
|
11646
|
+
if (u < i.x - a) continue;
|
|
11647
|
+
if (u > i.x + i.width + a) break;
|
|
11622
11648
|
let d = c(t[l], r);
|
|
11623
|
-
|
|
11649
|
+
o ? e.lineTo(u, d) : (e.moveTo(u, d), o = !0);
|
|
11624
11650
|
}
|
|
11625
11651
|
e.stroke();
|
|
11626
11652
|
}
|
|
@@ -11656,20 +11682,20 @@ var ic = class extends K {
|
|
|
11656
11682
|
lower2: s
|
|
11657
11683
|
};
|
|
11658
11684
|
}
|
|
11659
|
-
hitTest(e, n, r
|
|
11660
|
-
if (
|
|
11661
|
-
let
|
|
11662
|
-
if (
|
|
11663
|
-
let { vwap:
|
|
11664
|
-
for (let t = 1; t <
|
|
11665
|
-
let
|
|
11685
|
+
hitTest(e, t, n, r) {
|
|
11686
|
+
if (t.anchors.length < 1 || !this.dataGetter) return !1;
|
|
11687
|
+
let i = this.dataGetter(), a = Math.max(0, Math.round(y(t.anchors[0].time, n)));
|
|
11688
|
+
if (a >= i.length) return !1;
|
|
11689
|
+
let { vwap: o } = this.computeVWAP(i, a);
|
|
11690
|
+
for (let t = 1; t < o.length; t++) {
|
|
11691
|
+
let i = s(a + t - 1, n), l = c(o[t - 1], n), u = s(a + t, n), d = c(o[t], n);
|
|
11666
11692
|
if (this.distanceToLine(e, {
|
|
11667
|
-
x:
|
|
11668
|
-
y:
|
|
11693
|
+
x: i,
|
|
11694
|
+
y: l
|
|
11669
11695
|
}, {
|
|
11670
11696
|
x: u,
|
|
11671
11697
|
y: d
|
|
11672
|
-
}) <=
|
|
11698
|
+
}) <= r) return !0;
|
|
11673
11699
|
}
|
|
11674
11700
|
return !1;
|
|
11675
11701
|
}
|
|
@@ -11685,31 +11711,31 @@ var ic = class extends K {
|
|
|
11685
11711
|
setDataGetter(e) {
|
|
11686
11712
|
this.dataGetter = e;
|
|
11687
11713
|
}
|
|
11688
|
-
render(e, n, r
|
|
11689
|
-
if (
|
|
11690
|
-
let
|
|
11691
|
-
if (
|
|
11692
|
-
let
|
|
11693
|
-
for (let e =
|
|
11694
|
-
if (
|
|
11695
|
-
let
|
|
11696
|
-
for (let e =
|
|
11697
|
-
let t =
|
|
11698
|
-
for (let e = r; e <=
|
|
11699
|
-
}
|
|
11700
|
-
if (
|
|
11701
|
-
let
|
|
11702
|
-
for (let e = 1; e < this.numBins; e++)
|
|
11703
|
-
let
|
|
11714
|
+
render(e, t, n, r) {
|
|
11715
|
+
if (t.anchors.length < 2 || !this.dataGetter) return;
|
|
11716
|
+
let i = this.dataGetter(), a = Math.round(y(t.anchors[0].time, n)), o = Math.round(y(t.anchors[1].time, n)), l = Math.max(0, Math.min(a, o)), u = Math.min(i.length - 1, Math.max(a, o));
|
|
11717
|
+
if (l >= i.length || u < 0 || l > u) return;
|
|
11718
|
+
let d = Infinity, f = -Infinity;
|
|
11719
|
+
for (let e = l; e <= u; e++) i[e].low < d && (d = i[e].low), i[e].high > f && (f = i[e].high);
|
|
11720
|
+
if (d >= f) return;
|
|
11721
|
+
let p = (f - d) / this.numBins, m = new Float64Array(this.numBins), h = 0;
|
|
11722
|
+
for (let e = l; e <= u; e++) {
|
|
11723
|
+
let t = i[e], n = t.volume ?? 1, r = Math.max(0, Math.floor((t.low - d) / p)), a = Math.min(this.numBins - 1, Math.floor((t.high - d) / p)), o = n / (a - r + 1);
|
|
11724
|
+
for (let e = r; e <= a; e++) m[e] += o, m[e] > h && (h = m[e]);
|
|
11725
|
+
}
|
|
11726
|
+
if (h === 0) return;
|
|
11727
|
+
let g = 0;
|
|
11728
|
+
for (let e = 1; e < this.numBins; e++) m[e] > m[g] && (g = e);
|
|
11729
|
+
let _ = s(u, n) + n.barWidth, v = t.style.color, b = t.style.fillColor ?? "#f2a93b";
|
|
11704
11730
|
e.save();
|
|
11705
11731
|
for (let t = 0; t < this.numBins; t++) {
|
|
11706
|
-
let
|
|
11707
|
-
e.globalAlpha = .35, e.fillStyle = t ===
|
|
11732
|
+
let r = m[t] / h * 100, i = d + (t + 1) * p, a = d + t * p, o = c(i, n), s = c(a, n), l = Math.abs(s - o);
|
|
11733
|
+
e.globalAlpha = .35, e.fillStyle = t === g ? b : v, e.fillRect(_, Math.min(o, s), r, Math.max(1, l - .5));
|
|
11708
11734
|
}
|
|
11709
|
-
let x =
|
|
11735
|
+
let x = d + (g + .5) * p, S = c(x, n);
|
|
11710
11736
|
e.globalAlpha = .7, e.strokeStyle = b, e.lineWidth = 1, e.setLineDash([4, 3]), e.beginPath();
|
|
11711
|
-
let C =
|
|
11712
|
-
e.moveTo(C, S), e.lineTo(
|
|
11737
|
+
let C = s(l, n) - n.barWidth / 2;
|
|
11738
|
+
e.moveTo(C, S), e.lineTo(_ + 100, S), e.stroke(), e.fillStyle = b, e.font = J(9), e.textAlign = "left", e.textBaseline = "bottom", e.globalAlpha = .8, e.fillText(`POC ${cs(x, x, n)}`, _ + 100 + 4, S - 2), e.restore(), r && this.renderAnchorHandles(e, t, n);
|
|
11713
11739
|
}
|
|
11714
11740
|
hitTest(e, t, n, r) {
|
|
11715
11741
|
if (t.anchors.length < 2) return !1;
|
|
@@ -11752,7 +11778,7 @@ var ic = class extends K {
|
|
|
11752
11778
|
...t.style,
|
|
11753
11779
|
color: s ?? t.style.color
|
|
11754
11780
|
});
|
|
11755
|
-
let c =
|
|
11781
|
+
let c = x(i.time + a * r, n);
|
|
11756
11782
|
c < o.x || c > o.x + o.width || (e.globalAlpha = r === 1 ? 1 : .55, e.beginPath(), e.moveTo(c, o.y), e.lineTo(c, o.y + o.height), e.stroke(), e.fillStyle = s ?? t.style.color, Y(e, String(r), c, o.y + 2));
|
|
11757
11783
|
}
|
|
11758
11784
|
e.globalAlpha = 1, this.resetLineStyle(e), r && this.renderAnchorHandles(e, t, n);
|
|
@@ -11764,7 +11790,7 @@ var ic = class extends K {
|
|
|
11764
11790
|
let { chartRect: o } = n;
|
|
11765
11791
|
if (e.y < o.y || e.y > o.y + o.height) return !1;
|
|
11766
11792
|
for (let { value: o } of this.visibleLevels(t)) {
|
|
11767
|
-
let t =
|
|
11793
|
+
let t = x(i.time + a * o, n);
|
|
11768
11794
|
if (Math.abs(e.x - t) <= r) return !0;
|
|
11769
11795
|
}
|
|
11770
11796
|
return !1;
|
|
@@ -12364,12 +12390,12 @@ var Pc = class extends K {
|
|
|
12364
12390
|
return t.style.fillColor ? o <= a + r : Math.abs(o - a) <= r;
|
|
12365
12391
|
}
|
|
12366
12392
|
}, Hc = "rgba(76, 141, 255, 0.12)", Uc = "rgba(232, 80, 91, 0.12)";
|
|
12367
|
-
function Wc(e,
|
|
12368
|
-
let
|
|
12369
|
-
if (!
|
|
12370
|
-
let
|
|
12371
|
-
for (let e =
|
|
12372
|
-
return
|
|
12393
|
+
function Wc(e, t) {
|
|
12394
|
+
let n = t.data;
|
|
12395
|
+
if (!n || n.length === 0) return null;
|
|
12396
|
+
let r = Math.round(y(e.anchors[0].time, t)), i = Math.round(y(e.anchors[1].time, t)), a = Math.max(0, Math.min(r, i)), o = Math.min(n.length - 1, Math.max(r, i)), s = 0;
|
|
12397
|
+
for (let e = a; e <= o; e++) s += n[e].volume ?? 0;
|
|
12398
|
+
return s;
|
|
12373
12399
|
}
|
|
12374
12400
|
function Gc(e) {
|
|
12375
12401
|
return e >= 1e9 ? `${(e / 1e9).toFixed(2)}B` : e >= 1e6 ? `${(e / 1e6).toFixed(2)}M` : e >= 1e3 ? `${(e / 1e3).toFixed(2)}K` : e.toFixed(0);
|
|
@@ -12890,8 +12916,8 @@ var Gl = class extends K {
|
|
|
12890
12916
|
screenBox(e, t) {
|
|
12891
12917
|
let { t0: n, t1: r, p0: i, p1: a } = Wl(e.anchors), o = c(i, t), s = c(a, t);
|
|
12892
12918
|
return {
|
|
12893
|
-
x0:
|
|
12894
|
-
x1:
|
|
12919
|
+
x0: x(n, t),
|
|
12920
|
+
x1: x(r, t),
|
|
12895
12921
|
y0: Math.min(o, s),
|
|
12896
12922
|
y1: Math.max(o, s)
|
|
12897
12923
|
};
|
|
@@ -13384,12 +13410,12 @@ var cu = class extends K {
|
|
|
13384
13410
|
}
|
|
13385
13411
|
}, bu = "#26a69a", xu = "#ef5350", Su = 500;
|
|
13386
13412
|
function Cu(e, t, n) {
|
|
13387
|
-
let r = n.price >= t.price,
|
|
13388
|
-
for (let
|
|
13389
|
-
let
|
|
13390
|
-
if (!(
|
|
13391
|
-
if (
|
|
13392
|
-
if (r ?
|
|
13413
|
+
let r = n.price >= t.price, a = e.length > 0 ? Math.max(0, Math.floor(i(t.time, e)) + 1) : 0;
|
|
13414
|
+
for (let i = a; i < e.length; i++) {
|
|
13415
|
+
let a = e[i];
|
|
13416
|
+
if (!(a.time <= t.time)) {
|
|
13417
|
+
if (a.time > n.time) return "missed";
|
|
13418
|
+
if (r ? a.high >= n.price : a.low <= n.price) return "reached";
|
|
13393
13419
|
}
|
|
13394
13420
|
}
|
|
13395
13421
|
return "pending";
|
|
@@ -13428,11 +13454,11 @@ var wu = class extends K {
|
|
|
13428
13454
|
requiredAnchors: 3,
|
|
13429
13455
|
fill: !0
|
|
13430
13456
|
};
|
|
13431
|
-
target(e,
|
|
13432
|
-
let [r, i
|
|
13457
|
+
target(e, t) {
|
|
13458
|
+
let [n, r, i] = e.anchors, a = y(r.time, t) - y(n.time, t);
|
|
13433
13459
|
return {
|
|
13434
|
-
x:
|
|
13435
|
-
y: c(
|
|
13460
|
+
x: s(y(i.time, t) + a, t),
|
|
13461
|
+
y: c(i.price + (r.price - n.price), t)
|
|
13436
13462
|
};
|
|
13437
13463
|
}
|
|
13438
13464
|
render(e, t, n, r) {
|
|
@@ -13495,32 +13521,32 @@ var wu = class extends K {
|
|
|
13495
13521
|
copied(e) {
|
|
13496
13522
|
let t = this.bars();
|
|
13497
13523
|
if (t.length === 0) return [];
|
|
13498
|
-
let [n, r,
|
|
13499
|
-
if (
|
|
13500
|
-
let
|
|
13501
|
-
if (
|
|
13502
|
-
let
|
|
13503
|
-
return
|
|
13504
|
-
let t =
|
|
13524
|
+
let [n, r, a] = e.anchors, o = Math.max(0, Math.round(i(Math.min(n.time, r.time), t))), s = Math.min(t.length - 1, Math.round(i(Math.max(n.time, r.time), t)));
|
|
13525
|
+
if (s < o) return [];
|
|
13526
|
+
let c = t.slice(o, Math.min(s + 1, o + Su));
|
|
13527
|
+
if (c.length === 0) return [];
|
|
13528
|
+
let l = this.option(e, "flipped"), u = this.option(e, "mirrored") ? [...c].reverse() : c, d = u[0].open, f = (e) => a.price + (l ? d - e : e - d);
|
|
13529
|
+
return u.map((e) => {
|
|
13530
|
+
let t = f(e.high), n = f(e.low);
|
|
13505
13531
|
return {
|
|
13506
13532
|
...e,
|
|
13507
|
-
open:
|
|
13508
|
-
close:
|
|
13533
|
+
open: f(e.open),
|
|
13534
|
+
close: f(e.close),
|
|
13509
13535
|
high: Math.max(t, n),
|
|
13510
13536
|
low: Math.min(t, n)
|
|
13511
13537
|
};
|
|
13512
13538
|
});
|
|
13513
13539
|
}
|
|
13514
|
-
box(e,
|
|
13515
|
-
if (
|
|
13516
|
-
let
|
|
13517
|
-
for (let e of
|
|
13518
|
-
let
|
|
13540
|
+
box(e, t, n) {
|
|
13541
|
+
if (n.length === 0) return null;
|
|
13542
|
+
let r = y(e.anchors[2].time, t), i = s(r, t) - t.barWidth / 2, a = s(r + n.length - 1, t) + t.barWidth / 2, o = -Infinity, l = Infinity;
|
|
13543
|
+
for (let e of n) e.high > o && (o = e.high), e.low < l && (l = e.low);
|
|
13544
|
+
let u = c(o, t), d = c(l, t);
|
|
13519
13545
|
return {
|
|
13520
|
-
x:
|
|
13521
|
-
y: Math.min(
|
|
13522
|
-
width:
|
|
13523
|
-
height: Math.abs(
|
|
13546
|
+
x: i,
|
|
13547
|
+
y: Math.min(u, d),
|
|
13548
|
+
width: a - i,
|
|
13549
|
+
height: Math.abs(d - u)
|
|
13524
13550
|
};
|
|
13525
13551
|
}
|
|
13526
13552
|
render(e, t, n, r) {
|
|
@@ -13528,21 +13554,21 @@ var wu = class extends K {
|
|
|
13528
13554
|
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n);
|
|
13529
13555
|
this.applyLineStyle(e, t.style), e.setLineDash([4, 4]), e.beginPath(), e.moveTo(i.x, i.y), e.lineTo(a.x, a.y), e.stroke(), this.resetLineStyle(e), t.anchors.length >= 3 && this.renderCopy(e, t, n), r && this.renderAnchorHandles(e, t, n);
|
|
13530
13556
|
}
|
|
13531
|
-
renderCopy(e,
|
|
13532
|
-
let
|
|
13533
|
-
if (
|
|
13534
|
-
let
|
|
13535
|
-
if (e.strokeStyle =
|
|
13536
|
-
let
|
|
13537
|
-
|
|
13557
|
+
renderCopy(e, t, n) {
|
|
13558
|
+
let r = this.copied(t);
|
|
13559
|
+
if (r.length === 0) return;
|
|
13560
|
+
let i = y(t.anchors[2].time, n), a = this.option(t, "mode");
|
|
13561
|
+
if (e.strokeStyle = t.style.color, e.fillStyle = t.style.color, e.lineWidth = 1, e.globalAlpha = .7, a === "line") e.beginPath(), r.forEach((t, r) => {
|
|
13562
|
+
let a = s(i + r, n), o = c(t.close, n);
|
|
13563
|
+
r === 0 ? e.moveTo(a, o) : e.lineTo(a, o);
|
|
13538
13564
|
}), e.stroke();
|
|
13539
13565
|
else {
|
|
13540
|
-
let t = Math.max(1,
|
|
13541
|
-
|
|
13542
|
-
let l =
|
|
13543
|
-
if (e.beginPath(), e.moveTo(l, c(
|
|
13544
|
-
let u = c(Math.max(
|
|
13545
|
-
|
|
13566
|
+
let t = Math.max(1, n.barWidth / 2);
|
|
13567
|
+
r.forEach((r, o) => {
|
|
13568
|
+
let l = s(i + o, n);
|
|
13569
|
+
if (e.beginPath(), e.moveTo(l, c(r.high, n)), e.lineTo(l, c(r.low, n)), e.stroke(), a === "highLow") return;
|
|
13570
|
+
let u = c(Math.max(r.open, r.close), n), d = Math.max(1, c(Math.min(r.open, r.close), n) - u);
|
|
13571
|
+
r.close >= r.open ? e.strokeRect(l - t, u, t * 2, d) : e.fillRect(l - t, u, t * 2, d);
|
|
13546
13572
|
});
|
|
13547
13573
|
}
|
|
13548
13574
|
e.globalAlpha = 1;
|
|
@@ -14139,7 +14165,7 @@ function ud(e, t, n, r) {
|
|
|
14139
14165
|
let { chartRect: i } = n, a = r.orderColors?.buy ?? "#1fa874", o = r.orderColors?.sell ?? "#e8505b";
|
|
14140
14166
|
e.lineWidth = 1.5;
|
|
14141
14167
|
for (let r of t) {
|
|
14142
|
-
let t =
|
|
14168
|
+
let t = x(ld(r.time, n), n), s = c(r.price, n);
|
|
14143
14169
|
if (t < i.x || t > i.x + i.width || s < i.y || s > i.y + i.height) continue;
|
|
14144
14170
|
let l = r.side === "buy", u = l ? s + cd : s - cd, d = l ? u + sd : u - sd;
|
|
14145
14171
|
e.beginPath(), e.moveTo(t, u), e.lineTo(t - od, d), e.lineTo(t + od, d), e.closePath();
|
|
@@ -16441,10 +16467,10 @@ var Af = {
|
|
|
16441
16467
|
}
|
|
16442
16468
|
render(e, t, n, r) {
|
|
16443
16469
|
if (!this.visible || !(this.timeframeMs > 0) || r.length === 0) return;
|
|
16444
|
-
let i = r[r.length - 1],
|
|
16445
|
-
if (
|
|
16446
|
-
let
|
|
16447
|
-
c < t.chartRect.x || c > t.chartRect.x + t.chartRect.width || (e.font = `${n.font.sizeSmall}px ${n.font.family}`, e.textBaseline = "bottom", e.textAlign = "center", e.fillStyle = n.textSecondary, e.fillText(
|
|
16470
|
+
let i = r[r.length - 1], a = (i.time > 0xe8d4a51000 ? i.time : i.time * 1e3) + this.timeframeMs - Date.now();
|
|
16471
|
+
if (a <= 0) return;
|
|
16472
|
+
let o = this.formatRemaining(a), c = s(r.length - 1, t), l = t.chartRect.y + t.chartRect.height - 4;
|
|
16473
|
+
c < t.chartRect.x || c > t.chartRect.x + t.chartRect.width || (e.font = `${n.font.sizeSmall}px ${n.font.family}`, e.textBaseline = "bottom", e.textAlign = "center", e.fillStyle = n.textSecondary, e.fillText(o, c, l));
|
|
16448
16474
|
}
|
|
16449
16475
|
formatRemaining(e) {
|
|
16450
16476
|
let t = Math.ceil(e / 1e3), n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), i = t % 60;
|
|
@@ -16548,19 +16574,19 @@ var Af = {
|
|
|
16548
16574
|
if (!this.config.visible || t.length < 2) return [];
|
|
16549
16575
|
let n = this.computeBreaksTyped(t);
|
|
16550
16576
|
if (n.length === 0 || this.cachedMedianStep >= 1380 * 60 * 1e3) return [];
|
|
16551
|
-
let { chartRect: r } = e, i = this.config.lineWidth ?? 1,
|
|
16577
|
+
let { chartRect: r } = e, i = this.config.lineWidth ?? 1, a = [];
|
|
16552
16578
|
for (let t of n) {
|
|
16553
|
-
let n =
|
|
16579
|
+
let n = s(t.idx, e) - (e.barWidth + e.barSpacing) / 2;
|
|
16554
16580
|
if (n < r.x - 1 || n > r.x + r.width + 1) continue;
|
|
16555
|
-
let
|
|
16556
|
-
t.kind === "day" ? c = .22 : t.kind === "week" ? (c = .34, u = Fe(this.locale, Lf, this.tz)(t.time)) : t.kind === "month" ? (c = .5, l = i + .5, u = Fe(this.locale, Rf, this.tz)(t.time)) : (c = .7, l = i + 1, u = String(t.year)),
|
|
16557
|
-
px:
|
|
16581
|
+
let o = Math.round(n) + .5, c = .25, l = i, u = null;
|
|
16582
|
+
t.kind === "day" ? c = .22 : t.kind === "week" ? (c = .34, u = Fe(this.locale, Lf, this.tz)(t.time)) : t.kind === "month" ? (c = .5, l = i + .5, u = Fe(this.locale, Rf, this.tz)(t.time)) : (c = .7, l = i + 1, u = String(t.year)), a.push({
|
|
16583
|
+
px: o,
|
|
16558
16584
|
width: l,
|
|
16559
16585
|
alpha: c,
|
|
16560
16586
|
label: u
|
|
16561
16587
|
});
|
|
16562
16588
|
}
|
|
16563
|
-
return
|
|
16589
|
+
return a;
|
|
16564
16590
|
}
|
|
16565
16591
|
invalidateCache() {
|
|
16566
16592
|
this.lastDataLength = 0, this.cachedBreaksTyped = [], this.cachedMedianStep = 0, this.cacheValid = !1;
|
|
@@ -16640,20 +16666,20 @@ var Gf = {
|
|
|
16640
16666
|
}
|
|
16641
16667
|
rects(e, t, n) {
|
|
16642
16668
|
if (!this.visible || e.length === 0) return [];
|
|
16643
|
-
let { chartRect: r } = t, { from: i, to:
|
|
16644
|
-
if (c <
|
|
16669
|
+
let { chartRect: r } = t, { from: i, to: a } = t.visibleRange, o = Math.max(0, i), c = Math.min(a, e.length - 1);
|
|
16670
|
+
if (c < o) return [];
|
|
16645
16671
|
let l = t.barWidth + t.barSpacing, u = n.name === "light" ? "rgba(0,0,0,0.045)" : "rgba(0,0,0,0.28)", d = [], f = -1, p = (e, n) => {
|
|
16646
|
-
let i =
|
|
16672
|
+
let i = s(e, t) - l / 2, a = s(n, t) + l / 2;
|
|
16647
16673
|
d.push({
|
|
16648
16674
|
x: i,
|
|
16649
16675
|
y: r.y,
|
|
16650
|
-
width:
|
|
16676
|
+
width: a - i,
|
|
16651
16677
|
height: r.height,
|
|
16652
16678
|
color: u,
|
|
16653
16679
|
alpha: 1
|
|
16654
16680
|
});
|
|
16655
16681
|
};
|
|
16656
|
-
for (let t =
|
|
16682
|
+
for (let t = o; t <= c; t++) {
|
|
16657
16683
|
let n = !Wf(e[t].time, this.config);
|
|
16658
16684
|
n && f === -1 ? f = t : !n && f !== -1 && (p(f, t - 1), f = -1);
|
|
16659
16685
|
}
|
|
@@ -17517,31 +17543,31 @@ var Np = (e) => e == null || !Number.isFinite(e) ? "" : String(e), Pp = class {
|
|
|
17517
17543
|
if (!n || n.length === 0) return null;
|
|
17518
17544
|
let { chartRect: r } = t;
|
|
17519
17545
|
if (e.x < r.x || e.x > r.x + r.width || e.y < r.y || e.y > r.y + r.height) return null;
|
|
17520
|
-
let
|
|
17546
|
+
let a = this.style.arrowSize ?? 12;
|
|
17521
17547
|
for (let r = this.markers.length - 1; r >= 0; r--) {
|
|
17522
|
-
let o = this.markers[r],
|
|
17523
|
-
if (Math.abs(e.x -
|
|
17548
|
+
let o = this.markers[r], l = s(i(o.time, n), t), u = c(o.price, t), d = a * Math.max(.6, Math.min(1, o.confidence)), f = o.direction === "long" ? u - d : (o.direction, u - d * .4), p = o.direction === "long" ? u + d * .4 : o.direction === "short" ? u + d : u + d * .4;
|
|
17549
|
+
if (Math.abs(e.x - l) <= d * .6 + Ip && e.y >= f - Ip && e.y <= p + Ip) return o;
|
|
17524
17550
|
}
|
|
17525
17551
|
return null;
|
|
17526
17552
|
}
|
|
17527
17553
|
render(e, t, n) {
|
|
17528
17554
|
let r = this.dataGetter?.();
|
|
17529
17555
|
if (!r || r.length === 0 || this.markers.length === 0) return;
|
|
17530
|
-
let { chartRect:
|
|
17531
|
-
e.save(), e.beginPath(), e.rect(
|
|
17532
|
-
for (let
|
|
17533
|
-
let
|
|
17534
|
-
if (
|
|
17535
|
-
let
|
|
17536
|
-
if (this.renderArrow(e,
|
|
17537
|
-
e.font = `10px ${n.font.family}`, e.fillStyle =
|
|
17538
|
-
let t =
|
|
17539
|
-
e.fillText(
|
|
17556
|
+
let { chartRect: a } = t, o = this.style, l = o.arrowSize ?? 12;
|
|
17557
|
+
e.save(), e.beginPath(), e.rect(a.x, a.y, a.width, a.height), e.clip();
|
|
17558
|
+
for (let u of this.markers) {
|
|
17559
|
+
let d = s(i(u.time, r), t), f = c(u.price, t);
|
|
17560
|
+
if (d < a.x - l || d > a.x + a.width + l || f < a.y - l || f > a.y + a.height + l) continue;
|
|
17561
|
+
let p = this.resolveColor(u, o), m = l * Math.max(.6, Math.min(1, u.confidence));
|
|
17562
|
+
if (this.renderArrow(e, d, f, u.direction, m, p), o.showLabel && u.label) {
|
|
17563
|
+
e.font = `10px ${n.font.family}`, e.fillStyle = p, e.textAlign = "center", e.textBaseline = u.direction === "long" ? "top" : "bottom";
|
|
17564
|
+
let t = u.direction === "long" ? f + m + 3 : f - m - 3;
|
|
17565
|
+
e.fillText(u.label, d, t);
|
|
17540
17566
|
}
|
|
17541
|
-
if (o.showConfidence &&
|
|
17542
|
-
e.font = `9px ${n.font.family}`, e.fillStyle =
|
|
17543
|
-
let t =
|
|
17544
|
-
e.fillText(`${Math.round(
|
|
17567
|
+
if (o.showConfidence && u.confidence < 1) {
|
|
17568
|
+
e.font = `9px ${n.font.family}`, e.fillStyle = p, e.globalAlpha = .7, e.textAlign = "center", e.textBaseline = u.direction === "long" ? "top" : "bottom";
|
|
17569
|
+
let t = u.direction === "long" ? f + m + (u.label ? 14 : 3) : f - m - (u.label ? 14 : 3);
|
|
17570
|
+
e.fillText(`${Math.round(u.confidence * 100)}%`, d, t), e.globalAlpha = 1;
|
|
17545
17571
|
}
|
|
17546
17572
|
}
|
|
17547
17573
|
e.restore();
|
|
@@ -17616,21 +17642,21 @@ var Np = (e) => e == null || !Number.isFinite(e) ? "" : String(e), Pp = class {
|
|
|
17616
17642
|
for (let i of this.zones) this.renderZone(e, i, r, t, n, a);
|
|
17617
17643
|
e.restore();
|
|
17618
17644
|
}
|
|
17619
|
-
renderZone(e, t, n, r,
|
|
17620
|
-
let { chartRect:
|
|
17621
|
-
if (
|
|
17622
|
-
let
|
|
17623
|
-
e.fillStyle = S, e.globalAlpha = o.fillOpacity ?? .12, e.fillRect(
|
|
17645
|
+
renderZone(e, t, n, r, a, o) {
|
|
17646
|
+
let { chartRect: l } = r, u = i(t.entryTime, n), d = t.exitTime == null ? n.length - 1 : i(t.exitTime, n), f = s(u, r), p = s(d, r), m = Math.max(l.x, Math.min(f, p)), h = Math.min(l.x + l.width, Math.max(f, p));
|
|
17647
|
+
if (h - m < 1) return;
|
|
17648
|
+
let g = c(t.entryPrice, r), _ = t.exitPrice == null ? c(t.entryPrice, r) : c(t.exitPrice, r), v = Math.min(g, _), y = Math.max(Math.max(g, _) - v, 2), b = t.exitTime == null, x = t.pnl == null ? t.direction === "long" ? (t.exitPrice ?? t.entryPrice) >= t.entryPrice : (t.exitPrice ?? t.entryPrice) <= t.entryPrice : t.pnl >= 0, S = b ? o.activeColor ?? "#4c8dff" : x ? o.profitColor ?? "#1fa874" : o.lossColor ?? "#e8505b";
|
|
17649
|
+
e.fillStyle = S, e.globalAlpha = o.fillOpacity ?? .12, e.fillRect(m, v, h - m, y), e.globalAlpha = 1;
|
|
17624
17650
|
let C = o.borderWidth ?? 1;
|
|
17625
|
-
e.strokeStyle = S, e.lineWidth = C, e.setLineDash([]), e.beginPath(), e.moveTo(
|
|
17651
|
+
e.strokeStyle = S, e.lineWidth = C, e.setLineDash([]), e.beginPath(), e.moveTo(m, Math.round(g) + .5), e.lineTo(h, Math.round(g) + .5), e.stroke(), !b && t.exitPrice != null && (e.setLineDash([3, 3]), e.beginPath(), e.moveTo(m, Math.round(_) + .5), e.lineTo(h, Math.round(_) + .5), e.stroke(), e.setLineDash([]));
|
|
17626
17652
|
let w = t.direction === "long" ? "▲" : "▼";
|
|
17627
|
-
if (e.font = `bold 10px ${
|
|
17653
|
+
if (e.font = `bold 10px ${a.font.family}`, e.fillStyle = S, e.textBaseline = "bottom", e.textAlign = "left", e.fillText(`${w} ${r.formatPrice?.(t.entryPrice) ?? t.entryPrice.toFixed(this.pricePrecision)}`, m + 4, g - 3), o.showPnl && !b && t.pnl != null) {
|
|
17628
17654
|
let n = t.pnl >= 0 ? "+" : "", r = t.pnlPercent == null ? `${n}${t.pnl.toFixed(2)}` : `${n}${t.pnl.toFixed(2)} (${n}${t.pnlPercent.toFixed(2)}%)`;
|
|
17629
|
-
e.font = `bold 10px ${
|
|
17630
|
-
let
|
|
17631
|
-
e.globalAlpha = .85, e.fillStyle =
|
|
17655
|
+
e.font = `bold 10px ${a.font.family}`, e.fillStyle = S, e.textBaseline = "top", e.textAlign = "right";
|
|
17656
|
+
let i = e.measureText(r).width + 8, o = h - i - 2, s = v + 2;
|
|
17657
|
+
e.globalAlpha = .85, e.fillStyle = a.background, F(e, o, s, i, 14, a), e.globalAlpha = 1, e.fillStyle = S, e.fillText(r, h - 4, s + 1);
|
|
17632
17658
|
}
|
|
17633
|
-
o.showLabel && t.label && (e.font = `9px ${
|
|
17659
|
+
o.showLabel && t.label && (e.font = `9px ${a.font.family}`, e.fillStyle = S, e.globalAlpha = .8, e.textBaseline = "top", e.textAlign = "left", e.fillText(t.label, m + 4, g + 3), e.globalAlpha = 1);
|
|
17634
17660
|
}
|
|
17635
17661
|
}, Bp = class {
|
|
17636
17662
|
active = !1;
|
|
@@ -17643,26 +17669,26 @@ var Np = (e) => e == null || !Number.isFinite(e) ? "" : String(e), Pp = class {
|
|
|
17643
17669
|
isActive() {
|
|
17644
17670
|
return this.active;
|
|
17645
17671
|
}
|
|
17646
|
-
begin(t, n,
|
|
17647
|
-
let
|
|
17648
|
-
this.startBar =
|
|
17672
|
+
begin(t, n, r) {
|
|
17673
|
+
let i = Math.round(b(t.x, n)), a = e(t.y, n);
|
|
17674
|
+
this.startBar = i, this.startPrice = a, this.endBar = i, this.endPrice = a, this.startTime = Vp(i, r), this.endTime = this.startTime, this.active = !0;
|
|
17649
17675
|
}
|
|
17650
|
-
update(t, n,
|
|
17676
|
+
update(t, n, r) {
|
|
17651
17677
|
if (!this.active) return;
|
|
17652
|
-
let
|
|
17653
|
-
this.endBar =
|
|
17678
|
+
let i = Math.round(b(t.x, n));
|
|
17679
|
+
this.endBar = i, this.endPrice = e(t.y, n), this.endTime = Vp(i, r);
|
|
17654
17680
|
}
|
|
17655
17681
|
end() {
|
|
17656
17682
|
this.active = !1;
|
|
17657
17683
|
}
|
|
17658
17684
|
render(e, t, n) {
|
|
17659
17685
|
if (!this.active) return;
|
|
17660
|
-
let r =
|
|
17686
|
+
let r = s(this.startBar, t), i = s(this.endBar, t), a = c(this.startPrice, t), o = c(this.endPrice, t), l = Math.min(r, i), u = Math.max(r, i), d = Math.min(a, o), f = Math.max(a, o), p = u - l, m = f - d, h = this.endPrice >= this.startPrice ? n.candleUp : n.candleDown, g = qp(h, .14);
|
|
17661
17687
|
e.save();
|
|
17662
17688
|
let { chartRect: _ } = t;
|
|
17663
|
-
e.beginPath(), e.rect(_.x, _.y, _.width, _.height), e.clip(), e.fillStyle = g, e.fillRect(l, d, p, m), e.strokeStyle = h, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(l + .5, d + .5, p, m), e.setLineDash([]), e.strokeStyle = h, e.lineWidth = 1.5, e.beginPath(), e.moveTo(r,
|
|
17689
|
+
e.beginPath(), e.rect(_.x, _.y, _.width, _.height), e.clip(), e.fillStyle = g, e.fillRect(l, d, p, m), e.strokeStyle = h, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(l + .5, d + .5, p, m), e.setLineDash([]), e.strokeStyle = h, e.lineWidth = 1.5, e.beginPath(), e.moveTo(r, a), e.lineTo(i, o), e.stroke(), Wp(e, r, a, h), Wp(e, i, o, h), e.restore();
|
|
17664
17690
|
let v = Math.abs(this.endBar - this.startBar), y = this.endPrice - this.startPrice, b = this.startPrice === 0 ? 0 : y / this.startPrice * 100, x = this.startTime !== null && this.endTime !== null ? Up(Math.abs(this.endTime - this.startTime)) : null, S = [], C = y > 0 ? "+" : y < 0 ? "−" : "", w = Math.abs(y);
|
|
17665
|
-
S.push(`${C}${t.formatPrice?.(w) ?? Hp(w)} (${C}${Math.abs(b).toFixed(2)}%)`), S.push(`${v} bars${x ? " · " + x : ""}`), e.save(), Gp(e, i,
|
|
17691
|
+
S.push(`${C}${t.formatPrice?.(w) ?? Hp(w)} (${C}${Math.abs(b).toFixed(2)}%)`), S.push(`${v} bars${x ? " · " + x : ""}`), e.save(), Gp(e, i, o, S, h, n), e.restore();
|
|
17666
17692
|
}
|
|
17667
17693
|
};
|
|
17668
17694
|
function Vp(e, t) {
|
|
@@ -18651,6 +18677,6 @@ function Kh(e, t, n, r, i, a) {
|
|
|
18651
18677
|
e.save(), e.fillStyle = i.background, e.fillRect(0, 0, t, n), Rh(e, o, r.zones, l, r.trackColor ?? i.grid, p), zh(e, o, i.textSecondary), s && (d ? Vh(e, o, l, r.needleColor ?? i.text, i.background) : Bh(e, o, l, p, i.background)), r.showValue !== !1 && Uh(e, o, s ? f(c) : "—", r.label, u, i, d), Wh(e, o, f, i), r.showZoneLabels === !0 && r.zones?.length && Gh(e, o, r.zones, i), e.restore();
|
|
18652
18678
|
}
|
|
18653
18679
|
//#endregion
|
|
18654
|
-
export { Lc as ABCDPatternTool, xr as ADXIndicator, Fi as ALMAIndicator, br as ATRIndicator, Ke as AXIS_LABEL_HEIGHT, li as AcceleratorOscillatorIndicator, _i as AccumulationDistributionIndicator, La as AlertDragHandler, op as AlertManager, or as AlligatorIndicator, Zn as AnchoredVWAPIndicator, uc as AnchoredVWAPTool, Zp as Animator, Ql as ArcTool, xt as AreaRenderer, Er as AroonIndicator, Nl as ArrowMarkTool, ac as ArrowTool, oa as AverageDayRangeIndicator, hr as AwesomeOscillatorIndicator, Ia as AxisDragHandler, Jr as BalanceOfPowerIndicator, Pf as BarCountdown, St as BarRenderer, Eu as BarsPatternTool, $p as BaseFinanceChart, wt as BaselineRenderer, rf as BinanceAdapter, qi as BollingerBandWidthIndicator, Hn as BollingerBandsIndicator, Ki as BollingerPercentBIndicator, Zu as BracketTool, Gl as BrushTool, vf as BybitAdapter, wr as CCIIndicator, kr as CMFIndicator, Tl as CalloutTool, tt as CandlestickRenderer, Ie as CanvasLayer, gr as ChaikinOscillatorIndicator, ni as ChaikinVolatilityIndicator, Ui as ChandeKrollStopIndicator, Xr as ChandeMomentumIndicator, ar as ChandelierExitIndicator, jf as ChartLegend, Op as ChartStateManager, Mr as ChoppinessIndexIndicator, Vc as CircleTool, ff as CoinbaseAdapter, on as CompareRenderer, _a as CompareSymbolIndicator, Ir as ConnorsRSIIndicator, Rr as CoppockIndicator, bc as CrossLineTool, Ba as CrosshairHandler, to as CrosshairTooltip, bd as CurrentPriceLine, Zl as CurveTool, Zc as CyclicLinesTool, Bc as CypherPatternTool, Af as DEFAULT_LEGEND_CONFIG, Gf as DEFAULT_SESSION_HOURS, Ni as DEMAIndicator,
|
|
18680
|
+
export { Lc as ABCDPatternTool, xr as ADXIndicator, Fi as ALMAIndicator, br as ATRIndicator, Ke as AXIS_LABEL_HEIGHT, li as AcceleratorOscillatorIndicator, _i as AccumulationDistributionIndicator, La as AlertDragHandler, op as AlertManager, or as AlligatorIndicator, Zn as AnchoredVWAPIndicator, uc as AnchoredVWAPTool, Zp as Animator, Ql as ArcTool, xt as AreaRenderer, Er as AroonIndicator, Nl as ArrowMarkTool, ac as ArrowTool, oa as AverageDayRangeIndicator, hr as AwesomeOscillatorIndicator, Ia as AxisDragHandler, Jr as BalanceOfPowerIndicator, Pf as BarCountdown, St as BarRenderer, Eu as BarsPatternTool, $p as BaseFinanceChart, wt as BaselineRenderer, rf as BinanceAdapter, qi as BollingerBandWidthIndicator, Hn as BollingerBandsIndicator, Ki as BollingerPercentBIndicator, Zu as BracketTool, Gl as BrushTool, vf as BybitAdapter, wr as CCIIndicator, kr as CMFIndicator, Tl as CalloutTool, tt as CandlestickRenderer, Ie as CanvasLayer, gr as ChaikinOscillatorIndicator, ni as ChaikinVolatilityIndicator, Ui as ChandeKrollStopIndicator, Xr as ChandeMomentumIndicator, ar as ChandelierExitIndicator, jf as ChartLegend, Op as ChartStateManager, Mr as ChoppinessIndexIndicator, Vc as CircleTool, ff as CoinbaseAdapter, on as CompareRenderer, _a as CompareSymbolIndicator, Ir as ConnorsRSIIndicator, Rr as CoppockIndicator, bc as CrossLineTool, Ba as CrosshairHandler, to as CrosshairTooltip, bd as CurrentPriceLine, Zl as CurveTool, Zc as CyclicLinesTool, Bc as CypherPatternTool, Af as DEFAULT_LEGEND_CONFIG, Gf as DEFAULT_SESSION_HOURS, Ni as DEMAIndicator, p as DENSE_BAR_WIDTH, ze as DPRManager, Pp as DataExporter, qc as DateAndPriceRangeTool, tc as DateRangeTool, tn as DepthHeatmapBuffer, nn as DepthHeatmapRenderer, Gu as DepthOverlay, qr as DetrendedPriceOscillatorIndicator, fi as DisparityIndexIndicator, Jn as DonchianChannelIndicator, K as DrawingBase, Wo as DrawingManager, gs as DrawingRenderer, Vn as EMAIndicator, $r as EaseOfMovementIndicator, Xp as Easing, Hr as ElderRayIndicator, Xs as ElliottCorrectionTool, Qs as ElliottDoubleComboTool, Ys as ElliottImpulseTool, Zs as ElliottTriangleTool, $s as ElliottTripleComboTool, Js as ElliottWaveTool, zs as EllipseTool, _d as Emitter, ur as EnvelopeIndicator, kt as EquivolumeRenderer, uo as EventBus, Os as ExtendedLineTool, uu as FibArcsTool, Ac as FibChannelTool, lu as FibCirclesTool, Ls as FibExtensionTool, Fs as FibRetracementTool, Pc as FibSpeedResistanceFanTool, pu as FibSpiralTool, pc as FibTimeZonesTool, du as FibWedgeTool, em as FinanceCrosshair, Kr as FisherTransformIndicator, Al as FlagTool, Fr as ForceIndexIndicator, wu as ForecastTool, lc as GannBoxTool, sc as GannFanTool, mu as GannSquareTool, ya as GridRenderer, da as GuppyMMAIndicator, jt as HLCAreaRenderer, Rc as HeadAndShouldersTool, It as HiLoRenderer, Kl as HighlighterTool, Yi as HistoricalVolatilityIndicator, Ct as HollowCandleRenderer, ws as HorizontalLineTool, Ts as HorizontalRayTool, er as HullMAIndicator, Pl as ICON_GLYPHS, Wn as IchimokuIndicator, Il as IconTool, R as IndicatorBase, In as IndicatorEngine, z as IndicatorValueMap, ha as IndicatorWorkerHost, Ec as InfoLineTool, Ta as InteractionManager, Ii as KAMAIndicator, zr as KSTIndicator, Et as KagiRenderer, qn as KeltnerChannelIndicator, Ga as KeyboardHandler, Gr as KlingerIndicator, Tf as KrakenAdapter, Li as LSMAIndicator, Le as LayerManager, bt as LineRenderer, Nt as LineWithMarkersRenderer, $n as LinearRegressionChannelIndicator, ia as LinearRegressionSlopeIndicator, vr as MACDIndicator, Bi as MACrossIndicator, fa as MARibbonIndicator, Zf as MAX_ALERT_BARS, Cd as MAX_BASE_RATIO, Sd as MAX_BASE_REQUESTS, Tr as MFIIndicator, Qf as MIN_ALERT_BARS, ct as MIN_BAR_UNIT, rr as MTFMovingAverageIndicator, Wt as MarketProfileRenderer, Yr as MassIndexIndicator, Ri as McGinleyDynamicIndicator, Bp as MeasureOverlay, nc as MeasureTool, af as MockAdapter, Us as ModifiedSchiffPitchforkTool, Ji as MomentumIndicator, sa as NetVolumeIndicator, wl as NoteTool, Sr as OBVIndicator, rd as OrderDraftTool, Fu as OrderRenderer, Pa as PanHandler, Ra as PaneResizeHandler, md as PaperExecutionAdapter, Gn as ParabolicSARIndicator, ks as ParallelChannelTool, ql as PathTool, si as PercentagePriceOscillatorIndicator, Yt as PeriodLevelsRenderer, ao as PinnedTooltip, fu as PitchfanTool, Vs as PitchforkTool, $t as PivotMarkersRenderer, Xn as PivotPointsIndicator, Dt as PointAndFigureRenderer, cf as PollingAdapter, Jl as PolylineTool, Wu as PositionRenderer, mi as PrettyGoodOscillatorIndicator, We as PriceAxis, Oa as PriceAxisAddButton, nl as PriceLabelTool, Yf as PriceLines, ec as PriceRangeTool, ei as PriceVolumeTrendIndicator, Tu as ProjectionTool, pi as QstickIndicator, dt as RANGE_PRESETS, Dr as ROCIndicator, _r as RSIIndicator, Ds as RayTool, yd as ReconnectManager, Rs as RectangleTool, As as RegressionChannelTool, di as RelativeMomentumIndexIndicator, ri as RelativeVigorIndicator, na as RelativeVolatilityIndexIndicator, ot as RenderEngine, Re as RenderLoop, Tt as RenkoRenderer, Hd as ReplayController, lp as ReplayManager, jd as ResamplingAdapter, yc as RiskRewardTool, Jp as SELECTION_BOX_MIN_SIZE, Bn as SMAIndicator, Pi as SMMAIndicator, up as SNAPSHOT_VERSION, Ur as SchaffTrendCycleIndicator, Hs as SchiffPitchforkTool, Mf as Screenshot, Yp as SelectionBoxOverlay, If as SessionBreaks, Kf as SessionShading, ir as SessionVWAPIndicator, Lp as SignalMarkerManager, yu as SineLineTool, va as SpreadIndicator, ca as StandardErrorBandsIndicator, aa as StandardErrorIndicator, hi as StdDevIndicator, Mt as StepLineRenderer, yr as StochasticIndicator, ta as StochasticMomentumIndexIndicator, ii as StochasticRSIIndicator, Vd as StreamManager, Kn as SupertrendIndicator, an as SymbolSeriesStore, mr as TEMAIndicator, Zr as TRIXIndicator, Or as TSIIndicator, ic as TextAnnotationTool, zc as ThreeDrivesTool, vd as TickAggregator, Id as TickBarAdapter, Fd as TickBarBuilder, xa as TimeAxis, vu as TimeCyclesTool, zp as TradeZoneManager, qu as TradingContextMenu, Ku as TradingDragHandler, fd as TradingManager, pd as TradingRenderer, wc as TrendAngleTool, Cs as TrendLineTool, ra as TrendStrengthIndexIndicator, Bs as TriangleTool, Qi as UlcerIndexIndicator, Nr as UltimateOscillatorIndicator, kp as UndoRedoManager, vi as VROCIndicator, Un as VWAPIndicator, cr as VWMAIndicator, Es as VerticalLineTool, lt as Viewport, Ot as VolumeCandleRenderer, Ar as VolumeDeltaIndicator, Xi as VolumeOscillatorIndicator, gi as VolumeProfileIndicator, dc as VolumeProfileRangeTool, Rt as VolumeProfileRenderer, Lt as VolumeRenderer, jr as VortexIndicator, lr as WMAIndicator, Nf as Watermark, sf as WebSocketAdapter, ti as WilliamsADIndicator, Hi as WilliamsFractalsIndicator, Cr as WilliamsRIndicator, Ic as XABCDPatternTool, Qn as ZigZagIndicator, Fa as ZoomHandler, Nn as alignOutput, Xl as arcPoints, Ht as assignSessionLetters, o as barIndexToTime, s as barIndexToX, m as barTimeStep, f as barTimeStepMs, Yu as bracketRiskReward, Zt as classifyPivots, Ju as computeBracketDefaults, Bt as computeMarketProfile, Jt as computePeriodLevels, Ut as computeSessionProfiles, Yl as curvePoints, Ze as drawAxisValueLabels, _n as drawnKeys, F as fillTag, _s as findDominantSwing, Qt as findPivots, h as forEachPixelColumn, Cu as forecastOutcome, $a as formatTooltipTime, V as getIntParam, B as getNumberParam, ut as getVisibleData, Cn as hasHistogram, zd as hasTrades, Ge as indicatorValuePrecision, td as inferOrderType, An as inputSource, u as isDense, Uf as isInWindow, ep as isPriceLevelAlert, Wf as isRegularSession, vn as isUpTone, ma as isWorkerResponse, Je as labelTextColor, Xe as layoutAxisValueLabels, zm as layoutSquarifiedTreemap, Fm as layoutUniformGrid, Mn as lineSourceBars, po as lineSpace, st as loadWebGLRenderer, _t as lttbDownsample, yt as lttbVisibleIndices, Vf as mergeSessionHours, Hf as minuteOfDay, xn as paneLogRange, bn as paneValueRange, yn as plotColor, l as priceBucketRow, jn as priceSourceBars, c as priceToY, n as priceToYMapper, gt as rangePresetStart, cp as readAlertOptions, Du as registerBuiltInDrawingTools, pa as registerBuiltInIndicators, Qe as renderAxisValueLabels, r as renderDenseBars, gm as renderDepthChart, Pm as renderEquityCurve, Kh as renderGauge, Km as renderHeatmap, wn as renderPlots, tm as renderSparkline, fh as renderWaterfall, y as resolveBarIndex, Od as servesTimeframe, kn as sourceParam, qe as spreadLabels, x as timeToX, i as timestampToBarIndex, sn as toHeikinAshi, dn as toKagi, un as toLineBreak, fn as toPointAndFigure, pn as toRangeBars, cn as toRenko, Vt as tpoLetter, Gs as waveLabel, Ed as withResampling, Rd as withTickBars, b as xToBarIndex, t as xToTime, e as yToPrice };
|
|
18655
18681
|
|
|
18656
18682
|
//# sourceMappingURL=index.js.map
|