@363045841yyt/klinechart 0.2.11 → 0.2.13

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/index.js CHANGED
@@ -6635,6 +6635,12 @@ var Vi = (typeof document < "u" ? document.createElement("canvas") : null)?.getC
6635
6635
  case "BOLL":
6636
6636
  this.applyBOLLIndicator(t);
6637
6637
  break;
6638
+ case "EXPMA":
6639
+ this.applyEXPMAIndicator(t);
6640
+ break;
6641
+ case "ENE":
6642
+ this.applyENEIndicator(t);
6643
+ break;
6638
6644
  }
6639
6645
  }
6640
6646
  if (this.chart.clearSubPanes(), t) for (let e of t) this.applySubIndicator(e);
@@ -6655,7 +6661,21 @@ var Vi = (typeof document < "u" ? document.createElement("canvas") : null)?.getC
6655
6661
  period: e.params?.period || 20,
6656
6662
  multiplier: e.params?.multiplier || 2
6657
6663
  };
6658
- this.chart.updateRendererConfig("boll", t), this.chart.setRendererEnabled("boll", e.enabled);
6664
+ this.chart.updateRendererConfig("boll", t);
6665
+ }
6666
+ applyEXPMAIndicator(e) {
6667
+ let t = {
6668
+ fastPeriod: e.params?.fastPeriod || 12,
6669
+ slowPeriod: e.params?.slowPeriod || 50
6670
+ };
6671
+ this.chart.updateRendererConfig("expma", t);
6672
+ }
6673
+ applyENEIndicator(e) {
6674
+ let t = {
6675
+ period: e.params?.period || 10,
6676
+ deviation: e.params?.deviation || 11
6677
+ };
6678
+ this.chart.updateRendererConfig("ene", t);
6659
6679
  }
6660
6680
  applySubIndicator(e) {
6661
6681
  if (!e.enabled) return;
@@ -6801,7 +6821,8 @@ function aa(e) {
6801
6821
  priceToY: (t) => e.yAxis.priceToY(t),
6802
6822
  yToPrice: (t) => e.yAxis.yToPrice(t),
6803
6823
  getPaddingTop: () => e.yAxis.getPaddingTop(),
6804
- getPaddingBottom: () => e.yAxis.getPaddingBottom()
6824
+ getPaddingBottom: () => e.yAxis.getPaddingBottom(),
6825
+ getPriceOffset: () => e.yAxis.getPriceOffset()
6805
6826
  },
6806
6827
  priceRange: e.priceRange
6807
6828
  };
@@ -7358,57 +7379,65 @@ var Da = {
7358
7379
  KST: "rgba(69, 112, 249, 1)",
7359
7380
  SIGNAL: "rgba(255, 152, 0, 1)"
7360
7381
  }, Ba = {
7382
+ FAST: "rgba(255, 152, 0, 1)",
7383
+ SLOW: "rgba(69, 112, 249, 1)"
7384
+ }, Va = {
7385
+ UPPER: "rgba(214, 10, 34, 1)",
7386
+ MIDDLE: "rgba(69, 112, 249, 1)",
7387
+ LOWER: "rgba(3, 123, 102, 1)",
7388
+ BAND_FILL: "rgba(69, 112, 249, 0.08)"
7389
+ }, Ha = {
7361
7390
  LINE: "rgba(0, 0, 0, 0.28)",
7362
7391
  LABEL_BG: "rgb(0, 0, 0)",
7363
7392
  LABEL_TEXT: "rgba(255, 255, 255, 0.92)"
7364
- }, Va = X.UP, Ha = X.DOWN, Ua = X.NEUTRAL;
7365
- function Wa(e) {
7366
- return e > 0 ? Va : e < 0 ? Ha : Ua;
7393
+ }, Ua = X.UP, Wa = X.DOWN, Ga = X.NEUTRAL;
7394
+ function Ka(e) {
7395
+ return e > 0 ? Ua : e < 0 ? Wa : Ga;
7367
7396
  }
7368
- function Ga(e, t = 2) {
7397
+ function qa(e, t = 2) {
7369
7398
  let n = Math.abs(e);
7370
7399
  return n >= 1e8 ? `${(e / 1e8).toFixed(t)}亿` : n >= 1e4 ? `${(e / 1e4).toFixed(t)}万` : `${Math.round(e)}`;
7371
7400
  }
7372
- function Ka(e, t = 2) {
7401
+ function Ja(e, t = 2) {
7373
7402
  return `${e > 0 ? "+" : ""}${e.toFixed(t)}`;
7374
7403
  }
7375
- function qa(e, t = 2) {
7404
+ function Ya(e, t = 2) {
7376
7405
  return `${e.toFixed(t)}%`;
7377
7406
  }
7378
- function Ja(e, t = 2) {
7407
+ function Xa(e, t = 2) {
7379
7408
  return `${e > 0 ? "+" : ""}${e.toFixed(t)}%`;
7380
7409
  }
7381
- function Ya(e, t) {
7410
+ function Za(e, t) {
7382
7411
  let n = t?.close ?? e.open;
7383
- return Wa(e.open - n);
7412
+ return Ka(e.open - n);
7384
7413
  }
7385
- function Xa(e) {
7386
- return Wa(e.close - e.open);
7414
+ function Qa(e) {
7415
+ return Ka(e.close - e.open);
7387
7416
  }
7388
- function Za(e) {
7389
- return typeof e.changePercent == "number" ? Wa(e.changePercent) : typeof e.changeAmount == "number" ? Wa(e.changeAmount) : Ua;
7417
+ function $a(e) {
7418
+ return typeof e.changePercent == "number" ? Ka(e.changePercent) : typeof e.changeAmount == "number" ? Ka(e.changeAmount) : Ga;
7390
7419
  }
7391
7420
  //#endregion
7392
7421
  //#region src/components/KLineTooltip.vue?vue&type=script&setup=true&lang.ts
7393
- var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "kline-tooltip__grid" }, to = { class: "row" }, no = { class: "row" }, ro = { class: "row" }, io = { class: "row" }, ao = {
7422
+ var eo = { class: "kline-tooltip__title" }, to = { key: 0 }, no = { class: "kline-tooltip__grid" }, ro = { class: "row" }, io = { class: "row" }, ao = { class: "row" }, oo = { class: "row" }, so = {
7394
7423
  key: 0,
7395
7424
  class: "row"
7396
- }, oo = {
7425
+ }, co = {
7397
7426
  key: 1,
7398
7427
  class: "row"
7399
- }, so = {
7428
+ }, lo = {
7400
7429
  key: 2,
7401
7430
  class: "row"
7402
- }, co = {
7431
+ }, uo = {
7403
7432
  key: 3,
7404
7433
  class: "row"
7405
- }, lo = {
7434
+ }, fo = {
7406
7435
  key: 4,
7407
7436
  class: "row"
7408
- }, uo = {
7437
+ }, po = {
7409
7438
  key: 5,
7410
7439
  class: "row"
7411
- }, fo = /* @__PURE__ */ u({
7440
+ }, mo = /* @__PURE__ */ u({
7412
7441
  __name: "KLineTooltip",
7413
7442
  props: {
7414
7443
  k: {},
@@ -7424,15 +7453,15 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
7424
7453
  }
7425
7454
  let i = r(() => {
7426
7455
  let e = t.k;
7427
- if (!e) return Ua;
7456
+ if (!e) return Ga;
7428
7457
  let n = t.index;
7429
- return Ya(e, typeof n == "number" && n > 0 ? t.data[n - 1] : void 0);
7458
+ return Za(e, typeof n == "number" && n > 0 ? t.data[n - 1] : void 0);
7430
7459
  }), c = r(() => {
7431
7460
  let e = t.k;
7432
- return e ? Xa(e) : Ua;
7461
+ return e ? Qa(e) : Ga;
7433
7462
  }), l = r(() => {
7434
7463
  let e = t.k;
7435
- return e ? Za(e) : Ua;
7464
+ return e ? $a(e) : Ga;
7436
7465
  });
7437
7466
  return (t, r) => e.k ? (g(), o("div", {
7438
7467
  key: 0,
@@ -7442,29 +7471,29 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
7442
7471
  left: `${e.pos.x}px`,
7443
7472
  top: `${e.pos.y}px`
7444
7473
  })
7445
- }, [s("div", Qa, [e.k.stockCode ? (g(), o("span", $a, b(e.k.stockCode), 1)) : a("", !0), s("span", null, b(x(wa)(e.k.timestamp)), 1)]), s("div", eo, [
7446
- s("div", to, [r[0] ||= s("span", null, "开", -1), s("span", { style: p({ color: i.value }) }, b(e.k.open.toFixed(2)), 5)]),
7447
- s("div", no, [r[1] ||= s("span", null, "高", -1), s("span", null, b(e.k.high.toFixed(2)), 1)]),
7448
- s("div", ro, [r[2] ||= s("span", null, "低", -1), s("span", null, b(e.k.low.toFixed(2)), 1)]),
7449
- s("div", io, [r[3] ||= s("span", null, "收", -1), s("span", { style: p({ color: c.value }) }, b(e.k.close.toFixed(2)), 5)]),
7450
- typeof e.k.volume == "number" ? (g(), o("div", ao, [r[4] ||= s("span", null, "成交量", -1), s("span", null, b(x(Ga)(e.k.volume)), 1)])) : a("", !0),
7451
- typeof e.k.turnover == "number" ? (g(), o("div", oo, [r[5] ||= s("span", null, "成交额", -1), s("span", null, b(x(Ga)(e.k.turnover)), 1)])) : a("", !0),
7452
- typeof e.k.amplitude == "number" ? (g(), o("div", so, [r[6] ||= s("span", null, "振幅", -1), s("span", null, b(e.k.amplitude) + "%", 1)])) : a("", !0),
7453
- typeof e.k.changePercent == "number" ? (g(), o("div", co, [r[7] ||= s("span", null, "涨跌幅", -1), s("span", { style: p({ color: l.value }) }, b(x(Ja)(e.k.changePercent)), 5)])) : a("", !0),
7454
- typeof e.k.changeAmount == "number" ? (g(), o("div", lo, [r[8] ||= s("span", null, "涨跌额", -1), s("span", { style: p({ color: l.value }) }, b(x(Ka)(e.k.changeAmount)), 5)])) : a("", !0),
7455
- typeof e.k.turnoverRate == "number" ? (g(), o("div", uo, [r[9] ||= s("span", null, "换手率", -1), s("span", null, b(x(qa)(e.k.turnoverRate)), 1)])) : a("", !0)
7474
+ }, [s("div", eo, [e.k.stockCode ? (g(), o("span", to, b(e.k.stockCode), 1)) : a("", !0), s("span", null, b(x(wa)(e.k.timestamp)), 1)]), s("div", no, [
7475
+ s("div", ro, [r[0] ||= s("span", null, "开", -1), s("span", { style: p({ color: i.value }) }, b(e.k.open.toFixed(2)), 5)]),
7476
+ s("div", io, [r[1] ||= s("span", null, "高", -1), s("span", null, b(e.k.high.toFixed(2)), 1)]),
7477
+ s("div", ao, [r[2] ||= s("span", null, "低", -1), s("span", null, b(e.k.low.toFixed(2)), 1)]),
7478
+ s("div", oo, [r[3] ||= s("span", null, "收", -1), s("span", { style: p({ color: c.value }) }, b(e.k.close.toFixed(2)), 5)]),
7479
+ typeof e.k.volume == "number" ? (g(), o("div", so, [r[4] ||= s("span", null, "成交量", -1), s("span", null, b(x(qa)(e.k.volume)), 1)])) : a("", !0),
7480
+ typeof e.k.turnover == "number" ? (g(), o("div", co, [r[5] ||= s("span", null, "成交额", -1), s("span", null, b(x(qa)(e.k.turnover)), 1)])) : a("", !0),
7481
+ typeof e.k.amplitude == "number" ? (g(), o("div", lo, [r[6] ||= s("span", null, "振幅", -1), s("span", null, b(e.k.amplitude) + "%", 1)])) : a("", !0),
7482
+ typeof e.k.changePercent == "number" ? (g(), o("div", uo, [r[7] ||= s("span", null, "涨跌幅", -1), s("span", { style: p({ color: l.value }) }, b(x(Xa)(e.k.changePercent)), 5)])) : a("", !0),
7483
+ typeof e.k.changeAmount == "number" ? (g(), o("div", fo, [r[8] ||= s("span", null, "涨跌额", -1), s("span", { style: p({ color: l.value }) }, b(x(Ja)(e.k.changeAmount)), 5)])) : a("", !0),
7484
+ typeof e.k.turnoverRate == "number" ? (g(), o("div", po, [r[9] ||= s("span", null, "换手率", -1), s("span", null, b(x(Ya)(e.k.turnoverRate)), 1)])) : a("", !0)
7456
7485
  ])], 4)) : a("", !0);
7457
7486
  }
7458
- }), po = (e, t) => {
7487
+ }), ho = (e, t) => {
7459
7488
  let n = e.__vccOpts || e;
7460
7489
  for (let [e, r] of t) n[e] = r;
7461
7490
  return n;
7462
- }, mo = /* @__PURE__ */ po(fo, [["__scopeId", "data-v-95daa55c"]]), ho = {
7491
+ }, go = /* @__PURE__ */ ho(mo, [["__scopeId", "data-v-95daa55c"]]), _o = {
7463
7492
  RISE_WITH_VOLUME: "量价齐升",
7464
7493
  RISE_WITHOUT_VOLUME: "量缩价升",
7465
7494
  FALL_WITH_VOLUME: "量价齐缩",
7466
7495
  FALL_WITHOUT_VOLUME: "量升价缩"
7467
- }, go = class {
7496
+ }, vo = class {
7468
7497
  markers = /* @__PURE__ */ new Map();
7469
7498
  hoveredMarkerId = null;
7470
7499
  lastHoveredId = null;
@@ -7526,10 +7555,10 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
7526
7555
  }
7527
7556
  return null;
7528
7557
  }
7529
- }, _o = { class: "marker-tooltip__title" }, vo = {
7558
+ }, yo = { class: "marker-tooltip__title" }, bo = {
7530
7559
  key: 0,
7531
7560
  class: "marker-tooltip__content"
7532
- }, yo = /* @__PURE__ */ po(/* @__PURE__ */ u({
7561
+ }, xo = /* @__PURE__ */ ho(/* @__PURE__ */ u({
7533
7562
  __name: "MarkerTooltip",
7534
7563
  props: {
7535
7564
  marker: {},
@@ -7543,7 +7572,7 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
7543
7572
  return e.label?.text || e.shape;
7544
7573
  }
7545
7574
  let e = n.marker;
7546
- return ho[e.markerType] || e.markerType;
7575
+ return _o[e.markerType] || e.markerType;
7547
7576
  }), l = r(() => {
7548
7577
  if (!n.marker) return {};
7549
7578
  if (i.value) {
@@ -7565,27 +7594,27 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
7565
7594
  left: `${t.pos.x + 12}px`,
7566
7595
  top: `${t.pos.y + 12}px`
7567
7596
  })
7568
- }, [s("div", _o, b(c.value), 1), u.value ? (g(), o("div", vo, [(g(!0), o(e, null, v(l.value, (e, t) => (g(), o("div", {
7597
+ }, [s("div", yo, b(c.value), 1), u.value ? (g(), o("div", bo, [(g(!0), o(e, null, v(l.value, (e, t) => (g(), o("div", {
7569
7598
  key: t,
7570
7599
  class: "row"
7571
7600
  }, [s("span", null, b(t), 1), s("span", null, b(d(e)), 1)]))), 128))])) : a("", !0)], 4)) : a("", !0);
7572
7601
  }
7573
- }), [["__scopeId", "data-v-dd43da4f"]]), bo = { class: "params-header" }, xo = { class: "header-left" }, So = { class: "params-title" }, Co = { class: "header-right" }, wo = {
7602
+ }), [["__scopeId", "data-v-dd43da4f"]]), So = { class: "params-header" }, Co = { class: "header-left" }, wo = { class: "params-title" }, To = { class: "header-right" }, Eo = {
7574
7603
  key: 0,
7575
7604
  class: "indicator-description"
7576
- }, To = { class: "params-body" }, Eo = { class: "param-header" }, Do = { class: "param-label" }, Oo = { class: "param-label-text" }, ko = {
7605
+ }, Do = { class: "params-body" }, Oo = { class: "param-header" }, ko = { class: "param-label" }, Ao = { class: "param-label-text" }, jo = {
7577
7606
  key: 0,
7578
7607
  class: "param-range"
7579
- }, Ao = { class: "input-wrapper" }, jo = ["disabled", "onClick"], Mo = [
7608
+ }, Mo = { class: "input-wrapper" }, No = ["disabled", "onClick"], Po = [
7580
7609
  "value",
7581
7610
  "min",
7582
7611
  "max",
7583
7612
  "step",
7584
7613
  "onInput"
7585
- ], No = ["disabled", "onClick"], Po = {
7614
+ ], Fo = ["disabled", "onClick"], Io = {
7586
7615
  key: 0,
7587
7616
  class: "param-description"
7588
- }, Fo = { class: "params-footer" }, Io = { class: "footer-right" }, Lo = /* @__PURE__ */ po(/* @__PURE__ */ u({
7617
+ }, Lo = { class: "params-footer" }, Ro = { class: "footer-right" }, zo = /* @__PURE__ */ ho(/* @__PURE__ */ u({
7589
7618
  __name: "IndicatorParams",
7590
7619
  props: {
7591
7620
  visible: { type: Boolean },
@@ -7633,7 +7662,7 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
7633
7662
  class: "indicator-params",
7634
7663
  onClick: d[3] ||= w(() => {}, ["stop"])
7635
7664
  }, [
7636
- s("div", bo, [s("div", xo, [s("span", So, b(r.indicatorName), 1), d[5] ||= s("span", { class: "params-subtitle" }, "参数设置", -1)]), s("div", Co, [s("button", {
7665
+ s("div", So, [s("div", Co, [s("span", wo, b(r.indicatorName), 1), d[5] ||= s("span", { class: "params-subtitle" }, "参数设置", -1)]), s("div", To, [s("button", {
7637
7666
  class: f(["toggle-desc-btn", { active: h.value }]),
7638
7667
  onClick: d[0] ||= (e) => h.value = !h.value,
7639
7668
  title: "显示/隐藏说明"
@@ -7650,18 +7679,18 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
7650
7679
  "stroke-width": "2"
7651
7680
  }, [s("path", { d: "M18 6L6 18M6 6l12 12" })], -1)]])])]),
7652
7681
  l(n, { name: "slide" }, {
7653
- default: C(() => [h.value && r.indicatorDescription ? (g(), o("div", wo, [s("p", null, b(r.indicatorDescription), 1)])) : a("", !0)]),
7682
+ default: C(() => [h.value && r.indicatorDescription ? (g(), o("div", Eo, [s("p", null, b(r.indicatorDescription), 1)])) : a("", !0)]),
7654
7683
  _: 1
7655
7684
  }),
7656
- s("div", To, [(g(!0), o(e, null, v(r.params, (e) => (g(), o("div", {
7685
+ s("div", Do, [(g(!0), o(e, null, v(r.params, (e) => (g(), o("div", {
7657
7686
  key: e.key,
7658
7687
  class: f(["param-item", { "has-desc": h.value && e.description }])
7659
- }, [s("div", Eo, [s("label", Do, [s("span", Oo, b(e.label), 1), e.min !== void 0 || e.max !== void 0 ? (g(), o("span", ko, b(e.min ?? "-∞") + " ~ " + b(e.max ?? "+∞"), 1)) : a("", !0)]), s("div", Ao, [
7688
+ }, [s("div", Oo, [s("label", ko, [s("span", Ao, b(e.label), 1), e.min !== void 0 || e.max !== void 0 ? (g(), o("span", jo, b(e.min ?? "-∞") + " ~ " + b(e.max ?? "+∞"), 1)) : a("", !0)]), s("div", Mo, [
7660
7689
  s("button", {
7661
7690
  class: "stepper-btn",
7662
7691
  disabled: e.min !== void 0 && (m.value[e.key] ?? 0) <= e.min,
7663
7692
  onClick: (t) => x(e, -1)
7664
- }, " − ", 8, jo),
7693
+ }, " − ", 8, No),
7665
7694
  e.type === "number" ? (g(), o("input", {
7666
7695
  key: 0,
7667
7696
  type: "number",
@@ -7671,17 +7700,17 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
7671
7700
  max: e.max,
7672
7701
  step: e.step || 1,
7673
7702
  onInput: (t) => y(e.key, t)
7674
- }, null, 40, Mo)) : a("", !0),
7703
+ }, null, 40, Po)) : a("", !0),
7675
7704
  s("button", {
7676
7705
  class: "stepper-btn",
7677
7706
  disabled: e.max !== void 0 && (m.value[e.key] ?? 0) >= e.max,
7678
7707
  onClick: (t) => x(e, 1)
7679
- }, " + ", 8, No)
7708
+ }, " + ", 8, Fo)
7680
7709
  ])]), l(n, { name: "slide" }, {
7681
- default: C(() => [h.value && e.description ? (g(), o("div", Po, b(e.description), 1)) : a("", !0)]),
7710
+ default: C(() => [h.value && e.description ? (g(), o("div", Io, b(e.description), 1)) : a("", !0)]),
7682
7711
  _: 2
7683
7712
  }, 1024)], 2))), 128))]),
7684
- s("div", Fo, [s("button", {
7713
+ s("div", Lo, [s("button", {
7685
7714
  class: "params-btn reset",
7686
7715
  onClick: T
7687
7716
  }, [...d[8] ||= [s("svg", {
@@ -7689,7 +7718,7 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
7689
7718
  fill: "none",
7690
7719
  stroke: "currentColor",
7691
7720
  "stroke-width": "2"
7692
- }, [s("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), s("path", { d: "M3 3v5h5" })], -1), c(" 重置 ", -1)]]), s("div", Io, [s("button", {
7721
+ }, [s("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), s("path", { d: "M3 3v5h5" })], -1), c(" 重置 ", -1)]]), s("div", Ro, [s("button", {
7693
7722
  class: "params-btn cancel",
7694
7723
  onClick: d[2] ||= (e) => u.$emit("close")
7695
7724
  }, "取消"), s("button", {
@@ -7707,28 +7736,28 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
7707
7736
  _: 1
7708
7737
  })]));
7709
7738
  }
7710
- }), [["__scopeId", "data-v-730f2212"]]), Ro = { class: "indicator-selector" }, zo = { class: "indicator-scroll-container" }, Bo = { class: "indicator-list" }, Vo = ["onMouseenter"], Ho = { class: "btn-content" }, Uo = {
7739
+ }), [["__scopeId", "data-v-730f2212"]]), Bo = { class: "indicator-selector" }, Vo = { class: "indicator-scroll-container" }, Ho = { class: "indicator-list" }, Uo = ["onMouseenter"], Wo = { class: "btn-content" }, Go = {
7711
7740
  key: 0,
7712
7741
  class: "param-hint"
7713
- }, Wo = {
7742
+ }, Ko = {
7714
7743
  key: 0,
7715
7744
  class: "hover-overlay"
7716
- }, Go = ["onClick"], Ko = {
7745
+ }, qo = ["onClick"], Jo = {
7717
7746
  key: 1,
7718
7747
  class: "divider"
7719
- }, qo = ["onClick"], Jo = { class: "indicator-item" }, Yo = { class: "menu-section" }, Xo = { class: "menu-items" }, Zo = ["disabled", "onClick"], Qo = {
7748
+ }, Yo = ["onClick"], Xo = { class: "indicator-item" }, Zo = { class: "menu-section" }, Qo = { class: "menu-items" }, $o = ["disabled", "onClick"], es = {
7720
7749
  key: 0,
7721
7750
  class: "param-hint"
7722
- }, $o = {
7751
+ }, ts = {
7723
7752
  key: 1,
7724
7753
  class: "active-tag"
7725
- }, es = { class: "menu-section" }, ts = { class: "menu-items" }, ns = ["disabled", "onClick"], rs = {
7754
+ }, ns = { class: "menu-section" }, rs = { class: "menu-items" }, is = ["disabled", "onClick"], as = {
7726
7755
  key: 0,
7727
7756
  class: "param-hint"
7728
- }, is = {
7757
+ }, os = {
7729
7758
  key: 1,
7730
7759
  class: "active-tag"
7731
- }, as = /* @__PURE__ */ po(/* @__PURE__ */ u({
7760
+ }, ss = /* @__PURE__ */ ho(/* @__PURE__ */ u({
7732
7761
  __name: "IndicatorSelector",
7733
7762
  props: {
7734
7763
  activeIndicators: {},
@@ -7769,6 +7798,58 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
7769
7798
  description: "标准差倍数,决定轨道宽度,通常为 2"
7770
7799
  }]
7771
7800
  },
7801
+ {
7802
+ id: "EXPMA",
7803
+ label: "EXPMA",
7804
+ name: "指数平滑移动平均线",
7805
+ pane: "main",
7806
+ description: "EXPMA 对近期价格给予更高权重,比普通 MA 更敏感。快线上穿慢线为金叉看涨,下穿为死叉看跌。",
7807
+ params: [{
7808
+ key: "fastPeriod",
7809
+ label: "快线",
7810
+ type: "number",
7811
+ min: 2,
7812
+ max: 100,
7813
+ step: 1,
7814
+ default: 12,
7815
+ description: "快线周期,对价格变化更敏感"
7816
+ }, {
7817
+ key: "slowPeriod",
7818
+ label: "慢线",
7819
+ type: "number",
7820
+ min: 2,
7821
+ max: 200,
7822
+ step: 1,
7823
+ default: 50,
7824
+ description: "慢线周期,用于判断趋势方向"
7825
+ }]
7826
+ },
7827
+ {
7828
+ id: "ENE",
7829
+ label: "ENE",
7830
+ name: "轨道线",
7831
+ pane: "main",
7832
+ description: "ENE 轨道线由三条轨道组成,价格突破上轨可能超买,突破下轨可能超卖,适合判断震荡行情的买卖点。",
7833
+ params: [{
7834
+ key: "period",
7835
+ label: "周期",
7836
+ type: "number",
7837
+ min: 2,
7838
+ max: 100,
7839
+ step: 1,
7840
+ default: 10,
7841
+ description: "计算中轨的周期数"
7842
+ }, {
7843
+ key: "deviation",
7844
+ label: "偏离率",
7845
+ type: "number",
7846
+ min: 1,
7847
+ max: 30,
7848
+ step: .5,
7849
+ default: 11,
7850
+ description: "轨道偏离率百分比,决定轨道宽度"
7851
+ }]
7852
+ },
7772
7853
  {
7773
7854
  id: "MACD",
7774
7855
  label: "MACD",
@@ -8023,10 +8104,9 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
8023
8104
  if (!t?.params) return {};
8024
8105
  let n = {};
8025
8106
  for (let e of t.params) n[e.key] = e.default ?? e.min ?? 1;
8026
- return {
8027
- ...n,
8028
- ...E.indicatorParams?.[e] || {}
8029
- };
8107
+ let r = E.indicatorParams?.[e] || {}, i = { ...n };
8108
+ for (let [e, t] of Object.entries(r)) typeof t == "number" && (i[e] = t);
8109
+ return i;
8030
8110
  }
8031
8111
  function I(e) {
8032
8112
  let t = ae(e.id);
@@ -8056,8 +8136,8 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
8056
8136
  document.addEventListener("click", se), window.addEventListener("resize", ce);
8057
8137
  }), h(() => {
8058
8138
  document.removeEventListener("click", se), window.removeEventListener("resize", ce);
8059
- }), (r, u) => (g(), o("div", Ro, [
8060
- s("div", zo, [s("div", Bo, [(g(!0), o(e, null, v(te.value, (e) => (g(), o("div", {
8139
+ }), (r, u) => (g(), o("div", Bo, [
8140
+ s("div", Vo, [s("div", Ho, [(g(!0), o(e, null, v(te.value, (e) => (g(), o("div", {
8061
8141
  key: e.id,
8062
8142
  class: "indicator-item"
8063
8143
  }, [s("div", {
@@ -8067,8 +8147,8 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
8067
8147
  }, [s("button", { class: f(["indicator-btn", {
8068
8148
  active: !0,
8069
8149
  hovering: M.value === e.id
8070
- }]) }, [s("span", Ho, [c(b(e.label) + " ", 1), e.params ? (g(), o("span", Uo, " (" + b(I(e)) + ") ", 1)) : a("", !0)]), l(n, { name: "fade" }, {
8071
- default: C(() => [M.value === e.id ? (g(), o("div", Wo, [
8150
+ }]) }, [s("span", Wo, [c(b(e.label) + " ", 1), e.params ? (g(), o("span", Go, " (" + b(I(e)) + ") ", 1)) : a("", !0)]), l(n, { name: "fade" }, {
8151
+ default: C(() => [M.value === e.id ? (g(), o("div", Ko, [
8072
8152
  e.params ? (g(), o("button", {
8073
8153
  key: 0,
8074
8154
  class: "action-btn settings-btn",
@@ -8079,8 +8159,8 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
8079
8159
  width: "14",
8080
8160
  height: "14",
8081
8161
  fill: "currentColor"
8082
- }, [s("path", { d: "M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z" })], -1)]], 8, Go)) : a("", !0),
8083
- e.params ? (g(), o("span", Ko)) : a("", !0),
8162
+ }, [s("path", { d: "M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z" })], -1)]], 8, qo)) : a("", !0),
8163
+ e.params ? (g(), o("span", Jo)) : a("", !0),
8084
8164
  s("button", {
8085
8165
  class: "action-btn remove-btn",
8086
8166
  onClick: w((t) => re(e.id), ["stop"]),
@@ -8090,10 +8170,10 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
8090
8170
  width: "14",
8091
8171
  height: "14",
8092
8172
  fill: "currentColor"
8093
- }, [s("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })], -1)]], 8, qo)
8173
+ }, [s("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })], -1)]], 8, Yo)
8094
8174
  ])) : a("", !0)]),
8095
8175
  _: 2
8096
- }, 1024)], 2)], 40, Vo)]))), 128)), s("div", Jo, [s("button", {
8176
+ }, 1024)], 2)], 40, Uo)]))), 128)), s("div", Xo, [s("button", {
8097
8177
  ref_key: "addBtnRef",
8098
8178
  ref: O,
8099
8179
  class: "add-btn",
@@ -8112,38 +8192,38 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
8112
8192
  ref_key: "addMenuRef",
8113
8193
  ref: k,
8114
8194
  style: p(ee.value)
8115
- }, [s("div", Yo, [u[6] ||= s("div", { class: "menu-title" }, "主图指标", -1), s("div", Xo, [(g(!0), o(e, null, v(x(S), (e) => (g(), o("button", {
8195
+ }, [s("div", Zo, [u[6] ||= s("div", { class: "menu-title" }, "主图指标", -1), s("div", Qo, [(g(!0), o(e, null, v(x(S), (e) => (g(), o("button", {
8116
8196
  key: e.id,
8117
8197
  class: f(["menu-item", { disabled: F(e.id) }]),
8118
8198
  disabled: F(e.id),
8119
8199
  onClick: (t) => ne(e.id)
8120
8200
  }, [
8121
8201
  c(b(e.label) + " ", 1),
8122
- e.params ? (g(), o("span", Qo, " (" + b(e.name) + ") ", 1)) : a("", !0),
8123
- F(e.id) ? (g(), o("span", $o, [...u[5] ||= [s("svg", {
8202
+ e.params ? (g(), o("span", es, " (" + b(e.name) + ") ", 1)) : a("", !0),
8203
+ F(e.id) ? (g(), o("span", ts, [...u[5] ||= [s("svg", {
8124
8204
  viewBox: "0 0 24 24",
8125
8205
  width: "14",
8126
8206
  height: "14",
8127
8207
  fill: "currentColor"
8128
8208
  }, [s("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" })], -1)]])) : a("", !0)
8129
- ], 10, Zo))), 128))])]), s("div", es, [u[8] ||= s("div", { class: "menu-title" }, "副图指标", -1), s("div", ts, [(g(!0), o(e, null, v(x(T), (e) => (g(), o("button", {
8209
+ ], 10, $o))), 128))])]), s("div", ns, [u[8] ||= s("div", { class: "menu-title" }, "副图指标", -1), s("div", rs, [(g(!0), o(e, null, v(x(T), (e) => (g(), o("button", {
8130
8210
  key: e.id,
8131
8211
  class: f(["menu-item", { disabled: F(e.id) }]),
8132
8212
  disabled: F(e.id),
8133
8213
  onClick: (t) => ne(e.id)
8134
8214
  }, [
8135
8215
  c(b(e.label) + " ", 1),
8136
- e.params ? (g(), o("span", rs, " (" + b(e.name) + ") ", 1)) : a("", !0),
8137
- F(e.id) ? (g(), o("span", is, [...u[7] ||= [s("svg", {
8216
+ e.params ? (g(), o("span", as, " (" + b(e.name) + ") ", 1)) : a("", !0),
8217
+ F(e.id) ? (g(), o("span", os, [...u[7] ||= [s("svg", {
8138
8218
  viewBox: "0 0 24 24",
8139
8219
  width: "14",
8140
8220
  height: "14",
8141
8221
  fill: "currentColor"
8142
8222
  }, [s("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" })], -1)]])) : a("", !0)
8143
- ], 10, ns))), 128))])])], 4)) : a("", !0)]),
8223
+ ], 10, is))), 128))])])], 4)) : a("", !0)]),
8144
8224
  _: 1
8145
8225
  })])),
8146
- P.value ? (g(), i(Lo, {
8226
+ P.value ? (g(), i(zo, {
8147
8227
  key: 0,
8148
8228
  visible: A.value,
8149
8229
  "indicator-id": P.value.id,
@@ -8163,15 +8243,15 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
8163
8243
  ])) : a("", !0)
8164
8244
  ]));
8165
8245
  }
8166
- }), [["__scopeId", "data-v-ef3141f5"]]);
8246
+ }), [["__scopeId", "data-v-aad3b750"]]);
8167
8247
  //#endregion
8168
8248
  //#region src/core/utils/klineConfig.ts
8169
- function os(e, t) {
8249
+ function cs(e, t) {
8170
8250
  let n = Math.round(e * t);
8171
8251
  return n % 2 == 0 && (n += 1), Math.max(1, n);
8172
8252
  }
8173
- function ss(e, t, n) {
8174
- let r = os(e, n), i = Math.round(t * n), a = r + i, o = i;
8253
+ function ls(e, t, n) {
8254
+ let r = cs(e, n), i = Math.round(t * n), a = r + i, o = i;
8175
8255
  return {
8176
8256
  kWidthPx: r,
8177
8257
  kGapPx: i,
@@ -8185,14 +8265,14 @@ function ss(e, t, n) {
8185
8265
  }
8186
8266
  //#endregion
8187
8267
  //#region src/core/viewport/viewport.ts
8188
- function cs(e, t, n, r, i, a = 1) {
8189
- let { unitPx: o, startXPx: s } = ss(n, r, a), c = e * a, l = t * a;
8268
+ function us(e, t, n, r, i, a = 1) {
8269
+ let { unitPx: o, startXPx: s } = ls(n, r, a), c = e * a, l = t * a;
8190
8270
  return {
8191
8271
  start: Math.max(0, Math.floor((c - s) / o) - 1),
8192
8272
  end: Math.min(i, Math.ceil((c + l - s) / o) + 1)
8193
8273
  };
8194
8274
  }
8195
- function ls(e, t, n) {
8275
+ function ds(e, t, n) {
8196
8276
  let r = -Infinity, i = Infinity;
8197
8277
  for (let a = t; a < n && a < e.length; a++) {
8198
8278
  let t = e[a];
@@ -8208,7 +8288,7 @@ function ls(e, t, n) {
8208
8288
  }
8209
8289
  //#endregion
8210
8290
  //#region src/core/scale/priceScale.ts
8211
- var us = class {
8291
+ var fs = class {
8212
8292
  range = {
8213
8293
  maxPrice: 100,
8214
8294
  minPrice: 0
@@ -8216,6 +8296,7 @@ var us = class {
8216
8296
  height = 1;
8217
8297
  paddingTop = 0;
8218
8298
  paddingBottom = 0;
8299
+ priceOffset = 0;
8219
8300
  setRange(e) {
8220
8301
  this.range = e;
8221
8302
  }
@@ -8234,15 +8315,27 @@ var us = class {
8234
8315
  getPaddingBottom() {
8235
8316
  return this.paddingBottom;
8236
8317
  }
8318
+ setPriceOffset(e) {
8319
+ this.priceOffset = e;
8320
+ }
8321
+ getPriceOffset() {
8322
+ return this.priceOffset;
8323
+ }
8324
+ resetPriceOffset() {
8325
+ this.priceOffset = 0;
8326
+ }
8237
8327
  priceToY(e) {
8238
- let { maxPrice: t, minPrice: n } = this.range, r = t - n || 1, i = (e - n) / r, a = Math.max(1, this.height - this.paddingTop - this.paddingBottom);
8239
- return this.paddingTop + a * (1 - i);
8328
+ let { maxPrice: t, minPrice: n } = this.range, r = e - this.priceOffset, i = t - n || 1, a = (r - n) / i, o = Math.max(1, this.height - this.paddingTop - this.paddingBottom);
8329
+ return this.paddingTop + o * (1 - a);
8240
8330
  }
8241
8331
  yToPrice(e) {
8242
8332
  let { maxPrice: t, minPrice: n } = this.range, r = t - n || 1, i = Math.max(1, this.height - this.paddingTop - this.paddingBottom);
8243
- return n + (1 - (e - this.paddingTop) / i) * r;
8333
+ return n + (1 - (e - this.paddingTop) / i) * r + this.priceOffset;
8334
+ }
8335
+ deltaYToPriceOffset(e) {
8336
+ return e * ((this.range.maxPrice - this.range.minPrice || 1) / Math.max(1, this.height - this.paddingTop - this.paddingBottom));
8244
8337
  }
8245
- }, ds = class {
8338
+ }, ps = class {
8246
8339
  id;
8247
8340
  top = 0;
8248
8341
  height = 0;
@@ -8250,7 +8343,7 @@ var us = class {
8250
8343
  maxPrice: 100,
8251
8344
  minPrice: 0
8252
8345
  };
8253
- yAxis = new us();
8346
+ yAxis = new fs();
8254
8347
  renderers = [];
8255
8348
  constructor(e) {
8256
8349
  this.id = e;
@@ -8265,16 +8358,19 @@ var us = class {
8265
8358
  this.renderers.push(e);
8266
8359
  }
8267
8360
  updateRange(e, t) {
8268
- this.priceRange = ls(e, t.start, t.end), this.yAxis.setRange(this.priceRange);
8361
+ this.priceRange = ds(e, t.start, t.end), this.yAxis.setRange(this.priceRange);
8269
8362
  }
8270
- }, fs = class {
8363
+ }, ms = class {
8271
8364
  chart;
8272
8365
  isDragging = !1;
8273
8366
  dragStartX = 0;
8274
8367
  scrollStartX = 0;
8368
+ dragStartY = 0;
8369
+ activePaneIdOnDrag = null;
8275
8370
  isTouchSession = !1;
8276
8371
  crosshairPos = null;
8277
8372
  crosshairIndex = null;
8373
+ crosshairPrice = null;
8278
8374
  hoveredIndex = null;
8279
8375
  activePaneId = null;
8280
8376
  tooltipPos = {
@@ -8312,7 +8408,11 @@ var us = class {
8312
8408
  this.clickedMarkerId = c.id, this.clickedMarkerData = c, this.onMarkerClickCallback && this.onMarkerClickCallback(c);
8313
8409
  return;
8314
8410
  }
8315
- this.isDragging = !0, this.updateHoverFromPoint(e.clientX, e.clientY), this.dragStartX = e.clientX, this.scrollStartX = t.scrollLeft, this.chart.scheduleDraw();
8411
+ let l = this.chart.getPaneRenderers().find((e) => {
8412
+ let t = e.getPane();
8413
+ return i >= t.top && i <= t.top + t.height;
8414
+ })?.getPane() || null;
8415
+ this.isDragging = !0, this.updateHoverFromPoint(e.clientX, e.clientY), this.dragStartX = e.clientX, this.dragStartY = e.clientY, this.scrollStartX = t.scrollLeft, this.activePaneIdOnDrag = l?.id || null, this.chart.scheduleDraw();
8316
8416
  }
8317
8417
  setTooltipSize(e) {
8318
8418
  this.tooltipSize = e;
@@ -8330,7 +8430,11 @@ var us = class {
8330
8430
  this.clickedMarkerId = c.id, this.onMarkerClickCallback && this.onMarkerClickCallback(c);
8331
8431
  return;
8332
8432
  }
8333
- this.isDragging = !0, this.dragStartX = e.clientX, this.scrollStartX = t.scrollLeft, this.updateHoverFromPoint(e.clientX, e.clientY), this.chart.scheduleDraw(), e.preventDefault();
8433
+ let l = this.chart.getPaneRenderers().find((e) => {
8434
+ let t = e.getPane();
8435
+ return i >= t.top && i <= t.top + t.height;
8436
+ })?.getPane() || null;
8437
+ this.isDragging = !0, this.dragStartX = e.clientX, this.dragStartY = e.clientY, this.scrollStartX = t.scrollLeft, this.activePaneIdOnDrag = l?.id || null, this.updateHoverFromPoint(e.clientX, e.clientY), this.chart.scheduleDraw(), e.preventDefault();
8334
8438
  }
8335
8439
  onMouseMove(e) {
8336
8440
  if (this.isTouchSession) return;
@@ -8338,6 +8442,8 @@ var us = class {
8338
8442
  if (this.isDragging) {
8339
8443
  let n = this.dragStartX - e.clientX;
8340
8444
  t.scrollLeft = this.scrollStartX + n;
8445
+ let r = e.clientY - this.dragStartY;
8446
+ r !== 0 && this.activePaneIdOnDrag && (this.chart.translatePrice(this.activePaneIdOnDrag, r), this.dragStartY = e.clientY);
8341
8447
  return;
8342
8448
  }
8343
8449
  this.updateHover(e), this.chart.scheduleDraw();
@@ -8358,6 +8464,8 @@ var us = class {
8358
8464
  if (this.isDragging) {
8359
8465
  let n = this.dragStartX - e.clientX;
8360
8466
  t.scrollLeft = this.scrollStartX + n;
8467
+ let r = e.clientY - this.dragStartY;
8468
+ r !== 0 && this.activePaneIdOnDrag && (this.chart.translatePrice(this.activePaneIdOnDrag, r), this.dragStartY = e.clientY);
8361
8469
  return;
8362
8470
  }
8363
8471
  this.updateHoverFromPoint(e.clientX, e.clientY), this.chart.scheduleDraw();
@@ -8381,7 +8489,7 @@ var us = class {
8381
8489
  this.onCustomMarkerClickCallback = e;
8382
8490
  }
8383
8491
  clearHover() {
8384
- this.crosshairPos = null, this.crosshairIndex = null, this.hoveredIndex = null, this.activePaneId = null, this.hoveredMarkerId !== null && (this.hoveredMarkerId = null, this.onMarkerHoverCallback && this.onMarkerHoverCallback(null)), this.hoveredCustomMarker !== null && (this.hoveredCustomMarker = null, this.onCustomMarkerHoverCallback && this.onCustomMarkerHoverCallback(null));
8492
+ this.crosshairPos = null, this.crosshairIndex = null, this.crosshairPrice = null, this.hoveredIndex = null, this.activePaneId = null, this.hoveredMarkerId !== null && (this.hoveredMarkerId = null, this.onMarkerHoverCallback && this.onMarkerHoverCallback(null)), this.hoveredCustomMarker !== null && (this.hoveredCustomMarker = null, this.onCustomMarkerHoverCallback && this.onCustomMarkerHoverCallback(null));
8385
8493
  }
8386
8494
  updateHover(e) {
8387
8495
  this.updateHoverFromPoint(e.clientX, e.clientY);
@@ -8423,11 +8531,14 @@ var us = class {
8423
8531
  if (this.activePaneId = C?.id || null, x >= 0 && x < (S?.length ?? 0)) {
8424
8532
  this.crosshairIndex = x;
8425
8533
  let e = this.kLinePositions[b] + (this.kWidthPx - 1) / 2 / f - d;
8426
- this.crosshairPos = {
8534
+ if (this.crosshairPos = {
8427
8535
  x: Math.min(Math.max(e, 0), l),
8428
8536
  y: Math.min(Math.max(a, 0), u)
8429
- };
8430
- } else this.crosshairIndex = null, this.crosshairPos = null;
8537
+ }, C) {
8538
+ let e = a - C.top;
8539
+ this.crosshairPrice = C.yAxis.yToPrice(e);
8540
+ } else this.crosshairPrice = null;
8541
+ } else this.crosshairIndex = null, this.crosshairPos = null, this.crosshairPrice = null;
8431
8542
  let w = typeof this.crosshairIndex == "number" ? S[this.crosshairIndex] : void 0;
8432
8543
  if (!w || !C || C.id !== "main") {
8433
8544
  this.hoveredIndex = null;
@@ -8446,9 +8557,9 @@ var us = class {
8446
8557
  };
8447
8558
  }
8448
8559
  reset() {
8449
- this.isDragging = !1, this.dragStartX = 0, this.scrollStartX = 0, this.isTouchSession = !1, this.crosshairPos = null, this.crosshairIndex = null, this.hoveredIndex = null, this.activePaneId = null, this.hoveredMarkerId = null, this.clickedMarkerId = null, this.hoveredMarkerData = null, this.clickedMarkerData = null, this.kLinePositions = null, this.visibleRange = null, this.kWidthPx = null;
8560
+ this.isDragging = !1, this.dragStartX = 0, this.dragStartY = 0, this.scrollStartX = 0, this.activePaneIdOnDrag = null, this.isTouchSession = !1, this.crosshairPos = null, this.crosshairIndex = null, this.crosshairPrice = null, this.hoveredIndex = null, this.activePaneId = null, this.hoveredMarkerId = null, this.clickedMarkerId = null, this.hoveredMarkerData = null, this.clickedMarkerData = null, this.kLinePositions = null, this.visibleRange = null, this.kWidthPx = null;
8450
8561
  }
8451
- }, ps = class {
8562
+ }, hs = class {
8452
8563
  dom;
8453
8564
  pane;
8454
8565
  opt;
@@ -8474,7 +8585,7 @@ var us = class {
8474
8585
  };
8475
8586
  //#endregion
8476
8587
  //#region src/core/renderers/subVolume.ts
8477
- function ms(e = {}) {
8588
+ function gs(e = {}) {
8478
8589
  let { paneId: t = "sub" } = e;
8479
8590
  return {
8480
8591
  name: `volume_${t}`,
@@ -8493,30 +8604,24 @@ function ms(e = {}) {
8493
8604
  if (!r) continue;
8494
8605
  let i = r.volume;
8495
8606
  if (!i) continue;
8496
- let a = gs(r), d = c[e - u];
8497
- d && hs(t, d, a, i, f, o, s, n.height);
8607
+ let a = vs(r), d = c[e - u];
8608
+ d && _s(t, d, a, i, f, o, s, n.height);
8498
8609
  }
8499
8610
  t.restore();
8500
8611
  }
8501
8612
  };
8502
8613
  }
8503
- function hs(e, t, n, r, i, a, o, s) {
8504
- let c = _s(r, i, s), l = a;
8614
+ function _s(e, t, n, r, i, a, o, s) {
8615
+ let c = ys(r, i, s), l = a;
8505
8616
  e.fillStyle = n, e.fillRect(t, c, l, s - c);
8506
8617
  }
8507
- function gs(e) {
8618
+ function vs(e) {
8508
8619
  return e.close > e.open ? X.UP : e.close < e.open ? X.DOWN : X.NEUTRAL;
8509
8620
  }
8510
- function _s(e, t, n) {
8621
+ function ys(e, t, n) {
8511
8622
  return n - n / t * e;
8512
8623
  }
8513
8624
  //#endregion
8514
- //#region src/utils/priceToY.ts
8515
- function vs(e, t, n, r, i, a) {
8516
- let o = t - n || 1, s = (e - n) / o;
8517
- return i + Math.max(1, r - i - a) * (1 - s);
8518
- }
8519
- //#endregion
8520
8625
  //#region src/core/draw/pixelAlign.ts
8521
8626
  function Z(e, t) {
8522
8627
  return Math.round(e * t) / t;
@@ -8524,7 +8629,7 @@ function Z(e, t) {
8524
8629
  function Q(e, t) {
8525
8630
  return (Math.floor(e * t) + .5) / t;
8526
8631
  }
8527
- function ys(e, t, n, r) {
8632
+ function bs(e, t, n, r) {
8528
8633
  if (t === n) return null;
8529
8634
  let i = Math.min(t, n), a = Math.max(t, n), o = Math.round(e * r), s = Math.round(i * r), c = Math.round(a * r);
8530
8635
  return {
@@ -8534,7 +8639,7 @@ function ys(e, t, n, r) {
8534
8639
  height: Math.max(1, c - s) / r
8535
8640
  };
8536
8641
  }
8537
- function bs(e, t, n, r) {
8642
+ function xs(e, t, n, r) {
8538
8643
  if (e === t) return null;
8539
8644
  let i = Math.min(e, t), a = Math.max(e, t), o = Math.round(i * r), s = Math.round(a * r), c = Math.round(n * r);
8540
8645
  return {
@@ -8544,7 +8649,7 @@ function bs(e, t, n, r) {
8544
8649
  height: 1 / r
8545
8650
  };
8546
8651
  }
8547
- function xs(e, t, n, r, i) {
8652
+ function Ss(e, t, n, r, i) {
8548
8653
  let a = e + n, o = n, s = Math.round(t * i), c = Math.round((t + r) * i), l = Math.max(1, c - s), u = e + (n - 1) / 2, d = u, f = o % 2 == 1;
8549
8654
  return {
8550
8655
  bodyRect: {
@@ -8567,7 +8672,7 @@ function xs(e, t, n, r, i) {
8567
8672
  }
8568
8673
  //#endregion
8569
8674
  //#region src/core/renderers/Indicator/ma.ts
8570
- function Ss(e, t) {
8675
+ function Cs(e, t) {
8571
8676
  let n = Array(e.length);
8572
8677
  if (e.length < t) return n;
8573
8678
  let r = 0;
@@ -8583,7 +8688,7 @@ function Ss(e, t) {
8583
8688
  }
8584
8689
  return n;
8585
8690
  }
8586
- function Cs(e = {}) {
8691
+ function ws(e = {}) {
8587
8692
  let t = {
8588
8693
  ma5: !0,
8589
8694
  ma10: !0,
@@ -8595,24 +8700,21 @@ function Cs(e = {}) {
8595
8700
  function i(e, t) {
8596
8701
  let i = n.get(t);
8597
8702
  if (i && r === e) return i.values;
8598
- let a = Ss(e, t);
8703
+ let a = Cs(e, t);
8599
8704
  return n.set(t, {
8600
8705
  period: t,
8601
8706
  values: a
8602
8707
  }), r = e, a;
8603
8708
  }
8604
8709
  function a(e, t, n, r) {
8605
- let { pane: i, range: a, kWidth: o, kGap: s, dpr: c, kLinePositions: l } = n, u = i.height, d = i.priceRange, f = Math.max(0, Math.min(0, Math.floor(u / 2) - 1)), p = f, m = f;
8606
- if (!d) return;
8607
- let h = d.maxPrice, g = d.minPrice;
8608
- if (!Number.isFinite(h) || !Number.isFinite(g)) return;
8710
+ let { pane: i, range: a, kWidth: o, dpr: s, kLinePositions: c } = n;
8609
8711
  e.strokeStyle = r, e.lineWidth = 1, e.lineJoin = "round", e.lineCap = "round", e.beginPath();
8610
- let _ = !0;
8712
+ let l = !0;
8611
8713
  for (let n = a.start; n < a.end && n < t.length; n++) {
8612
8714
  let r = t[n];
8613
8715
  if (r === void 0) continue;
8614
- let i = l[n - a.start] + o / 2, s = vs(r, h, g, u, p, m), d = Q(i, c), f = Q(s, c);
8615
- _ ? (e.moveTo(d, f), _ = !1) : e.lineTo(d, f);
8716
+ let u = c[n - a.start] + o / 2, d = i.yAxis.priceToY(r), f = Q(u, s), p = Q(d, s);
8717
+ l ? (e.moveTo(f, p), l = !1) : e.lineTo(f, p);
8616
8718
  }
8617
8719
  e.stroke();
8618
8720
  }
@@ -8639,82 +8741,8 @@ function Cs(e = {}) {
8639
8741
  };
8640
8742
  }
8641
8743
  //#endregion
8642
- //#region src/utils/kline/ma.ts
8643
- function ws(e, t, n) {
8644
- if (t < n - 1) return;
8645
- let r = 0;
8646
- for (let i = 0; i < n; i++) {
8647
- let n = e[t - i];
8648
- if (!n) return;
8649
- r += n.close;
8650
- }
8651
- return r / n;
8652
- }
8653
- //#endregion
8654
- //#region src/core/renderers/Indicator/maLegend.ts
8655
- function Ts(e) {
8656
- let t = {
8657
- ma5: !0,
8658
- ma10: !0,
8659
- ma20: !0,
8660
- ma30: !0,
8661
- ma60: !0,
8662
- ...e.showMA
8663
- };
8664
- return {
8665
- name: "maLegend",
8666
- version: "1.0.0",
8667
- description: "MA均线图例渲染器",
8668
- debugName: "MA图例",
8669
- paneId: "main",
8670
- priority: Y.FOREGROUND,
8671
- draw(n) {
8672
- let { ctx: r, data: i, range: a } = n, o = i;
8673
- if (!o.length) return;
8674
- let s = (12 + e.yPaddingPx) / 2;
8675
- r.save(), r.font = "12px Arial", r.textAlign = "left";
8676
- let c = Math.min(a.end - 1, o.length - 1), l = [];
8677
- if (t.ma5 && l.push({
8678
- label: "MA5",
8679
- color: ja.MA5,
8680
- value: ws(o, c, 5)
8681
- }), t.ma10 && l.push({
8682
- label: "MA10",
8683
- color: ja.MA10,
8684
- value: ws(o, c, 10)
8685
- }), t.ma20 && l.push({
8686
- label: "MA20",
8687
- color: ja.MA20,
8688
- value: ws(o, c, 20)
8689
- }), t.ma30 && l.push({
8690
- label: "MA30",
8691
- color: ja.MA30,
8692
- value: ws(o, c, 30)
8693
- }), t.ma60 && l.push({
8694
- label: "MA60",
8695
- color: ja.MA60,
8696
- value: ws(o, c, 60)
8697
- }), l.length > 0) {
8698
- let e = 12, t = s;
8699
- r.fillStyle = X.NEUTRAL, r.fillText("均线", e, t), e += r.measureText("均线").width + 10;
8700
- for (let n of l) {
8701
- let i = typeof n.value == "number" ? ` ${n.value.toFixed(2)}` : "", a = `${n.label}${i}`;
8702
- r.fillStyle = n.color, r.fillText(a, e, t), e += r.measureText(a).width + 10;
8703
- }
8704
- }
8705
- r.restore();
8706
- },
8707
- getConfig() {
8708
- return { ...t };
8709
- },
8710
- setConfig(e) {
8711
- Object.assign(t, e);
8712
- }
8713
- };
8714
- }
8715
- //#endregion
8716
8744
  //#region src/core/renderers/Indicator/boll.ts
8717
- function Es(e, t, n) {
8745
+ function Ts(e, t, n) {
8718
8746
  let r = Array(e.length);
8719
8747
  if (e.length < t) return r;
8720
8748
  let i = 0, a = [];
@@ -8747,7 +8775,7 @@ function Es(e, t, n) {
8747
8775
  }
8748
8776
  return r;
8749
8777
  }
8750
- function Ds(e = {}) {
8778
+ function Es(e = {}) {
8751
8779
  let t = {
8752
8780
  period: 20,
8753
8781
  multiplier: 2,
@@ -8758,7 +8786,7 @@ function Ds(e = {}) {
8758
8786
  ...e
8759
8787
  }, n = null, r = 0, i = 0, a = [];
8760
8788
  function o(e) {
8761
- return (n !== e || r !== t.period || i !== t.multiplier) && (a = Es(e, t.period, t.multiplier), n = e, r = t.period, i = t.multiplier), a;
8789
+ return (n !== e || r !== t.period || i !== t.multiplier) && (a = Ts(e, t.period, t.multiplier), n = e, r = t.period, i = t.multiplier), a;
8762
8790
  }
8763
8791
  return {
8764
8792
  name: "boll",
@@ -8768,50 +8796,41 @@ function Ds(e = {}) {
8768
8796
  paneId: "main",
8769
8797
  priority: Y.INDICATOR,
8770
8798
  draw(e) {
8771
- let { ctx: n, pane: r, data: i, range: a, scrollLeft: s, kWidth: c, kGap: l, dpr: u, kLinePositions: d } = e, f = i;
8772
- if (f.length < t.period) return;
8773
- let p = o(f), m = {
8774
- kWidth: c,
8775
- kGap: l,
8776
- yPaddingPx: 0
8777
- }, h = r.priceRange, g = r.height, _ = m.yPaddingPx ?? 0, v = Math.max(0, Math.min(_, Math.floor(g / 2) - 1)), y = v, b = v, x = h?.maxPrice ?? -Infinity, S = h?.minPrice ?? Infinity;
8778
- if (!h) for (let e = a.start; e < a.end && e < f.length; e++) {
8779
- let t = f[e];
8780
- t && (t.high > x && (x = t.high), t.low < S && (S = t.low));
8781
- }
8782
- if (!Number.isFinite(x) || !Number.isFinite(S)) return;
8799
+ let { ctx: n, pane: r, data: i, range: a, scrollLeft: s, kWidth: c, dpr: l, kLinePositions: u } = e, d = i;
8800
+ if (d.length < t.period) return;
8801
+ let f = o(d);
8783
8802
  n.save(), n.translate(-s, 0);
8784
- let C = Math.max(a.start, t.period - 1), w = Math.min(a.end, f.length);
8803
+ let p = Math.max(a.start, t.period - 1), m = Math.min(a.end, d.length);
8785
8804
  if (t.showBand) {
8786
8805
  n.fillStyle = Ma.BAND_FILL, n.beginPath();
8787
8806
  let e = !0;
8788
- for (let t = C; t < w; t++) {
8789
- let r = p[t];
8790
- if (!r) continue;
8791
- let i = d[t - a.start] + m.kWidth / 2, o = vs(r.upper, x, S, g, y, b), s = Q(i, u), c = Q(o, u);
8792
- e ? (n.moveTo(s, c), e = !1) : n.lineTo(s, c);
8807
+ for (let t = p; t < m; t++) {
8808
+ let i = f[t];
8809
+ if (!i) continue;
8810
+ let o = u[t - a.start] + c / 2, s = r.yAxis.priceToY(i.upper), d = Q(o, l), p = Q(s, l);
8811
+ e ? (n.moveTo(d, p), e = !1) : n.lineTo(d, p);
8793
8812
  }
8794
- for (let e = w - 1; e >= C; e--) {
8795
- let t = p[e];
8813
+ for (let e = m - 1; e >= p; e--) {
8814
+ let t = f[e];
8796
8815
  if (!t) continue;
8797
- let r = d[e - a.start] + m.kWidth / 2, i = vs(t.lower, x, S, g, y, b), o = Q(r, u), s = Q(i, u);
8798
- n.lineTo(o, s);
8816
+ let i = u[e - a.start] + c / 2, o = r.yAxis.priceToY(t.lower), s = Q(i, l), d = Q(o, l);
8817
+ n.lineTo(s, d);
8799
8818
  }
8800
8819
  n.closePath(), n.fill();
8801
8820
  }
8802
8821
  n.lineWidth = 1, n.lineJoin = "round", n.lineCap = "round";
8803
- let T = (e, t) => {
8822
+ let h = (e, t) => {
8804
8823
  n.strokeStyle = t, n.beginPath();
8805
- let r = !0;
8806
- for (let t = C; t < w; t++) {
8807
- let i = p[t];
8808
- if (!i) continue;
8809
- let o = d[t - a.start] + m.kWidth / 2, s = vs(i[e], x, S, g, y, b), c = Q(o, u), l = Q(s, u);
8810
- r ? (n.moveTo(c, l), r = !1) : n.lineTo(c, l);
8824
+ let i = !0;
8825
+ for (let t = p; t < m; t++) {
8826
+ let o = f[t];
8827
+ if (!o) continue;
8828
+ let s = u[t - a.start] + c / 2, d = r.yAxis.priceToY(o[e]), p = Q(s, l), m = Q(d, l);
8829
+ i ? (n.moveTo(p, m), i = !1) : n.lineTo(p, m);
8811
8830
  }
8812
8831
  n.stroke();
8813
8832
  };
8814
- t.showUpper && T("upper", Ma.UPPER), t.showMiddle && T("middle", Ma.MIDDLE), t.showLower && T("lower", Ma.LOWER), n.restore();
8833
+ t.showUpper && h("upper", Ma.UPPER), t.showMiddle && h("middle", Ma.MIDDLE), t.showLower && h("lower", Ma.LOWER), n.restore();
8815
8834
  },
8816
8835
  onDataUpdate() {
8817
8836
  n = null;
@@ -8824,7 +8843,7 @@ function Ds(e = {}) {
8824
8843
  }
8825
8844
  };
8826
8845
  }
8827
- function Os(e, t, n = 20, r = 2) {
8846
+ function Ds(e, t, n = 20, r = 2) {
8828
8847
  if (t < n - 1 || t >= e.length) return null;
8829
8848
  let i = 0;
8830
8849
  for (let r = 0; r < n; r++) {
@@ -8846,41 +8865,316 @@ function Os(e, t, n = 20, r = 2) {
8846
8865
  };
8847
8866
  }
8848
8867
  //#endregion
8849
- //#region src/core/renderers/Indicator/bollLegend.ts
8850
- function ks(e) {
8868
+ //#region src/core/renderers/Indicator/expma.ts
8869
+ function Os(e, t, n) {
8870
+ let r = Array(e.length);
8871
+ if (e.length === 0) return r;
8872
+ let i = 2 / (t + 1), a = 2 / (n + 1), o = e[0].close, s = o, c = o;
8873
+ r[0] = {
8874
+ fast: s,
8875
+ slow: c
8876
+ };
8877
+ for (let t = 1; t < e.length; t++) {
8878
+ let n = e[t].close;
8879
+ s = n * i + s * (1 - i), c = n * a + c * (1 - a), r[t] = {
8880
+ fast: s,
8881
+ slow: c
8882
+ };
8883
+ }
8884
+ return r;
8885
+ }
8886
+ function ks(e, t, n = 12, r = 50) {
8887
+ if (t < 0 || t >= e.length) return null;
8888
+ let i = 2 / (n + 1), a = 2 / (r + 1), o = e[0].close, s = o, c = o;
8889
+ for (let n = 1; n <= t; n++) {
8890
+ let t = e[n].close;
8891
+ s = t * i + s * (1 - i), c = t * a + c * (1 - a);
8892
+ }
8893
+ return {
8894
+ fast: s,
8895
+ slow: c
8896
+ };
8897
+ }
8898
+ function As(e = {}) {
8851
8899
  let t = {
8852
- period: 20,
8853
- multiplier: 2,
8854
- show: !0,
8855
- ...e.config
8900
+ fastPeriod: 12,
8901
+ slowPeriod: 50,
8902
+ ...e
8903
+ }, n = null, r = 0, i = 0, a = [];
8904
+ function o(e) {
8905
+ return (n !== e || r !== t.fastPeriod || i !== t.slowPeriod) && (a = Os(e, t.fastPeriod, t.slowPeriod), n = e, r = t.fastPeriod, i = t.slowPeriod), a;
8906
+ }
8907
+ return {
8908
+ name: "expma",
8909
+ version: "1.0.0",
8910
+ description: "EXPMA 指数平滑移动平均线渲染器",
8911
+ debugName: "EXPMA",
8912
+ paneId: "main",
8913
+ priority: Y.INDICATOR,
8914
+ draw(e) {
8915
+ let { ctx: t, pane: n, data: r, range: i, scrollLeft: a, kWidth: s, dpr: c, kLinePositions: l } = e, u = r;
8916
+ if (u.length < 2) return;
8917
+ let d = o(u);
8918
+ t.save(), t.translate(-a, 0);
8919
+ let f = i.start, p = Math.min(i.end, u.length), m = Ba.FAST, h = Ba.SLOW, g = (e, r) => {
8920
+ t.strokeStyle = r, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
8921
+ let a = !0;
8922
+ for (let r = f; r < p; r++) {
8923
+ let o = d[r];
8924
+ if (!o) continue;
8925
+ let u = l[r - i.start] + s / 2, f = n.yAxis.priceToY(o[e]), p = Q(u, c), m = Q(f, c);
8926
+ a ? (t.moveTo(p, m), a = !1) : t.lineTo(p, m);
8927
+ }
8928
+ t.stroke();
8929
+ };
8930
+ g("fast", m), g("slow", h), t.restore();
8931
+ },
8932
+ onDataUpdate() {
8933
+ n = null;
8934
+ },
8935
+ getConfig() {
8936
+ return { ...t };
8937
+ },
8938
+ setConfig(e) {
8939
+ "fastPeriod" in e && e.fastPeriod !== t.fastPeriod && (n = null), "slowPeriod" in e && e.slowPeriod !== t.slowPeriod && (n = null), Object.assign(t, e);
8940
+ }
8856
8941
  };
8942
+ }
8943
+ //#endregion
8944
+ //#region src/core/renderers/Indicator/ene.ts
8945
+ function js(e, t, n) {
8946
+ let r = Array(e.length);
8947
+ if (e.length < t) return r;
8948
+ let i = 0;
8949
+ for (let n = 0; n < t; n++) {
8950
+ let t = e[n];
8951
+ if (!t) return r;
8952
+ i += t.close;
8953
+ }
8954
+ let a = i / t, o = n / 100;
8955
+ r[t - 1] = {
8956
+ upper: a * (1 + o),
8957
+ middle: a,
8958
+ lower: a * (1 - o)
8959
+ };
8960
+ for (let a = t; a < e.length; a++) {
8961
+ let o = e[a - t], s = e[a];
8962
+ if (!o || !s) continue;
8963
+ i = i - o.close + s.close;
8964
+ let c = i / t, l = n / 100;
8965
+ r[a] = {
8966
+ upper: c * (1 + l),
8967
+ middle: c,
8968
+ lower: c * (1 - l)
8969
+ };
8970
+ }
8971
+ return r;
8972
+ }
8973
+ function Ms(e, t, n = 10, r = 11) {
8974
+ if (t < n - 1 || t >= e.length) return null;
8975
+ let i = 0;
8976
+ for (let r = 0; r < n; r++) {
8977
+ let n = e[t - r];
8978
+ if (!n) return null;
8979
+ i += n.close;
8980
+ }
8981
+ let a = i / n, o = r / 100;
8982
+ return {
8983
+ upper: a * (1 + o),
8984
+ middle: a,
8985
+ lower: a * (1 - o)
8986
+ };
8987
+ }
8988
+ function Ns(e = {}) {
8989
+ let t = {
8990
+ period: 10,
8991
+ deviation: 11,
8992
+ ...e
8993
+ }, n = null, r = 0, i = 0, a = [];
8994
+ function o(e) {
8995
+ return (n !== e || r !== t.period || i !== t.deviation) && (a = js(e, t.period, t.deviation), n = e, r = t.period, i = t.deviation), a;
8996
+ }
8857
8997
  return {
8858
- name: "bollLegend",
8998
+ name: "ene",
8859
8999
  version: "1.0.0",
8860
- description: "BOLL布林带图例渲染器",
8861
- debugName: "BOLL图例",
9000
+ description: "ENE 轨道线渲染器",
9001
+ debugName: "ENE轨道线",
8862
9002
  paneId: "main",
8863
- priority: Y.FOREGROUND,
8864
- draw(n) {
8865
- if (!t.show) return;
8866
- let { ctx: r, data: i, range: a } = n, o = i;
8867
- if (!o.length) return;
8868
- let s = (12 + e.yPaddingPx) / 2;
8869
- r.save(), r.font = "12px Arial", r.textAlign = "left";
8870
- let c = Os(o, Math.min(a.end - 1, o.length - 1), t.period, t.multiplier), l = 12;
8871
- r.fillStyle = X.NEUTRAL, r.fillText(`BOLL(${t.period},${t.multiplier})`, l, s), l += r.measureText(`BOLL(${t.period},${t.multiplier})`).width + 10, c && (r.fillStyle = Ma.UPPER, r.fillText(`上轨:${c.upper.toFixed(2)}`, l, s), l += r.measureText(`上轨:${c.upper.toFixed(2)}`).width + 10, r.fillStyle = Ma.MIDDLE, r.fillText(`中轨:${c.middle.toFixed(2)}`, l, s), l += r.measureText(`中轨:${c.middle.toFixed(2)}`).width + 10, r.fillStyle = Ma.LOWER, r.fillText(`下轨:${c.lower.toFixed(2)}`, l, s)), r.restore();
9003
+ priority: Y.INDICATOR,
9004
+ draw(e) {
9005
+ let { ctx: n, pane: r, data: i, range: a, scrollLeft: s, kWidth: c, dpr: l, kLinePositions: u } = e, d = i;
9006
+ if (d.length < t.period) return;
9007
+ let f = o(d);
9008
+ n.save(), n.translate(-s, 0);
9009
+ let p = Math.max(a.start, t.period - 1), m = Math.min(a.end, d.length);
9010
+ n.fillStyle = "rgba(69, 112, 249, 0.08)", n.beginPath();
9011
+ let h = !0;
9012
+ for (let e = p; e < m; e++) {
9013
+ let t = f[e];
9014
+ if (!t) continue;
9015
+ let i = u[e - a.start] + c / 2, o = r.yAxis.priceToY(t.upper), s = Q(i, l), d = Q(o, l);
9016
+ h ? (n.moveTo(s, d), h = !1) : n.lineTo(s, d);
9017
+ }
9018
+ for (let e = m - 1; e >= p; e--) {
9019
+ let t = f[e];
9020
+ if (!t) continue;
9021
+ let i = u[e - a.start] + c / 2, o = r.yAxis.priceToY(t.lower), s = Q(i, l), d = Q(o, l);
9022
+ n.lineTo(s, d);
9023
+ }
9024
+ n.closePath(), n.fill(), n.lineWidth = 1, n.lineJoin = "round", n.lineCap = "round";
9025
+ let g = (e, t) => {
9026
+ n.strokeStyle = t, n.beginPath();
9027
+ let i = !0;
9028
+ for (let t = p; t < m; t++) {
9029
+ let o = f[t];
9030
+ if (!o) continue;
9031
+ let s = u[t - a.start] + c / 2, d = r.yAxis.priceToY(o[e]), p = Q(s, l), m = Q(d, l);
9032
+ i ? (n.moveTo(p, m), i = !1) : n.lineTo(p, m);
9033
+ }
9034
+ n.stroke();
9035
+ };
9036
+ g("upper", "rgba(214, 10, 34, 1)"), g("middle", "rgba(69, 112, 249, 1)"), g("lower", "rgba(3, 123, 102, 1)"), n.restore();
9037
+ },
9038
+ onDataUpdate() {
9039
+ n = null;
8872
9040
  },
8873
9041
  getConfig() {
8874
9042
  return { ...t };
8875
9043
  },
8876
9044
  setConfig(e) {
8877
- Object.assign(t, e);
9045
+ "period" in e && e.period !== t.period && (n = null), "deviation" in e && e.deviation !== t.deviation && (n = null), Object.assign(t, e);
9046
+ }
9047
+ };
9048
+ }
9049
+ //#endregion
9050
+ //#region src/utils/kline/ma.ts
9051
+ function Ps(e, t, n) {
9052
+ if (t < n - 1) return;
9053
+ let r = 0;
9054
+ for (let i = 0; i < n; i++) {
9055
+ let n = e[t - i];
9056
+ if (!n) return;
9057
+ r += n.close;
9058
+ }
9059
+ return r / n;
9060
+ }
9061
+ //#endregion
9062
+ //#region src/core/renderers/Indicator/mainIndicatorLegend.ts
9063
+ function Fs(e) {
9064
+ let t = {
9065
+ yPaddingPx: e.yPaddingPx,
9066
+ indicators: {
9067
+ MA: {
9068
+ enabled: !0,
9069
+ params: {}
9070
+ },
9071
+ BOLL: {
9072
+ enabled: !1,
9073
+ params: {
9074
+ period: 20,
9075
+ multiplier: 2
9076
+ }
9077
+ },
9078
+ EXPMA: {
9079
+ enabled: !1,
9080
+ params: {
9081
+ fastPeriod: 12,
9082
+ slowPeriod: 50
9083
+ }
9084
+ },
9085
+ ENE: {
9086
+ enabled: !1,
9087
+ params: {
9088
+ period: 10,
9089
+ deviation: 11
9090
+ }
9091
+ }
9092
+ }
9093
+ };
9094
+ return {
9095
+ name: "mainIndicatorLegend",
9096
+ version: "1.0.0",
9097
+ description: "主图指标图例渲染器(统一管理 MA、BOLL 等)",
9098
+ debugName: "主图指标图例",
9099
+ paneId: "main",
9100
+ priority: Y.FOREGROUND,
9101
+ enabled: !0,
9102
+ draw(e) {
9103
+ let { ctx: n, data: r, range: i } = e, a = r;
9104
+ if (!a.length) return;
9105
+ n.save(), n.font = "12px Arial", n.textAlign = "left";
9106
+ let o = Math.min(i.end - 1, a.length - 1), s = [], c = t.indicators.MA;
9107
+ c?.enabled && s.push({ draw: (e) => {
9108
+ let r = [], i = c.params.periods;
9109
+ if (i && Array.isArray(i) ? i.forEach((e) => {
9110
+ let t = `MA${e}`;
9111
+ r.push({
9112
+ label: `MA${e}`,
9113
+ color: ja[t] || ja.MA5,
9114
+ value: Ps(a, o, e)
9115
+ });
9116
+ }) : r.push({
9117
+ label: "MA5",
9118
+ color: ja.MA5,
9119
+ value: Ps(a, o, 5)
9120
+ }, {
9121
+ label: "MA10",
9122
+ color: ja.MA10,
9123
+ value: Ps(a, o, 10)
9124
+ }, {
9125
+ label: "MA20",
9126
+ color: ja.MA20,
9127
+ value: Ps(a, o, 20)
9128
+ }, {
9129
+ label: "MA30",
9130
+ color: ja.MA30,
9131
+ value: Ps(a, o, 30)
9132
+ }, {
9133
+ label: "MA60",
9134
+ color: ja.MA60,
9135
+ value: Ps(a, o, 60)
9136
+ }), r.length > 0) {
9137
+ let i = 12, a = t.yPaddingPx / 2 + 12 + e * 18;
9138
+ n.fillStyle = X.NEUTRAL, n.fillText("MA", i, a), i += n.measureText("MA").width + 10;
9139
+ for (let e of r) {
9140
+ let t = typeof e.value == "number" ? ` ${e.value.toFixed(2)}` : "", r = `${e.label}${t}`;
9141
+ n.fillStyle = e.color, n.fillText(r, i, a), i += n.measureText(r).width + 10;
9142
+ }
9143
+ }
9144
+ } });
9145
+ let l = t.indicators.BOLL;
9146
+ l?.enabled && s.push({ draw: (e) => {
9147
+ let r = l.params.period ?? 20, i = l.params.multiplier ?? 2, s = Ds(a, o, r, i), c = 12, u = t.yPaddingPx / 2 + 12 + e * 18;
9148
+ n.fillStyle = X.NEUTRAL, n.fillText(`BOLL(${r},${i})`, c, u), c += n.measureText(`BOLL(${r},${i})`).width + 10, s && (n.fillStyle = Ma.UPPER, n.fillText(`上轨:${s.upper.toFixed(2)}`, c, u), c += n.measureText(`上轨:${s.upper.toFixed(2)}`).width + 10, n.fillStyle = Ma.MIDDLE, n.fillText(`中轨:${s.middle.toFixed(2)}`, c, u), c += n.measureText(`中轨:${s.middle.toFixed(2)}`).width + 10, n.fillStyle = Ma.LOWER, n.fillText(`下轨:${s.lower.toFixed(2)}`, c, u));
9149
+ } });
9150
+ let u = t.indicators.EXPMA;
9151
+ u?.enabled && s.push({ draw: (e) => {
9152
+ let r = u.params.fastPeriod ?? 12, i = u.params.slowPeriod ?? 50, s = ks(a, o, r, i), c = 12, l = t.yPaddingPx / 2 + 12 + e * 18;
9153
+ n.fillStyle = X.NEUTRAL, n.fillText(`EXPMA(${r},${i})`, c, l), c += n.measureText(`EXPMA(${r},${i})`).width + 10, s && (n.fillStyle = Ba.FAST, n.fillText(`快:${s.fast.toFixed(2)}`, c, l), c += n.measureText(`快:${s.fast.toFixed(2)}`).width + 10, n.fillStyle = Ba.SLOW, n.fillText(`慢:${s.slow.toFixed(2)}`, c, l));
9154
+ } });
9155
+ let d = t.indicators.ENE;
9156
+ d?.enabled && s.push({ draw: (e) => {
9157
+ let r = d.params.period ?? 10, i = d.params.deviation ?? 11, s = Ms(a, o, r, i), c = 12, l = t.yPaddingPx / 2 + 12 + e * 18;
9158
+ n.fillStyle = X.NEUTRAL, n.fillText(`ENE(${r},${i})`, c, l), c += n.measureText(`ENE(${r},${i})`).width + 10, s && (n.fillStyle = Va.UPPER, n.fillText(`上轨:${s.upper.toFixed(2)}`, c, l), c += n.measureText(`上轨:${s.upper.toFixed(2)}`).width + 10, n.fillStyle = Va.MIDDLE, n.fillText(`中轨:${s.middle.toFixed(2)}`, c, l), c += n.measureText(`中轨:${s.middle.toFixed(2)}`).width + 10, n.fillStyle = Va.LOWER, n.fillText(`下轨:${s.lower.toFixed(2)}`, c, l));
9159
+ } }), s.forEach((e, t) => e.draw(t)), n.restore();
9160
+ },
9161
+ getConfig() {
9162
+ return {
9163
+ yPaddingPx: t.yPaddingPx,
9164
+ indicators: { ...t.indicators }
9165
+ };
9166
+ },
9167
+ setConfig(e) {
9168
+ if (typeof e.yPaddingPx == "number" && (t.yPaddingPx = e.yPaddingPx), e.indicators && typeof e.indicators == "object") for (let [n, r] of Object.entries(e.indicators)) t.indicators[n] || (t.indicators[n] = {
9169
+ enabled: !1,
9170
+ params: {}
9171
+ }), r.enabled !== void 0 && (t.indicators[n].enabled = r.enabled), r.params && (t.indicators[n].params = r.params);
8878
9172
  }
8879
9173
  };
8880
9174
  }
8881
9175
  //#endregion
8882
9176
  //#region src/core/renderers/Indicator/macd.ts
8883
- function As(e, t) {
9177
+ function Is(e, t) {
8884
9178
  let n = Array(e.length), r = 2 / (t + 1);
8885
9179
  if (e.length === 0) return n;
8886
9180
  n[0] = e[0].close;
@@ -8890,7 +9184,7 @@ function As(e, t) {
8890
9184
  }
8891
9185
  return n;
8892
9186
  }
8893
- function js(e, t) {
9187
+ function Ls(e, t) {
8894
9188
  let n = Array(e.length), r = 2 / (t + 1), i = e.findIndex((e) => e !== void 0);
8895
9189
  if (i === -1) return n;
8896
9190
  n[i] = e[i];
@@ -8900,15 +9194,15 @@ function js(e, t) {
8900
9194
  }
8901
9195
  return n;
8902
9196
  }
8903
- function Ms(e, t, n, r) {
9197
+ function Rs(e, t, n, r) {
8904
9198
  let i = Array(e.length);
8905
9199
  if (e.length < n) return i;
8906
- let a = As(e, t), o = As(e, n), s = Array(e.length);
9200
+ let a = Is(e, t), o = Is(e, n), s = Array(e.length);
8907
9201
  for (let t = 0; t < e.length; t++) {
8908
9202
  let e = a[t], n = o[t];
8909
9203
  e !== void 0 && n !== void 0 && (s[t] = e - n);
8910
9204
  }
8911
- let c = js(s, r);
9205
+ let c = Ls(s, r);
8912
9206
  for (let t = 0; t < e.length; t++) {
8913
9207
  let e = s[t], n = c[t];
8914
9208
  e !== void 0 && n !== void 0 && (i[t] = {
@@ -8919,7 +9213,7 @@ function Ms(e, t, n, r) {
8919
9213
  }
8920
9214
  return i;
8921
9215
  }
8922
- function Ns(e = {}) {
9216
+ function zs(e = {}) {
8923
9217
  let { paneId: t = "sub", config: n = {} } = e, r = {
8924
9218
  fastPeriod: 12,
8925
9219
  slowPeriod: 26,
@@ -8930,7 +9224,7 @@ function Ns(e = {}) {
8930
9224
  ...n
8931
9225
  }, i = null, a = 0, o = 0, s = 0, c = [];
8932
9226
  function l(e) {
8933
- return (i !== e || a !== r.fastPeriod || o !== r.slowPeriod || s !== r.signalPeriod) && (c = Ms(e, r.fastPeriod, r.slowPeriod, r.signalPeriod), i = e, a = r.fastPeriod, o = r.slowPeriod, s = r.signalPeriod), c;
9227
+ return (i !== e || a !== r.fastPeriod || o !== r.slowPeriod || s !== r.signalPeriod) && (c = Rs(e, r.fastPeriod, r.slowPeriod, r.signalPeriod), i = e, a = r.fastPeriod, o = r.slowPeriod, s = r.signalPeriod), c;
8934
9228
  }
8935
9229
  return {
8936
9230
  name: `macd_${t}`,
@@ -9003,11 +9297,11 @@ function Ns(e = {}) {
9003
9297
  }
9004
9298
  };
9005
9299
  }
9006
- function Ps(e, t, n = 12, r = 26, i = 9) {
9007
- return t < r || t >= e.length ? null : Ms(e, n, r, i)[t] ?? null;
9300
+ function Bs(e, t, n = 12, r = 26, i = 9) {
9301
+ return t < r || t >= e.length ? null : Rs(e, n, r, i)[t] ?? null;
9008
9302
  }
9009
- function Fs(e, t, n = 12, r = 26, i = 9) {
9010
- let a = Ps(e, t, n, r, i);
9303
+ function Vs(e, t, n = 12, r = 26, i = 9) {
9304
+ let a = Bs(e, t, n, r, i);
9011
9305
  return a ? {
9012
9306
  name: "MACD",
9013
9307
  params: [
@@ -9036,7 +9330,7 @@ function Fs(e, t, n = 12, r = 26, i = 9) {
9036
9330
  }
9037
9331
  //#endregion
9038
9332
  //#region src/core/renderers/Indicator/rsi.ts
9039
- function Is(e, t) {
9333
+ function Hs(e, t) {
9040
9334
  let n = Array(e.length);
9041
9335
  if (e.length < t + 1) return n;
9042
9336
  let r = [];
@@ -9058,7 +9352,7 @@ function Is(e, t) {
9058
9352
  }
9059
9353
  return n;
9060
9354
  }
9061
- function Ls(e = {}) {
9355
+ function Us(e = {}) {
9062
9356
  let { paneId: t = "sub", config: n = {} } = e, r = {
9063
9357
  period1: 6,
9064
9358
  period2: 12,
@@ -9069,7 +9363,7 @@ function Ls(e = {}) {
9069
9363
  ...n
9070
9364
  }, i = null, a = 0, o = 0, s = 0, c = [], l = [], u = [];
9071
9365
  function d(e) {
9072
- return (i !== e || a !== r.period1 || o !== r.period2 || s !== r.period3) && (c = Is(e, r.period1), l = Is(e, r.period2), u = Is(e, r.period3), i = e, a = r.period1, o = r.period2, s = r.period3), {
9366
+ return (i !== e || a !== r.period1 || o !== r.period2 || s !== r.period3) && (c = Hs(e, r.period1), l = Hs(e, r.period2), u = Hs(e, r.period3), i = e, a = r.period1, o = r.period2, s = r.period3), {
9073
9367
  rsi1: c,
9074
9368
  rsi2: l,
9075
9369
  rsi3: u
@@ -9115,9 +9409,9 @@ function Ls(e = {}) {
9115
9409
  }
9116
9410
  };
9117
9411
  }
9118
- function Rs(e, t, n = 6, r = 12, i = 24) {
9412
+ function Ws(e, t, n = 6, r = 12, i = 24) {
9119
9413
  if (t < n + 1 || t >= e.length) return null;
9120
- let a = Is(e, n)[t], o = Is(e, r)[t], s = Is(e, i)[t], c = [];
9414
+ let a = Hs(e, n)[t], o = Hs(e, r)[t], s = Hs(e, i)[t], c = [];
9121
9415
  return a !== void 0 && c.push({
9122
9416
  label: `RSI${n}`,
9123
9417
  value: a,
@@ -9142,7 +9436,7 @@ function Rs(e, t, n = 6, r = 12, i = 24) {
9142
9436
  }
9143
9437
  //#endregion
9144
9438
  //#region src/core/renderers/Indicator/cci.ts
9145
- function zs(e, t) {
9439
+ function Gs(e, t) {
9146
9440
  let n = Array(e.length);
9147
9441
  if (e.length < t) return n;
9148
9442
  let r = e.map((e) => (e.high + e.low + e.close) / 3);
@@ -9156,14 +9450,14 @@ function zs(e, t) {
9156
9450
  }
9157
9451
  return n;
9158
9452
  }
9159
- function Bs(e = {}) {
9453
+ function Ks(e = {}) {
9160
9454
  let { paneId: t = "sub", config: n = {} } = e, r = {
9161
9455
  period: 14,
9162
9456
  showCCI: !0,
9163
9457
  ...n
9164
9458
  }, i = null, a = 0, o = [];
9165
9459
  function s(e) {
9166
- return (i !== e || a !== r.period) && (o = zs(e, r.period), i = e, a = r.period), o;
9460
+ return (i !== e || a !== r.period) && (o = Gs(e, r.period), i = e, a = r.period), o;
9167
9461
  }
9168
9462
  return {
9169
9463
  name: `cci_${t}`,
@@ -9213,12 +9507,12 @@ function Bs(e = {}) {
9213
9507
  }
9214
9508
  };
9215
9509
  }
9216
- function Vs(e, t, n) {
9217
- return zs(e, n)[t];
9510
+ function qs(e, t, n) {
9511
+ return Gs(e, n)[t];
9218
9512
  }
9219
- function Hs(e, t, n = 14) {
9513
+ function Js(e, t, n = 14) {
9220
9514
  if (t < n || t >= e.length) return null;
9221
- let r = Vs(e, t, n);
9515
+ let r = qs(e, t, n);
9222
9516
  return r === void 0 ? null : {
9223
9517
  name: "CCI",
9224
9518
  params: [n],
@@ -9231,7 +9525,7 @@ function Hs(e, t, n = 14) {
9231
9525
  }
9232
9526
  //#endregion
9233
9527
  //#region src/core/renderers/Indicator/stoch.ts
9234
- function Us(e, t, n) {
9528
+ function Ys(e, t, n) {
9235
9529
  let r = Array(e.length);
9236
9530
  if (e.length < t) return r;
9237
9531
  let i = Array(e.length);
@@ -9259,7 +9553,7 @@ function Us(e, t, n) {
9259
9553
  }
9260
9554
  return r;
9261
9555
  }
9262
- function Ws(e = {}) {
9556
+ function Xs(e = {}) {
9263
9557
  let { paneId: t = "sub", config: n = {} } = e, r = {
9264
9558
  n: 9,
9265
9559
  m: 3,
@@ -9268,7 +9562,7 @@ function Ws(e = {}) {
9268
9562
  ...n
9269
9563
  }, i = null, a = 0, o = 0, s = [];
9270
9564
  function c(e) {
9271
- return (i !== e || a !== r.n || o !== r.m) && (s = Us(e, r.n, r.m), i = e, a = r.n, o = r.m), s;
9565
+ return (i !== e || a !== r.n || o !== r.m) && (s = Ys(e, r.n, r.m), i = e, a = r.n, o = r.m), s;
9272
9566
  }
9273
9567
  return {
9274
9568
  name: `stoch_${t}`,
@@ -9324,12 +9618,12 @@ function Ws(e = {}) {
9324
9618
  }
9325
9619
  };
9326
9620
  }
9327
- function Gs(e, t, n, r) {
9328
- return Us(e, n, r)[t];
9621
+ function Zs(e, t, n, r) {
9622
+ return Ys(e, n, r)[t];
9329
9623
  }
9330
- function Ks(e, t, n = 9, r = 3) {
9624
+ function Qs(e, t, n = 9, r = 3) {
9331
9625
  if (t < n + r - 1 || t >= e.length) return null;
9332
- let i = Gs(e, t, n, r);
9626
+ let i = Zs(e, t, n, r);
9333
9627
  return i ? {
9334
9628
  name: "STOCH",
9335
9629
  params: [n, r],
@@ -9346,7 +9640,7 @@ function Ks(e, t, n = 9, r = 3) {
9346
9640
  }
9347
9641
  //#endregion
9348
9642
  //#region src/core/renderers/Indicator/mom.ts
9349
- function qs(e, t) {
9643
+ function $s(e, t) {
9350
9644
  let n = Array(e.length);
9351
9645
  if (e.length < t + 1) return n;
9352
9646
  for (let r = t; r < e.length; r++) {
@@ -9355,14 +9649,14 @@ function qs(e, t) {
9355
9649
  }
9356
9650
  return n;
9357
9651
  }
9358
- function Js(e = {}) {
9652
+ function ec(e = {}) {
9359
9653
  let { paneId: t = "sub", config: n = {} } = e, r = {
9360
9654
  period: 10,
9361
9655
  showMOM: !0,
9362
9656
  ...n
9363
9657
  }, i = null, a = 0, o = [];
9364
9658
  function s(e) {
9365
- return (i !== e || a !== r.period) && (o = qs(e, r.period), i = e, a = r.period), o;
9659
+ return (i !== e || a !== r.period) && (o = $s(e, r.period), i = e, a = r.period), o;
9366
9660
  }
9367
9661
  return {
9368
9662
  name: `mom_${t}`,
@@ -9413,12 +9707,12 @@ function Js(e = {}) {
9413
9707
  }
9414
9708
  };
9415
9709
  }
9416
- function Ys(e, t, n) {
9417
- return qs(e, n)[t];
9710
+ function tc(e, t, n) {
9711
+ return $s(e, n)[t];
9418
9712
  }
9419
- function Xs(e, t, n = 10) {
9713
+ function nc(e, t, n = 10) {
9420
9714
  if (t < n || t >= e.length) return null;
9421
- let r = Ys(e, t, n);
9715
+ let r = tc(e, t, n);
9422
9716
  return r === void 0 ? null : {
9423
9717
  name: "MOM",
9424
9718
  params: [n],
@@ -9431,7 +9725,7 @@ function Xs(e, t, n = 10) {
9431
9725
  }
9432
9726
  //#endregion
9433
9727
  //#region src/core/renderers/Indicator/wmsr.ts
9434
- function Zs(e, t) {
9728
+ function rc(e, t) {
9435
9729
  let n = Array(e.length);
9436
9730
  if (e.length < t) return n;
9437
9731
  for (let r = t - 1; r < e.length; r++) {
@@ -9445,14 +9739,14 @@ function Zs(e, t) {
9445
9739
  }
9446
9740
  return n;
9447
9741
  }
9448
- function Qs(e = {}) {
9742
+ function ic(e = {}) {
9449
9743
  let { paneId: t = "sub", config: n = {} } = e, r = {
9450
9744
  period: 14,
9451
9745
  showWMSR: !0,
9452
9746
  ...n
9453
9747
  }, i = null, a = 0, o = [];
9454
9748
  function s(e) {
9455
- return (i !== e || a !== r.period) && (o = Zs(e, r.period), i = e, a = r.period), o;
9749
+ return (i !== e || a !== r.period) && (o = rc(e, r.period), i = e, a = r.period), o;
9456
9750
  }
9457
9751
  return {
9458
9752
  name: `wmsr_${t}`,
@@ -9495,12 +9789,12 @@ function Qs(e = {}) {
9495
9789
  }
9496
9790
  };
9497
9791
  }
9498
- function $s(e, t, n) {
9499
- return Zs(e, n)[t];
9792
+ function ac(e, t, n) {
9793
+ return rc(e, n)[t];
9500
9794
  }
9501
- function ec(e, t, n = 14) {
9795
+ function oc(e, t, n = 14) {
9502
9796
  if (t < n || t >= e.length) return null;
9503
- let r = $s(e, t, n);
9797
+ let r = ac(e, t, n);
9504
9798
  return r === void 0 ? null : {
9505
9799
  name: "WMSR",
9506
9800
  params: [n],
@@ -9513,7 +9807,7 @@ function ec(e, t, n = 14) {
9513
9807
  }
9514
9808
  //#endregion
9515
9809
  //#region src/core/renderers/Indicator/kst.ts
9516
- function tc(e, t) {
9810
+ function sc(e, t) {
9517
9811
  let n = Array(e.length);
9518
9812
  if (e.length < t + 1) return n;
9519
9813
  for (let r = t; r < e.length; r++) {
@@ -9522,7 +9816,7 @@ function tc(e, t) {
9522
9816
  }
9523
9817
  return n;
9524
9818
  }
9525
- function nc(e, t) {
9819
+ function cc(e, t) {
9526
9820
  let n = Array(e.length), r = 0, i = 0;
9527
9821
  for (let a = 0; a < e.length; a++) {
9528
9822
  let o = e[a];
@@ -9536,13 +9830,13 @@ function nc(e, t) {
9536
9830
  }
9537
9831
  return n;
9538
9832
  }
9539
- function rc(e, t, n, r, i, a) {
9540
- let o = Array(e.length), s = tc(e, t), c = tc(e, n), l = tc(e, r), u = tc(e, i), d = nc(s, 10), f = nc(c, 10), p = nc(l, 10), m = nc(u, 15), h = Array(e.length);
9833
+ function lc(e, t, n, r, i, a) {
9834
+ let o = Array(e.length), s = sc(e, t), c = sc(e, n), l = sc(e, r), u = sc(e, i), d = cc(s, 10), f = cc(c, 10), p = cc(l, 10), m = cc(u, 15), h = Array(e.length);
9541
9835
  for (let t = 0; t < e.length; t++) {
9542
9836
  let e = d[t], n = f[t], r = p[t], i = m[t];
9543
9837
  e !== void 0 && n !== void 0 && r !== void 0 && i !== void 0 && (h[t] = e * 1 + n * 2 + r * 3 + i * 4);
9544
9838
  }
9545
- let g = nc(h, a);
9839
+ let g = cc(h, a);
9546
9840
  for (let t = 0; t < e.length; t++) {
9547
9841
  let e = h[t], n = g[t];
9548
9842
  e !== void 0 && n !== void 0 && (o[t] = {
@@ -9552,7 +9846,7 @@ function rc(e, t, n, r, i, a) {
9552
9846
  }
9553
9847
  return o;
9554
9848
  }
9555
- function ic(e = {}) {
9849
+ function uc(e = {}) {
9556
9850
  let { paneId: t = "sub", config: n = {} } = e, r = {
9557
9851
  roc1: 10,
9558
9852
  roc2: 15,
@@ -9565,7 +9859,7 @@ function ic(e = {}) {
9565
9859
  }, i = null, a = "", o = [];
9566
9860
  function s(e) {
9567
9861
  let t = `${r.roc1}-${r.roc2}-${r.roc3}-${r.roc4}-${r.signalPeriod}`;
9568
- return (i !== e || a !== t) && (o = rc(e, r.roc1, r.roc2, r.roc3, r.roc4, r.signalPeriod), i = e, a = t), o;
9862
+ return (i !== e || a !== t) && (o = lc(e, r.roc1, r.roc2, r.roc3, r.roc4, r.signalPeriod), i = e, a = t), o;
9569
9863
  }
9570
9864
  return {
9571
9865
  name: `kst_${t}`,
@@ -9629,12 +9923,12 @@ function ic(e = {}) {
9629
9923
  }
9630
9924
  };
9631
9925
  }
9632
- function ac(e, t, n, r, i, a, o) {
9633
- return rc(e, n, r, i, a, o)[t];
9926
+ function dc(e, t, n, r, i, a, o) {
9927
+ return lc(e, n, r, i, a, o)[t];
9634
9928
  }
9635
- function oc(e, t, n = 10, r = 15, i = 20, a = 30, o = 9) {
9929
+ function fc(e, t, n = 10, r = 15, i = 20, a = 30, o = 9) {
9636
9930
  if (t < a + 15 + o || t >= e.length) return null;
9637
- let s = ac(e, t, n, r, i, a, o);
9931
+ let s = dc(e, t, n, r, i, a, o);
9638
9932
  return s ? {
9639
9933
  name: "KST",
9640
9934
  params: [
@@ -9657,7 +9951,7 @@ function oc(e, t, n = 10, r = 15, i = 20, a = 30, o = 9) {
9657
9951
  }
9658
9952
  //#endregion
9659
9953
  //#region src/core/renderers/Indicator/fastk.ts
9660
- function sc(e, t) {
9954
+ function pc(e, t) {
9661
9955
  let n = Array(e.length);
9662
9956
  if (e.length < t) return n;
9663
9957
  for (let r = t - 1; r < e.length; r++) {
@@ -9671,14 +9965,14 @@ function sc(e, t) {
9671
9965
  }
9672
9966
  return n;
9673
9967
  }
9674
- function cc(e = {}) {
9968
+ function mc(e = {}) {
9675
9969
  let { paneId: t = "sub", config: n = {} } = e, r = {
9676
9970
  period: 9,
9677
9971
  showFASTK: !0,
9678
9972
  ...n
9679
9973
  }, i = null, a = 0, o = [];
9680
9974
  function s(e) {
9681
- return (i !== e || a !== r.period) && (o = sc(e, r.period), i = e, a = r.period), o;
9975
+ return (i !== e || a !== r.period) && (o = pc(e, r.period), i = e, a = r.period), o;
9682
9976
  }
9683
9977
  return {
9684
9978
  name: `fastk_${t}`,
@@ -9721,12 +10015,12 @@ function cc(e = {}) {
9721
10015
  }
9722
10016
  };
9723
10017
  }
9724
- function lc(e, t, n) {
9725
- return sc(e, n)[t];
10018
+ function hc(e, t, n) {
10019
+ return pc(e, n)[t];
9726
10020
  }
9727
- function uc(e, t, n = 9) {
10021
+ function gc(e, t, n = 9) {
9728
10022
  if (t < n || t >= e.length) return null;
9729
- let r = lc(e, t, n);
10023
+ let r = hc(e, t, n);
9730
10024
  return r === void 0 ? null : {
9731
10025
  name: "FASTK",
9732
10026
  params: [n],
@@ -9739,24 +10033,24 @@ function uc(e, t, n = 9) {
9739
10033
  }
9740
10034
  //#endregion
9741
10035
  //#region src/core/renderers/Indicator/index.ts
9742
- function dc(e) {
10036
+ function _c(e) {
9743
10037
  let { indicatorId: t, paneId: n } = e;
9744
10038
  switch (t) {
9745
- case "VOLUME": return ms({ paneId: n });
9746
- case "MACD": return Ns({ paneId: n });
9747
- case "RSI": return Ls({ paneId: n });
9748
- case "CCI": return Bs({ paneId: n });
9749
- case "STOCH": return Ws({ paneId: n });
9750
- case "MOM": return Js({ paneId: n });
9751
- case "WMSR": return Qs({ paneId: n });
9752
- case "KST": return ic({ paneId: n });
9753
- case "FASTK": return cc({ paneId: n });
10039
+ case "VOLUME": return gs({ paneId: n });
10040
+ case "MACD": return zs({ paneId: n });
10041
+ case "RSI": return Us({ paneId: n });
10042
+ case "CCI": return Ks({ paneId: n });
10043
+ case "STOCH": return Xs({ paneId: n });
10044
+ case "MOM": return ec({ paneId: n });
10045
+ case "WMSR": return ic({ paneId: n });
10046
+ case "KST": return uc({ paneId: n });
10047
+ case "FASTK": return mc({ paneId: n });
9754
10048
  default: throw Error(`Unknown indicator: ${t}`);
9755
10049
  }
9756
10050
  }
9757
10051
  //#endregion
9758
10052
  //#region src/core/chart.ts
9759
- var fc = class e {
10053
+ var vc = class e {
9760
10054
  dom;
9761
10055
  opt;
9762
10056
  data = [];
@@ -9768,7 +10062,7 @@ var fc = class e {
9768
10062
  pluginHost;
9769
10063
  rendererPluginManager;
9770
10064
  constructor(e, t) {
9771
- this.dom = e, this.opt = t, this.interaction = new fs(this), this.markerManager = new go(), this.pluginHost = da(), this.rendererPluginManager = new pa(), this.rendererPluginManager.setPluginHost(this.pluginHost), this.rendererPluginManager.setInvalidateCallback(() => this.scheduleDraw()), this.initPanes();
10065
+ this.dom = e, this.opt = t, this.interaction = new ms(this), this.markerManager = new vo(), this.pluginHost = da(), this.rendererPluginManager = new pa(), this.rendererPluginManager.setPluginHost(this.pluginHost), this.rendererPluginManager.setInvalidateCallback(() => this.scheduleDraw()), this.initPanes();
9772
10066
  }
9773
10067
  get plugin() {
9774
10068
  return this.pluginHost;
@@ -9802,10 +10096,10 @@ var fc = class e {
9802
10096
  console.log("[Chart] draw aborted: no data");
9803
10097
  return;
9804
10098
  }
9805
- let { start: t, end: n } = cs(e.scrollLeft, e.plotWidth, this.opt.kWidth, this.opt.kGap, this.data.length, e.dpr), r = {
10099
+ let { start: t, end: n } = us(e.scrollLeft, e.plotWidth, this.opt.kWidth, this.opt.kGap, this.data.length, e.dpr), r = {
9806
10100
  start: t,
9807
10101
  end: n
9808
- }, i = this.calcKLinePositions(r), { kWidthPx: a } = ss(this.opt.kWidth, this.opt.kGap, e.dpr);
10102
+ }, i = this.calcKLinePositions(r), { kWidthPx: a } = ls(this.opt.kWidth, this.opt.kGap, e.dpr);
9809
10103
  this.interaction.setKLinePositions(i, r, a);
9810
10104
  for (let t of this.paneRenderers) {
9811
10105
  let n = t.getPane(), a = t.getDom().plotCanvas.getContext("2d"), o = t.getDom().yAxisCanvas.getContext("2d");
@@ -9920,7 +10214,7 @@ var fc = class e {
9920
10214
  calcKLinePositions(e) {
9921
10215
  let { start: t, end: n } = e, r = n - t;
9922
10216
  if (r <= 0) return [];
9923
- let i = this.viewport?.dpr || window.devicePixelRatio || 1, { unitPx: a, startXPx: o } = ss(this.opt.kWidth, this.opt.kGap, i), s = Array(r);
10217
+ let i = this.viewport?.dpr || window.devicePixelRatio || 1, { unitPx: a, startXPx: o } = ls(this.opt.kWidth, this.opt.kGap, i), s = Array(r);
9924
10218
  for (let e = 0; e < r; e++) s[e] = (o + (t + e) * a) / i;
9925
10219
  return s;
9926
10220
  }
@@ -9938,9 +10232,9 @@ var fc = class e {
9938
10232
  console.warn(`Pane "${e}" already exists`);
9939
10233
  return;
9940
10234
  }
9941
- let t = new ds(e), n = document.createElement("canvas"), r = document.createElement("canvas"), i = e === "main";
10235
+ let t = new ps(e), n = document.createElement("canvas"), r = document.createElement("canvas"), i = e === "main";
9942
10236
  n.id = `${e}-plot`, n.className = i ? "plot-canvas main" : "plot-canvas sub", n.style.position = "absolute", n.style.left = "0", n.style.top = "0", r.id = `${e}-yAxis`, r.className = "right-axis", r.style.position = "absolute", r.style.right = "0";
9943
- let a = new ps({
10237
+ let a = new hs({
9944
10238
  plotCanvas: n,
9945
10239
  yAxisCanvas: r
9946
10240
  }, t, {
@@ -9971,7 +10265,7 @@ var fc = class e {
9971
10265
  return n && this.updateRendererConfig(e, n), !0;
9972
10266
  }
9973
10267
  this.addPane(r);
9974
- let i = dc({
10268
+ let i = _c({
9975
10269
  indicatorId: t,
9976
10270
  paneId: r
9977
10271
  });
@@ -9993,6 +10287,12 @@ var fc = class e {
9993
10287
  getSubPaneIndicators() {
9994
10288
  return this.paneRenderers.map((e) => e.getPane().id).filter((t) => t.startsWith(e.SUB_PANE_PREFIX)).map((t) => t.slice(e.SUB_PANE_PREFIX.length));
9995
10289
  }
10290
+ translatePrice(e, t) {
10291
+ let n = this.paneRenderers.find((t) => t.getPane().id === e);
10292
+ if (!n) return;
10293
+ let r = n.getPane(), i = r.yAxis.deltaYToPriceOffset(t), a = r.yAxis.getPriceOffset();
10294
+ r.yAxis.setPriceOffset(a + i), this.scheduleDraw();
10295
+ }
9996
10296
  updateData(e) {
9997
10297
  console.log("[Chart] updateData called, data length:", e?.length), this.data = e ?? [];
9998
10298
  let t = this.dom.container;
@@ -10000,17 +10300,14 @@ var fc = class e {
10000
10300
  let e = this.getContentWidth(), n = Math.max(0, e - t.clientWidth);
10001
10301
  t.scrollLeft > n && (t.scrollLeft = n);
10002
10302
  }
10003
- this.rendererPluginManager.notifyDataUpdate(this.data, {
10004
- start: 0,
10005
- end: this.data.length
10006
- }), this.interaction.reset(), this.scheduleDraw();
10303
+ this.interaction.reset(), this.scheduleDraw();
10007
10304
  }
10008
10305
  getData() {
10009
10306
  return this.data;
10010
10307
  }
10011
10308
  getContentWidth() {
10012
- let e = this.data?.length ?? 0, t = this.viewport?.dpr || window.devicePixelRatio || 1, { startXPx: n, unitPx: r } = ss(this.opt.kWidth, this.opt.kGap, t);
10013
- return (n + e * r) / t + (this.opt.rightAxisWidth + (this.opt.priceLabelWidth || 60));
10309
+ let e = this.data?.length ?? 0, t = this.viewport?.dpr || window.devicePixelRatio || 1, { startXPx: n, unitPx: r } = ls(this.opt.kWidth, this.opt.kGap, t);
10310
+ return (n + e * r) / t;
10014
10311
  }
10015
10312
  resize() {
10016
10313
  let e = this.computeViewport();
@@ -10026,8 +10323,8 @@ var fc = class e {
10026
10323
  }
10027
10324
  initPanes() {
10028
10325
  this.paneRenderers = this.opt.panes.map((e) => {
10029
- let t = new ds(e.id), n = document.createElement("canvas"), r = document.createElement("canvas"), i = e.id === "main";
10030
- return n.id = `${e.id}-plot`, n.className = i ? "plot-canvas main" : "plot-canvas sub", n.style.position = "absolute", n.style.left = "0", n.style.top = "0", r.id = `${e.id}-yAxis`, r.className = "right-axis", r.style.position = "absolute", r.style.right = "0", new ps({
10326
+ let t = new ps(e.id), n = document.createElement("canvas"), r = document.createElement("canvas"), i = e.id === "main";
10327
+ return n.id = `${e.id}-plot`, n.className = i ? "plot-canvas main" : "plot-canvas sub", n.style.position = "absolute", n.style.left = "0", n.style.top = "0", r.id = `${e.id}-yAxis`, r.className = "right-axis", r.style.position = "absolute", r.style.right = "0", new hs({
10031
10328
  plotCanvas: n,
10032
10329
  yAxisCanvas: r
10033
10330
  }, t, {
@@ -10076,18 +10373,18 @@ var fc = class e {
10076
10373
  };
10077
10374
  //#endregion
10078
10375
  //#region src/types/kLine.ts
10079
- function pc(e) {
10376
+ function yc(e) {
10080
10377
  return e.open > e.close ? "down" : e.open < e.close ? "up" : "flat";
10081
10378
  }
10082
10379
  //#endregion
10083
10380
  //#region src/types/volumePrice.ts
10084
10381
  var $ = /* @__PURE__ */ function(e) {
10085
10382
  return e.RISE_WITH_VOLUME = "rise_with_volume", e.RISE_WITHOUT_VOLUME = "rise_without_volume", e.FALL_WITH_VOLUME = "fall_with_volume", e.FALL_WITHOUT_VOLUME = "fall_without_volume", e.OTHERS = "others", e;
10086
- }({}), mc = {
10383
+ }({}), bc = {
10087
10384
  volumeAmplifyThreshold: 1.5,
10088
10385
  volumeShrinkThreshold: .8,
10089
10386
  avgPeriod: 20
10090
- }, hc = class {
10387
+ }, xc = class {
10091
10388
  prefixSum = [];
10092
10389
  dataLength = 0;
10093
10390
  build(e) {
@@ -10112,8 +10409,8 @@ var $ = /* @__PURE__ */ function(e) {
10112
10409
  return this.dataLength;
10113
10410
  }
10114
10411
  };
10115
- function gc(e, t, n, r = mc) {
10116
- let i = new hc();
10412
+ function Sc(e, t, n, r = bc) {
10413
+ let i = new xc();
10117
10414
  i.build(e);
10118
10415
  let a = [], { volumeAmplifyThreshold: o, volumeShrinkThreshold: s, avgPeriod: c } = r;
10119
10416
  for (let r = t; r < n && r < e.length; r++) {
@@ -10134,7 +10431,7 @@ function gc(e, t, n, r = mc) {
10134
10431
  }
10135
10432
  //#endregion
10136
10433
  //#region src/core/renderers/candle.ts
10137
- function _c() {
10434
+ function Cc() {
10138
10435
  return {
10139
10436
  name: "candle",
10140
10437
  version: "1.0.0",
@@ -10145,36 +10442,36 @@ function _c() {
10145
10442
  draw(e) {
10146
10443
  let { ctx: t, pane: n, data: r, range: i, scrollLeft: a, kWidth: o, kGap: s, dpr: c, kLinePositions: l, markerManager: u } = e, d = r;
10147
10444
  if (!d.length) return;
10148
- let { kWidthPx: f } = ss(o, s, c);
10445
+ let { kWidthPx: f } = ls(o, s, c);
10149
10446
  t.save(), t.translate(-a, 0);
10150
- let p = l || [], m = gc(d, i.start, i.end, mc);
10447
+ let p = l || [], m = Sc(d, i.start, i.end, bc);
10151
10448
  for (let e = i.start; e < i.end && e < d.length; e++) {
10152
10449
  let r = d[e];
10153
10450
  if (!r) continue;
10154
10451
  let a = n.yAxis.priceToY(r.open), s = n.yAxis.priceToY(r.close), l = n.yAxis.priceToY(r.high), h = n.yAxis.priceToY(r.low), g = Math.min(a, s), _ = Math.max(Math.abs(a - s), 1), v = p[e - i.start];
10155
10452
  if (!v) continue;
10156
- let y = xs(Math.round(v * c), g, f, _, c);
10157
- t.fillStyle = pc(r) === "up" ? X.UP : X.DOWN, t.fillRect(y.bodyRect.x, y.bodyRect.y, y.bodyRect.width, y.bodyRect.height);
10453
+ let y = Ss(Math.round(v * c), g, f, _, c);
10454
+ t.fillStyle = yc(r) === "up" ? X.UP : X.DOWN, t.fillRect(y.bodyRect.x, y.bodyRect.y, y.bodyRect.width, y.bodyRect.height);
10158
10455
  let b = y.wickRect.width, x = y.wickRect.x, S = y.bodyRect.y, C = y.bodyRect.y + y.bodyRect.height, w = Math.max(r.open, r.close), T = Math.min(r.open, r.close);
10159
10456
  if (r.high > w) {
10160
- let e = ys(x, l, S, c);
10457
+ let e = bs(x, l, S, c);
10161
10458
  e && t.fillRect(e.x, e.y, b, e.height);
10162
10459
  }
10163
10460
  if (r.low < T) {
10164
- let e = ys(x, C, h, c);
10461
+ let e = bs(x, C, h, c);
10165
10462
  e && t.fillRect(e.x, e.y, b, e.height);
10166
10463
  }
10167
10464
  let E = m[e - i.start];
10168
10465
  if (E !== $.OTHERS && u) {
10169
10466
  let n = E === $.RISE_WITH_VOLUME || E === $.RISE_WITHOUT_VOLUME ? l - 15 : h + 15;
10170
- vc(t, y.bodyRect.x + y.bodyRect.width / 2, n, E, e, o, 4, u);
10467
+ wc(t, y.bodyRect.x + y.bodyRect.width / 2, n, E, e, o, 4, u);
10171
10468
  }
10172
10469
  }
10173
10470
  t.restore();
10174
10471
  }
10175
10472
  };
10176
10473
  }
10177
- function vc(e, t, n, r, i, a, o = 4, s) {
10474
+ function wc(e, t, n, r, i, a, o = 4, s) {
10178
10475
  let c = Math.min(a, 20), l = c * Math.sqrt(3) / 2, u, d;
10179
10476
  switch (r) {
10180
10477
  case $.RISE_WITH_VOLUME:
@@ -10238,12 +10535,12 @@ function vc(e, t, n, r, i, a, o = 4, s) {
10238
10535
  }
10239
10536
  //#endregion
10240
10537
  //#region src/core/utils/tickCount.ts
10241
- function yc(e, t) {
10538
+ function Tc(e, t) {
10242
10539
  return t ? Math.max(4, Math.min(8, Math.round(e / 80))) : 2;
10243
10540
  }
10244
10541
  //#endregion
10245
10542
  //#region src/core/renderers/gridLines.ts
10246
- function bc() {
10543
+ function Ec() {
10247
10544
  return {
10248
10545
  name: "gridLines",
10249
10546
  version: "1.0.0",
@@ -10254,11 +10551,11 @@ function bc() {
10254
10551
  draw(e) {
10255
10552
  let { ctx: t, pane: n, data: r, range: i, scrollLeft: a, kWidth: o, dpr: s, kLinePositions: c } = e, l = r;
10256
10553
  if (!l.length) return;
10257
- let u = yc(n.height, n.id === "main");
10554
+ let u = Tc(n.height, n.id === "main");
10258
10555
  t.save(), t.fillStyle = Aa.HORIZONTAL, t.translate(-a, 0);
10259
10556
  let d = t.canvas.width / s, f = a, p = a + d, m = n.yAxis.getPaddingTop(), h = n.yAxis.getPaddingBottom(), g = m, _ = Math.max(m, n.height - h), v = Math.max(0, _ - g);
10260
10557
  for (let e = 0; e < u; e++) {
10261
- let n = u <= 1 ? 0 : e / (u - 1), r = bs(f, p, Math.round(g + n * v), s);
10558
+ let n = u <= 1 ? 0 : e / (u - 1), r = xs(f, p, Math.round(g + n * v), s);
10262
10559
  r && t.fillRect(r.x, r.y, r.width, r.height);
10263
10560
  }
10264
10561
  let y = Ea(l);
@@ -10266,7 +10563,7 @@ function bc() {
10266
10563
  if (e < i.start || e >= i.end || e >= l.length) continue;
10267
10564
  let r = e - i.start;
10268
10565
  if (r < 0 || r >= c.length) continue;
10269
- let a = ys(c[r] + o / 2, 0, n.height, s);
10566
+ let a = bs(c[r] + o / 2, 0, n.height, s);
10270
10567
  a && t.fillRect(a.x, a.y, a.width, a.height);
10271
10568
  }
10272
10569
  t.restore();
@@ -10275,7 +10572,7 @@ function bc() {
10275
10572
  }
10276
10573
  //#endregion
10277
10574
  //#region src/core/renderers/lastPrice.ts
10278
- function xc() {
10575
+ function Dc() {
10279
10576
  return {
10280
10577
  name: "lastPriceLine",
10281
10578
  version: "1.0.0",
@@ -10296,7 +10593,7 @@ function xc() {
10296
10593
  }
10297
10594
  //#endregion
10298
10595
  //#region src/core/renderers/extremaMarkers.ts
10299
- function Sc() {
10596
+ function Oc() {
10300
10597
  return {
10301
10598
  name: "extremaMarkers",
10302
10599
  version: "1.0.0",
@@ -10319,46 +10616,67 @@ function Sc() {
10319
10616
  let t = e - i.start;
10320
10617
  return t < 0 || t >= l.length ? 0 : l[t] + o / 2;
10321
10618
  };
10322
- t.save(), t.translate(-a, 0), Cc(t, _(h), n.yAxis.priceToY(p), p, s, c, a), Cc(t, _(g), n.yAxis.priceToY(m), m, s, c, a), t.restore();
10619
+ t.save(), t.translate(-a, 0), kc(t, _(h), n.yAxis.priceToY(p), p, s, c, a), kc(t, _(g), n.yAxis.priceToY(m), m, s, c, a), t.restore();
10323
10620
  }
10324
10621
  };
10325
10622
  }
10326
- function Cc(e, t, n, r, i, a, o) {
10623
+ function kc(e, t, n, r, i, a, o) {
10327
10624
  let s = r.toFixed(2);
10328
10625
  e.font = "12px Arial";
10329
10626
  let c = e.measureText(s).width, l = t - o + 30 + 4 + c > a, u = t, d = l ? t - 30 : t + 30;
10330
10627
  u > d && ([u, d] = [d, u]);
10331
- let f = bs(u, d, n, i);
10628
+ let f = xs(u, d, n, i);
10332
10629
  f && (e.fillStyle = Da.WEAK, e.fillRect(f.x, f.y, f.width, f.height));
10333
10630
  let p = Z(d, i), m = Z(n, i);
10334
10631
  e.fillStyle = Da.WEAK, e.beginPath(), e.arc(p, m, 2, 0, Math.PI * 2), e.fill(), e.font = "12px Arial", e.textBaseline = "middle", e.fillStyle = X.NEUTRAL, l ? (e.textAlign = "right", e.fillText(s, Z(t - 30 - 4, i), Z(n, i))) : (e.textAlign = "left", e.fillText(s, Z(t + 30 + 4, i), Z(n, i)));
10335
10632
  }
10336
10633
  //#endregion
10634
+ //#region src/utils/priceToY.ts
10635
+ function Ac(e, t, n, r, i, a) {
10636
+ let o = t - n || 1, s = (e - n) / o;
10637
+ return i + Math.max(1, r - i - a) * (1 - s);
10638
+ }
10639
+ function jc(e, t, n, r, i, a) {
10640
+ let o = t - n || 1, s = Math.max(1, r - i - a);
10641
+ return n + (1 - (Math.min(Math.max(e, i), i + s) - i) / s) * o;
10642
+ }
10643
+ //#endregion
10337
10644
  //#region src/utils/kLineDraw/axis.ts
10338
- function wc(e, t) {
10339
- let { x: n, y: r, width: i, height: a, priceRange: o, yPaddingPx: s = 0, dpr: c, ticks: l = 10, bgColor: u = Oa.TRANSPARENT, textColor: d = Da.SECONDARY, lineColor: f = ka.DARK, fontSize: p = 16, paddingX: m = 12, drawLeftBorder: h = !0, drawTickLines: g = !0 } = t, _ = Math.max(0, Math.min(s, Math.floor(a / 2) - 1)), { maxPrice: v, minPrice: y } = o, b = v - y, x = b === 0 ? 0 : b / (Math.max(2, l) - 1);
10340
- e.fillStyle = u, e.fillRect(n, r, i, a), h && (e.strokeStyle = f, e.lineWidth = 1, e.beginPath(), e.moveTo(Q(n, c), r), e.lineTo(Q(n, c), r + a), e.stroke()), e.font = `${p}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`, e.textBaseline = "middle", e.textAlign = "left";
10341
- let S = n + m;
10645
+ function Mc(e, t) {
10646
+ let { x: n, y: r, width: i, height: a, priceRange: o, yPaddingPx: s = 0, dpr: c, ticks: l = 10, bgColor: u = Oa.TRANSPARENT, textColor: d = Da.SECONDARY, lineColor: f = ka.DARK, fontSize: p = 16, drawLeftBorder: m = !0, drawTickLines: h = !0, priceOffset: g = 0 } = t, _ = Math.max(0, Math.min(s, Math.floor(a / 2) - 1)), { maxPrice: v, minPrice: y } = o, b = v - y, x = b === 0 ? 0 : b / (Math.max(2, l) - 1);
10647
+ e.fillStyle = u, e.fillRect(n, r, i, a), m && (e.strokeStyle = f, e.lineWidth = 1, e.beginPath(), e.moveTo(Q(n, c), r), e.lineTo(Q(n, c), r + a), e.stroke()), e.font = `${p}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`, e.textBaseline = "middle", e.textAlign = "center";
10648
+ let S = n + i / 2;
10342
10649
  for (let t = 0; t < Math.max(2, l); t++) {
10343
- let i = b === 0 ? v : v - x * t, o = Math.round(vs(i, v, y, a, _, _) + r);
10344
- if (g) {
10650
+ let i = b === 0 ? v : v - x * t, o = Math.round(Ac(i, v, y, a, _, _) + r);
10651
+ if (h) {
10345
10652
  e.strokeStyle = f, e.beginPath();
10346
10653
  let t = Q(o, c);
10347
10654
  e.moveTo(n, t), e.lineTo(n + 4, t), e.stroke();
10348
10655
  }
10349
- e.fillStyle = d, e.fillText(i.toFixed(2), Z(S, c), Z(o, c));
10656
+ let s = i + g;
10657
+ e.fillStyle = d, e.fillText(s.toFixed(2), Z(S, c), Z(o, c));
10350
10658
  }
10351
10659
  }
10352
- function Tc(e, t) {
10353
- let { x: n, y: r, width: i, height: a, crosshairX: o, timestamp: s, dpr: c, bgColor: l = Oa.WHITE, textColor: u = Da.PRIMARY, fontSize: d = 16, paddingX: f = 8, paddingY: p = 4 } = t, m = Ta(s);
10354
- e.save(), e.font = `${d}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`, e.textBaseline = "middle", e.textAlign = "center";
10355
- let h = Math.round(e.measureText(m).width), g = Math.min(i, h + f * 2), _ = Math.min(a, d + p * 2), v = Math.min(Math.max(o, n + g / 2), n + i - g / 2), y = r + a / 2, b = v - g / 2;
10356
- y - _ / 2, e.fillStyle = l, e.fillRect(Z(b, c), 0, Z(g, c), Z(_, c)), e.fillStyle = u, e.fillText(m, Z(v, c), Z(y, c)), e.restore();
10660
+ function Nc(e, t) {
10661
+ let { x: n, y: r, width: i, height: a, crosshairX: o, timestamp: s, dpr: c, fontSize: l = 16, paddingX: u = 8 } = t, d = Ta(s);
10662
+ e.save(), e.font = `${l}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`, e.textBaseline = "middle", e.textAlign = "center";
10663
+ let f = Math.round(e.measureText(d).width), p = Math.min(i, f + u * 2), m = a, h = Math.min(Math.max(o, n + p / 2), n + i - p / 2), g = r + a / 2, _ = h - p / 2, v = r;
10664
+ e.fillStyle = "rgba(0, 0, 0, 0.8)", e.fillRect(Z(_, c), Z(v, c), Z(p, c), Z(m, c)), e.fillStyle = "#ffffff", e.fillText(d, Z(h, c), Z(g, c)), e.restore();
10357
10665
  }
10358
- function Ec(e, t) {
10359
- let { x: n, y: r, width: i, height: a, data: o, scrollLeft: s, kWidth: c, kGap: l, startIndex: u, endIndex: d, dpr: f, bgColor: p = Oa.TRANSPARENT, textColor: m = Da.SECONDARY, lineColor: h = ka.DARK, fontSize: g = 16, paddingX: _ = 8, drawTopBorder: v = !0, drawBottomBorder: y = !0 } = t, b = Math.round(c * f), x = b % 2 == 0 ? b + 1 : b, S = Math.round(l * f), C = x + S, w = S, T = C / f, E = w / f, D = x / f;
10666
+ function Pc(e, t) {
10667
+ let { x: n, y: r, width: i, height: a, crosshairY: o, priceRange: s, yPaddingPx: c = 0, dpr: l, fontSize: u = 16 } = t, d = Math.max(0, Math.min(c, Math.floor(a / 2) - 1)), { maxPrice: f, minPrice: p } = s, m = jc(o - r, f, p, a, d, d).toFixed(2);
10668
+ e.save(), e.font = `${u}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`, e.textBaseline = "middle", e.textAlign = "center";
10669
+ let h = u + 4, g = i, _ = Math.min(Math.max(o, r + h / 2), r + a - h / 2), v = _ - h / 2;
10670
+ e.fillStyle = "rgba(0, 0, 0, 0.8)";
10671
+ let y = Z(n, l), b = Z(v, l), x = Z(g, l), S = Z(h, l);
10672
+ e.fillRect(y, b, x, S);
10673
+ let C = n + i / 2;
10674
+ e.fillStyle = "#ffffff", e.fillText(m, Z(C, l), Z(_, l)), e.restore();
10675
+ }
10676
+ function Fc(e, t) {
10677
+ let { x: n, y: r, width: i, height: a, data: o, scrollLeft: s, kWidth: c, kGap: l, startIndex: u, endIndex: d, dpr: f, bgColor: p = Oa.TRANSPARENT, textColor: m = Da.SECONDARY, lineColor: h = ka.DARK, fontSize: g = 12, paddingX: _ = 8, drawTopBorder: v = !0, drawBottomBorder: y = !0 } = t, b = Math.round(c * f), x = b % 2 == 0 ? b + 1 : b, S = Math.round(l * f), C = x + S, w = S, T = C / f, E = w / f, D = x / f;
10360
10678
  e.fillStyle = p, e.fillRect(n, r, i, a), v && (e.strokeStyle = h, e.lineWidth = 1, e.beginPath(), e.moveTo(n, Q(r, f)), e.lineTo(n + i, Q(r, f)), e.stroke()), y && (e.strokeStyle = h, e.lineWidth = 1, e.beginPath(), e.moveTo(n, Q(r + a, f)), e.lineTo(n + i, Q(r + a, f)), e.stroke()), e.textAlign = "center", e.textBaseline = "middle";
10361
- let O = r + a / 2, k = Ea(o).filter((e) => e >= u && e < d);
10679
+ let O = r + a / 2 + 1, k = Ea(o).filter((e) => e >= u && e < d);
10362
10680
  for (let t of k) {
10363
10681
  let n = o[t];
10364
10682
  if (!n) continue;
@@ -10371,7 +10689,7 @@ function Ec(e, t) {
10371
10689
  }
10372
10690
  //#endregion
10373
10691
  //#region src/core/renderers/yAxis.ts
10374
- function Dc(e) {
10692
+ function Ic(e) {
10375
10693
  return {
10376
10694
  name: "yAxis",
10377
10695
  version: "1.0.0",
@@ -10380,8 +10698,8 @@ function Dc(e) {
10380
10698
  paneId: oa,
10381
10699
  priority: Y.SYSTEM_YAXIS,
10382
10700
  draw(t) {
10383
- let { ctx: n, pane: r, dpr: i, yAxisCtx: a } = t, o = a || n, s = yc(r.height, r.id === "main");
10384
- wc(o, {
10701
+ let { ctx: n, pane: r, dpr: i, yAxisCtx: a } = t, o = a || n, s = Tc(r.height, r.id === "main");
10702
+ Mc(o, {
10385
10703
  x: 0,
10386
10704
  y: r.top,
10387
10705
  width: e.axisWidth,
@@ -10391,26 +10709,40 @@ function Dc(e) {
10391
10709
  dpr: i,
10392
10710
  ticks: s,
10393
10711
  drawLeftBorder: !1,
10394
- drawTickLines: !1
10712
+ drawTickLines: !1,
10713
+ priceOffset: r.yAxis.getPriceOffset(),
10714
+ fontSize: 12
10715
+ });
10716
+ let c = e.getCrosshair?.();
10717
+ c && c.price !== null && Pc(o, {
10718
+ x: 2,
10719
+ y: r.top,
10720
+ width: e.axisWidth,
10721
+ height: r.height,
10722
+ crosshairY: c.y,
10723
+ priceRange: r.priceRange,
10724
+ yPaddingPx: e.yPaddingPx,
10725
+ dpr: i,
10726
+ fontSize: 12
10395
10727
  });
10396
10728
  }
10397
10729
  };
10398
10730
  }
10399
10731
  //#endregion
10400
10732
  //#region src/core/renderers/timeAxis.ts
10401
- var Oc = Symbol("time-axis");
10402
- function kc(e) {
10733
+ var Lc = Symbol("time-axis");
10734
+ function Rc(e) {
10403
10735
  return {
10404
10736
  name: "timeAxis",
10405
10737
  version: "1.0.0",
10406
10738
  description: "时间轴渲染器",
10407
10739
  debugName: "时间轴",
10408
- paneId: Oc,
10740
+ paneId: Lc,
10409
10741
  priority: Y.SYSTEM_XAXIS,
10410
10742
  isSystem: !0,
10411
10743
  draw(t) {
10412
10744
  let { ctx: n, data: r, range: i, scrollLeft: a, kWidth: o, kGap: s, dpr: c, paneWidth: l } = t, u = r, d = n, f = l, p = e.height;
10413
- d.setTransform(1, 0, 0, 1, 0, 0), d.scale(c, c), d.clearRect(0, 0, f, p), Ec(d, {
10745
+ d.setTransform(1, 0, 0, 1, 0, 0), d.scale(c, c), d.clearRect(0, 0, f, p), Fc(d, {
10414
10746
  x: 0,
10415
10747
  y: 0,
10416
10748
  width: f,
@@ -10428,14 +10760,15 @@ function kc(e) {
10428
10760
  let m = e.getCrosshair?.();
10429
10761
  if (m && typeof m.index == "number") {
10430
10762
  let e = u[m.index];
10431
- e && Tc(d, {
10763
+ e && Nc(d, {
10432
10764
  x: 0,
10433
10765
  y: 0,
10434
10766
  width: f,
10435
10767
  height: p,
10436
10768
  crosshairX: m.x,
10437
10769
  timestamp: e.timestamp,
10438
- dpr: c
10770
+ dpr: c,
10771
+ fontSize: 12
10439
10772
  });
10440
10773
  }
10441
10774
  }
@@ -10443,7 +10776,7 @@ function kc(e) {
10443
10776
  }
10444
10777
  //#endregion
10445
10778
  //#region src/core/renderers/crosshair.ts
10446
- function Ac(e) {
10779
+ function zc(e) {
10447
10780
  return {
10448
10781
  name: "crosshair",
10449
10782
  version: "1.0.0",
@@ -10454,11 +10787,11 @@ function Ac(e) {
10454
10787
  draw(t) {
10455
10788
  let { ctx: n, pane: r, dpr: i, paneWidth: a } = t, o = e.getCrosshairState();
10456
10789
  if (o.isDragging || !o.pos) return;
10457
- let { x: s, y: c } = o.pos, l = r.id === o.activePaneId, u = l ? c - r.top : -1;
10458
- n.save(), n.beginPath(), n.rect(0, 0, a, r.height), n.clip(), n.fillStyle = Ba.LINE;
10459
- let d = ys(s, 0, r.height, i);
10460
- if (d && n.fillRect(d.x, d.y, d.width, d.height), l && u >= 0) {
10461
- let e = bs(0, a, Math.min(u, r.height - 1 / i), i);
10790
+ let { x: s } = o.pos, c = r.id === o.activePaneId, l = -1;
10791
+ c && o.price !== null && (l = r.yAxis.priceToY(o.price)), n.save(), n.beginPath(), n.rect(0, 0, a, r.height), n.clip(), n.fillStyle = Ha.LINE;
10792
+ let u = bs(s, 0, r.height, i);
10793
+ if (u && n.fillRect(u.x, u.y, u.width, u.height), c && l >= 0) {
10794
+ let e = xs(0, a, Math.min(l, r.height - 1 / i), i);
10462
10795
  e && n.fillRect(e.x, e.y, e.width, e.height);
10463
10796
  }
10464
10797
  n.restore();
@@ -10467,7 +10800,7 @@ function Ac(e) {
10467
10800
  }
10468
10801
  //#endregion
10469
10802
  //#region src/core/renderers/paneTitle.ts
10470
- function jc(e) {
10803
+ function Bc(e) {
10471
10804
  let t = { ...e };
10472
10805
  return {
10473
10806
  name: `paneTitle_${e.paneId}`,
@@ -10508,7 +10841,7 @@ function jc(e) {
10508
10841
  }
10509
10842
  //#endregion
10510
10843
  //#region src/components/KLineChart.vue?vue&type=script&setup=true&lang.ts
10511
- var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE__ */ u({
10844
+ var Vc = { class: "chart-wrapper" }, Hc = 4, Uc = /* @__PURE__ */ ho(/* @__PURE__ */ u({
10512
10845
  __name: "KLineChart",
10513
10846
  props: {
10514
10847
  semanticConfig: {},
@@ -10592,7 +10925,7 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
10592
10925
  function ue() {
10593
10926
  C.value?.interaction.onScroll(), I();
10594
10927
  }
10595
- let R = _(["MA"]), de = _({}), z = _([]), B = [
10928
+ let R = _([]), de = _({}), z = _([]), B = [
10596
10929
  "VOLUME",
10597
10930
  "MACD",
10598
10931
  "RSI",
@@ -10649,14 +10982,14 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
10649
10982
  }
10650
10983
  }
10651
10984
  function pe(e = "VOLUME", t) {
10652
- if (z.value.length >= Nc) return !1;
10985
+ if (z.value.length >= Hc) return !1;
10653
10986
  let n = `sub_${e}`;
10654
10987
  if (z.value.some((e) => e.id === n)) return !0;
10655
10988
  if (!C.value?.createSubPane(e, t ?? fe(e))) return !1;
10656
- let r = jc({
10989
+ let r = Bc({
10657
10990
  paneId: n,
10658
10991
  title: e,
10659
- getTitleInfo: () => ve(n)
10992
+ getTitleInfo: () => ye(n)
10660
10993
  });
10661
10994
  return C.value?.useRenderer(r), z.value.push({
10662
10995
  id: n,
@@ -10677,13 +11010,38 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
10677
11010
  C.value?.clearSubPanes(), z.value = [], R.value = R.value.filter((e) => !B.includes(e));
10678
11011
  }
10679
11012
  function ge() {
11013
+ let e = n.semanticConfig.indicators?.main;
11014
+ if (e) for (let t of e) t.enabled && (R.value.includes(t.type) || R.value.push(t.type), t.params && (de.value[t.type] = t.params));
11015
+ }
11016
+ S(R, (e) => {
11017
+ let t = C.value;
11018
+ t && (t.updateRendererConfig("mainIndicatorLegend", { indicators: {
11019
+ MA: {
11020
+ enabled: e.includes("MA"),
11021
+ params: de.value.MA || {}
11022
+ },
11023
+ BOLL: {
11024
+ enabled: e.includes("BOLL"),
11025
+ params: de.value.BOLL || {}
11026
+ },
11027
+ EXPMA: {
11028
+ enabled: e.includes("EXPMA"),
11029
+ params: de.value.EXPMA || {}
11030
+ },
11031
+ ENE: {
11032
+ enabled: e.includes("ENE"),
11033
+ params: de.value.ENE || {}
11034
+ }
11035
+ } }), t.setRendererEnabled("ma", e.includes("MA")), t.setRendererEnabled("boll", e.includes("BOLL")), t.setRendererEnabled("expma", e.includes("EXPMA")), t.setRendererEnabled("ene", e.includes("ENE")), E());
11036
+ }, { deep: !0 });
11037
+ function _e() {
10680
11038
  let e = C.value?.getSubPaneIndicators() ?? [];
10681
11039
  z.value = [];
10682
11040
  for (let t of e) {
10683
- let e = `sub_${t}`, n = jc({
11041
+ let e = `sub_${t}`, n = Bc({
10684
11042
  paneId: e,
10685
11043
  title: t,
10686
- getTitleInfo: () => ve(e)
11044
+ getTitleInfo: () => ye(e)
10687
11045
  });
10688
11046
  C.value?.useRenderer(n), z.value.push({
10689
11047
  id: e,
@@ -10694,15 +11052,15 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
10694
11052
  }), R.value.includes(t) || R.value.push(t);
10695
11053
  }
10696
11054
  }
10697
- function _e(e, t) {
11055
+ function ve(e, t) {
10698
11056
  let n = z.value.find((t) => t.id === e);
10699
11057
  if (!n) return;
10700
11058
  let r = n.indicatorId;
10701
11059
  C.value?.removeRenderer(n.paneTitleRendererName), C.value?.removeSubPane(r), C.value?.createSubPane(t, fe(t));
10702
- let i = `sub_${t}`, a = jc({
11060
+ let i = `sub_${t}`, a = Bc({
10703
11061
  paneId: i,
10704
11062
  title: t,
10705
- getTitleInfo: () => ve(i)
11063
+ getTitleInfo: () => ye(i)
10706
11064
  });
10707
11065
  C.value?.useRenderer(a);
10708
11066
  let o = z.value.findIndex((t) => t.id === e);
@@ -10714,7 +11072,7 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
10714
11072
  params: fe(t)
10715
11073
  }), R.value = R.value.filter((e) => e !== r), R.value.includes(t) || R.value.push(t);
10716
11074
  }
10717
- function ve(e) {
11075
+ function ye(e) {
10718
11076
  let t = z.value.find((t) => t.id === e);
10719
11077
  if (!t) return null;
10720
11078
  let n = C.value?.getData();
@@ -10728,72 +11086,56 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
10728
11086
  let i = N.value;
10729
11087
  if (i === null) return null;
10730
11088
  switch (t.indicatorId) {
10731
- case "MACD": return Fs(n, i, r.fastPeriod ?? 12, r.slowPeriod ?? 26, r.signalPeriod ?? 9);
10732
- case "RSI": return Rs(n, i, r.period1 ?? 6, r.period2 ?? 12, r.period3 ?? 24);
10733
- case "CCI": return Hs(n, i, r.period ?? 14);
10734
- case "STOCH": return Ks(n, i, r.n ?? 9, r.m ?? 3);
10735
- case "MOM": return Xs(n, i, r.period ?? 10);
10736
- case "WMSR": return ec(n, i, r.period ?? 14);
10737
- case "KST": return oc(n, i, r.roc1 ?? 10, r.roc2 ?? 15, r.roc3 ?? 20, r.roc4 ?? 30, r.signalPeriod ?? 9);
10738
- case "FASTK": return uc(n, i, r.period ?? 9);
11089
+ case "MACD": return Vs(n, i, r.fastPeriod ?? 12, r.slowPeriod ?? 26, r.signalPeriod ?? 9);
11090
+ case "RSI": return Ws(n, i, r.period1 ?? 6, r.period2 ?? 12, r.period3 ?? 24);
11091
+ case "CCI": return Js(n, i, r.period ?? 14);
11092
+ case "STOCH": return Qs(n, i, r.n ?? 9, r.m ?? 3);
11093
+ case "MOM": return nc(n, i, r.period ?? 10);
11094
+ case "WMSR": return oc(n, i, r.period ?? 14);
11095
+ case "KST": return fc(n, i, r.roc1 ?? 10, r.roc2 ?? 15, r.roc3 ?? 20, r.roc4 ?? 30, r.signalPeriod ?? 9);
11096
+ case "FASTK": return gc(n, i, r.period ?? 9);
10739
11097
  default: return null;
10740
11098
  }
10741
11099
  }
10742
- function ye(e, t) {
10743
- if (e === "MA") {
10744
- t ? (R.value.includes(e) || R.value.push(e), C.value?.updateRendererConfig("ma", {
10745
- ma5: !0,
10746
- ma10: !0,
10747
- ma20: !0,
10748
- ma30: !0,
10749
- ma60: !0
10750
- }), C.value?.setRendererEnabled("maLegend", !0)) : (R.value = R.value.filter((t) => t !== e), C.value?.updateRendererConfig("ma", {
10751
- ma5: !1,
10752
- ma10: !1,
10753
- ma20: !1,
10754
- ma30: !1,
10755
- ma60: !1
10756
- }), C.value?.setRendererEnabled("maLegend", !1)), E();
10757
- return;
10758
- }
10759
- if (e === "BOLL") {
10760
- t ? R.value.includes(e) || R.value.push(e) : R.value = R.value.filter((t) => t !== e), C.value?.setRendererEnabled("boll", t), C.value?.setRendererEnabled("bollLegend", t), E();
11100
+ function be(e, t) {
11101
+ if (e === "MA" || e === "BOLL" || e === "EXPMA" || e === "ENE") {
11102
+ t ? R.value.includes(e) || R.value.push(e) : R.value = R.value.filter((t) => t !== e);
10761
11103
  return;
10762
11104
  }
10763
11105
  if (B.includes(e)) {
10764
11106
  if (t) {
10765
- if (z.value.find((t) => t.indicatorId === e)) return;
11107
+ if (R.value.includes(e) || R.value.push(e), z.value.find((t) => t.indicatorId === e)) return;
10766
11108
  if (!pe(e)) {
10767
11109
  let t = z.value[z.value.length - 1];
10768
- t && _e(t.id, e);
11110
+ t && ve(t.id, e);
10769
11111
  }
10770
- } else z.value.filter((t) => t.indicatorId === e).forEach((e) => me(e.id));
11112
+ } else R.value = R.value.filter((t) => t !== e), z.value.filter((t) => t.indicatorId === e).forEach((e) => me(e.id));
10771
11113
  E();
10772
11114
  }
10773
11115
  }
10774
- function be(e, t) {
10775
- if (de.value[e] = t, e === "BOLL") {
10776
- C.value?.updateRendererConfig("boll", t), C.value?.updateRendererConfig("bollLegend", t), E();
11116
+ function xe(e, t) {
11117
+ if (de.value[e] = t, e === "MA" || e === "BOLL" || e === "EXPMA" || e === "ENE") {
11118
+ e === "BOLL" && C.value?.updateRendererConfig("boll", t), e === "EXPMA" && C.value?.updateRendererConfig("expma", t), e === "ENE" && C.value?.updateRendererConfig("ene", t), E();
10777
11119
  return;
10778
11120
  }
10779
11121
  B.includes(e) && z.value.filter((t) => t.indicatorId === e).forEach((e) => {
10780
11122
  e.params = { ...t }, C.value?.updateRendererConfig(e.rendererName, t);
10781
11123
  }), E();
10782
11124
  }
10783
- let xe = r(() => {
10784
- let e = T.value, t = window.devicePixelRatio || 1, { startXPx: r, unitPx: i } = ss(b.value, x.value, t);
11125
+ let Se = r(() => {
11126
+ let e = T.value, t = window.devicePixelRatio || 1, { startXPx: r, unitPx: i } = ls(b.value, x.value, t);
10785
11127
  return (r + e * i) / t + (n.rightAxisWidth + n.priceLabelWidth);
10786
11128
  });
10787
- function Se() {
11129
+ function Ce() {
10788
11130
  let e = v.value;
10789
11131
  e && (e.scrollLeft = e.scrollWidth, E());
10790
11132
  }
10791
11133
  return t({
10792
11134
  scheduleRender: E,
10793
- scrollToRight: Se,
11135
+ scrollToRight: Ce,
10794
11136
  addSubPane: pe,
10795
11137
  removeSubPane: me,
10796
- switchSubIndicator: _e,
11138
+ switchSubIndicator: ve,
10797
11139
  clearAllSubPanes: he,
10798
11140
  get plugin() {
10799
11141
  return C.value?.plugin;
@@ -10805,7 +11147,7 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
10805
11147
  C.value?.interaction.onWheel(e), I();
10806
11148
  };
10807
11149
  e.addEventListener("wheel", i, { passive: !1 });
10808
- let a = new fc({
11150
+ let a = new vc({
10809
11151
  container: e,
10810
11152
  canvasLayer: t,
10811
11153
  xAxisCanvas: r
@@ -10830,32 +11172,31 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
10830
11172
  if (!r) return;
10831
11173
  let i = Math.max(0, r.scrollWidth - r.clientWidth);
10832
11174
  r.scrollLeft = Math.min(Math.max(0, n), i), a.applyZoom(e, t);
10833
- }), a.useRenderer(bc()), a.useRenderer(Sc()), a.useRenderer(Cs({
11175
+ }), a.useRenderer(Ec()), a.useRenderer(Oc()), a.useRenderer(ws({
10834
11176
  ma5: !0,
10835
11177
  ma10: !0,
10836
11178
  ma20: !0,
10837
11179
  ma30: !0,
10838
11180
  ma60: !0
10839
- })), a.useRenderer(Ds()), a.setRendererEnabled("boll", !1), a.useRenderer(_c()), a.useRenderer(xc()), a.useRenderer(va()), a.useRenderer(Dc({
10840
- axisWidth: n.rightAxisWidth,
10841
- yPaddingPx: n.yPaddingPx
10842
- })), a.useRenderer(Ts({
11181
+ })), a.useRenderer(Es()), a.setRendererEnabled("boll", !1), a.useRenderer(As()), a.setRendererEnabled("expma", !1), a.useRenderer(Ns()), a.setRendererEnabled("ene", !1), a.useRenderer(Cc()), a.useRenderer(Dc()), a.useRenderer(va()), a.useRenderer(Ic({
11182
+ axisWidth: n.rightAxisWidth + n.priceLabelWidth,
10843
11183
  yPaddingPx: n.yPaddingPx,
10844
- showMA: {
10845
- ma5: !0,
10846
- ma10: !0,
10847
- ma20: !0,
10848
- ma30: !0,
10849
- ma60: !0
11184
+ getCrosshair: () => {
11185
+ let e = a.interaction.crosshairPos, t = a.interaction.crosshairPrice;
11186
+ return e && t !== null ? {
11187
+ y: e.y,
11188
+ price: t
11189
+ } : null;
10850
11190
  }
10851
- })), a.useRenderer(ks({ yPaddingPx: n.yPaddingPx })), a.setRendererEnabled("bollLegend", !1), a.useRenderer(Ac({ getCrosshairState: () => ({
11191
+ })), a.useRenderer(Fs({ yPaddingPx: n.yPaddingPx })), a.useRenderer(zc({ getCrosshairState: () => ({
10852
11192
  pos: a.interaction.crosshairPos,
10853
11193
  activePaneId: a.interaction.activePaneId,
10854
- isDragging: a.interaction.isDraggingState()
10855
- }) })), a.useRenderer(kc({
11194
+ isDragging: a.interaction.isDraggingState(),
11195
+ price: a.interaction.crosshairPrice
11196
+ }) })), a.useRenderer(Rc({
10856
11197
  height: n.bottomAxisHeight,
10857
11198
  getCrosshair: () => {
10858
- let e = a.interaction.crosshairPos, t = a.interaction.hoveredIndex;
11199
+ let e = a.interaction.crosshairPos, t = a.interaction.crosshairIndex;
10859
11200
  return e && t !== null ? {
10860
11201
  x: e.x,
10861
11202
  index: t
@@ -10864,7 +11205,7 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
10864
11205
  })), C.value = a, a.resize(), w.value = new Ui(a), w.value.on("config:error", (e) => {
10865
11206
  console.error("Semantic config error:", e);
10866
11207
  }), w.value.on("config:ready", () => {
10867
- T.value = a.getData()?.length ?? 0, ie(), ge(), d(() => Se());
11208
+ T.value = a.getData()?.length ?? 0, ie(), ge(), _e(), d(() => Ce());
10868
11209
  }), w.value.applyConfig(n.semanticConfig).then((e) => {
10869
11210
  e && !e.success && console.error("Semantic config apply failed:", e.errors);
10870
11211
  }), a.interaction.setOnMarkerHover((e) => {
@@ -10899,7 +11240,7 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
10899
11240
  let t = await w.value?.applyConfig(e);
10900
11241
  t && !t.success && console.error("Semantic config apply failed:", t.errors);
10901
11242
  }
10902
- }, { deep: !0 }), (e, t) => (g(), o("div", Mc, [s("div", {
11243
+ }, { deep: !0 }), (e, t) => (g(), o("div", Vc, [s("div", {
10903
11244
  class: f(["chart-container", { "is-dragging": j.value }]),
10904
11245
  ref_key: "containerRef",
10905
11246
  ref: v,
@@ -10910,7 +11251,7 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
10910
11251
  onPointerleave: le
10911
11252
  }, [s("div", {
10912
11253
  class: "scroll-content",
10913
- style: p({ width: xe.value + "px" })
11254
+ style: p({ width: Se.value + "px" })
10914
11255
  }, [s("div", {
10915
11256
  class: "canvas-layer",
10916
11257
  ref_key: "canvasLayerRef",
@@ -10925,10 +11266,10 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
10925
11266
  class: "x-axis-corner right-axis-corner",
10926
11267
  style: p({
10927
11268
  height: n.bottomAxisHeight + "px",
10928
- width: n.rightAxisWidth + n.priceLabelWidth + "px"
11269
+ width: n.rightAxisWidth + n.priceLabelWidth - 1 + "px"
10929
11270
  })
10930
11271
  }, null, 4),
10931
- P.value ? (g(), i(mo, {
11272
+ P.value ? (g(), i(go, {
10932
11273
  key: 0,
10933
11274
  k: P.value,
10934
11275
  index: F.value,
@@ -10941,20 +11282,20 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
10941
11282
  "data",
10942
11283
  "pos"
10943
11284
  ])) : a("", !0),
10944
- O.value || k.value ? (g(), i(yo, {
11285
+ O.value || k.value ? (g(), i(xo, {
10945
11286
  key: 1,
10946
11287
  marker: O.value || k.value,
10947
11288
  pos: A.value
10948
11289
  }, null, 8, ["marker", "pos"])) : a("", !0)
10949
- ], 512)], 4)], 34), l(as, {
11290
+ ], 512)], 4)], 34), l(ss, {
10950
11291
  "active-indicators": R.value,
10951
11292
  "indicator-params": de.value,
10952
- onToggle: ye,
10953
- onUpdateParams: be
11293
+ onToggle: be,
11294
+ onUpdateParams: xe
10954
11295
  }, null, 8, ["active-indicators", "indicator-params"])]));
10955
11296
  }
10956
- }), [["__scopeId", "data-v-cb99e513"]]), Fc = { install(e) {
10957
- e.component("KLineChart", Pc);
11297
+ }), [["__scopeId", "data-v-4083a7b9"]]), Wc = { install(e) {
11298
+ e.component("KLineChart", Uc);
10958
11299
  } };
10959
11300
  //#endregion
10960
- export { la as ConfigManager, F as EventBus, oa as GLOBAL_PANE_ID, ca as HookSystem, Pc as KLineChart, Fc as KMapPlugin, ua as PluginHostImpl, sa as PluginRegistry, ia as PluginState, Y as RENDERER_PRIORITY, pa as RendererPluginManager, da as createPluginHost, aa as wrapPaneInfo };
11301
+ export { la as ConfigManager, F as EventBus, oa as GLOBAL_PANE_ID, ca as HookSystem, Uc as KLineChart, Wc as KMapPlugin, ua as PluginHostImpl, sa as PluginRegistry, ia as PluginState, Y as RENDERER_PRIORITY, pa as RendererPluginManager, da as createPluginHost, aa as wrapPaneInfo };