lightweight-charts-indicators 0.15.2 → 0.15.4

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.cjs CHANGED
@@ -1528,6 +1528,7 @@ __export(src_exports, {
1528
1528
  UptrickVolatilityReversionBands: () => UptrickVolatilityReversionBands,
1529
1529
  UserDefinedRangeSelector: () => UserDefinedRangeSelector,
1530
1530
  UtBotTrendVolume: () => UtBotTrendVolume,
1531
+ VALUE_FORMATS: () => VALUE_FORMATS,
1531
1532
  VPCI: () => VPCI,
1532
1533
  VWAP: () => VWAP,
1533
1534
  VWMA: () => VWMA,
@@ -48527,6 +48528,68 @@ function withReferenceNames(entry) {
48527
48528
  return { ...entry, name: title, shortName: shortTitle, metadata: { ...entry.metadata, title, shortTitle } };
48528
48529
  }
48529
48530
 
48531
+ // src/value-formats.ts
48532
+ var VALUE_FORMATS = {
48533
+ "24-hour-volume": { type: "volume" },
48534
+ "accumulation-distribution": { type: "volume" },
48535
+ "adr-bars": { type: "price", precision: 2 },
48536
+ "adx": { type: "price", precision: 2 },
48537
+ "aroon": { type: "percent", precision: 2 },
48538
+ "auto-key-levels": { type: "volume" },
48539
+ "bb-bandwidth": { type: "price", precision: 2 },
48540
+ "bb-percent-b": { type: "price", precision: 2 },
48541
+ "bop": { type: "price", precision: 2 },
48542
+ "cci": { type: "price", precision: 2 },
48543
+ "chaikin-mf": { type: "price", precision: 2 },
48544
+ "chaikin-osc": { type: "volume" },
48545
+ "chande-mo": { type: "price", precision: 2 },
48546
+ "chop-zone": { type: "price", precision: 0 },
48547
+ "choppiness": { type: "price", precision: 2 },
48548
+ "connors-rsi": { type: "price", precision: 2 },
48549
+ "correlation-coefficient": { type: "price", precision: 2 },
48550
+ "cvd": { type: "volume" },
48551
+ "dmi": { type: "price", precision: 4 },
48552
+ "dpo": { type: "price", precision: 2 },
48553
+ "elder-force": { type: "volume" },
48554
+ "eom": { type: "volume" },
48555
+ "fisher-transform": { type: "price", precision: 2 },
48556
+ "hist-volatility": { type: "price", precision: 2 },
48557
+ "klinger": { type: "volume" },
48558
+ "kst": { type: "price", precision: 4 },
48559
+ "mass-index": { type: "price", precision: 2 },
48560
+ "mfi": { type: "price", precision: 2 },
48561
+ "net-volume": { type: "volume" },
48562
+ "obv": { type: "volume" },
48563
+ "price-oscillator": { type: "percent", precision: 2 },
48564
+ "pvt": { type: "volume" },
48565
+ "rci": { type: "price", precision: 2 },
48566
+ "rci-ribbon": { type: "price", precision: 2 },
48567
+ "roc": { type: "price", precision: 2 },
48568
+ "rsi": { type: "price", precision: 2 },
48569
+ "rsi-divergence-indicator": { type: "price" },
48570
+ "rvi": { type: "price", precision: 4 },
48571
+ "rvol": { type: "price", precision: 2 },
48572
+ "smi-ergodic": { type: "price", precision: 4 },
48573
+ "smi-ergodic-osc": { type: "price", precision: 4 },
48574
+ "stoch": { type: "price", precision: 2 },
48575
+ "stoch-rsi": { type: "price", precision: 2 },
48576
+ "technicals": { type: "price", precision: 2 },
48577
+ "trend-strength": { type: "price", precision: 2 },
48578
+ "trix": { type: "price", precision: 2 },
48579
+ "tsi": { type: "price", precision: 4 },
48580
+ "ultimate-osc": { type: "price", precision: 2 },
48581
+ "up-down-volume": { type: "volume" },
48582
+ "volume-delta": { type: "volume" },
48583
+ "volume-osc": { type: "percent", precision: 2 },
48584
+ "vortex": { type: "price", precision: 4 },
48585
+ "williams-fractals": { type: "price", precision: 0 },
48586
+ "williams-r": { type: "price", precision: 2 }
48587
+ };
48588
+ function withValueFormat(entry) {
48589
+ const f = VALUE_FORMATS[entry.id];
48590
+ return f && !entry.format ? { ...entry, format: f } : entry;
48591
+ }
48592
+
48530
48593
  // src/standard/aroon-oscillator.ts
48531
48594
  var defaultInputs403 = {
48532
48595
  length: 14
@@ -50523,7 +50586,7 @@ function calculate420(bars, inputs = {}, chart) {
50523
50586
  otherSymbolChart(bars, chart),
50524
50587
  { other: chart?.symbolInfo?.(symbol) }
50525
50588
  );
50526
- const correlation = import_oakscriptjs385.ta.correlation(import_oakscriptjs385.Series.fromArray(bars, sourceOf2(bars, source)), import_oakscriptjs385.Series.fromArray(bars, requested), length).toArray();
50589
+ const correlation = import_oakscriptjs385.ta.correlation(import_oakscriptjs385.Series.fromArray(bars, (0, import_oakscriptjs385.getSource)(bars, source)), import_oakscriptjs385.Series.fromArray(bars, requested), length).toArray();
50527
50590
  return {
50528
50591
  metadata: { title: metadata420.title, shorttitle: metadata420.shortTitle, overlay: metadata420.overlay },
50529
50592
  plots: {
@@ -50794,28 +50857,6 @@ var metadata423 = {
50794
50857
  };
50795
50858
  var gt21 = (a, b) => a - b > 1e-10;
50796
50859
  var eq4 = (a, b) => Math.abs(a - b) <= 1e-10;
50797
- function sourceOf3(bar, src) {
50798
- switch (src) {
50799
- case "open":
50800
- return bar.open;
50801
- case "high":
50802
- return bar.high;
50803
- case "low":
50804
- return bar.low;
50805
- case "hl2":
50806
- return (bar.high + bar.low) / 2;
50807
- case "hlc3":
50808
- return (bar.high + bar.low + bar.close) / 3;
50809
- case "hlcc4":
50810
- return (bar.high + bar.low + bar.close + bar.close) / 4;
50811
- case "ohlc4":
50812
- return (bar.open + bar.high + bar.low + bar.close) / 4;
50813
- case "volume":
50814
- return bar.volume ?? NaN;
50815
- default:
50816
- return bar.close;
50817
- }
50818
- }
50819
50860
  function calculate423(bars, inputs = {}) {
50820
50861
  const cfg = { ...defaultInputs423, ...inputs };
50821
50862
  const result = {
@@ -50830,7 +50871,8 @@ function calculate423(bars, inputs = {}) {
50830
50871
  const last = n - 1;
50831
50872
  if (n === 0 || length <= 1)
50832
50873
  return result;
50833
- const src = (i) => last - i >= 0 ? sourceOf3(bars[last - i], cfg.source) : NaN;
50874
+ const srcValues = (0, import_oakscriptjs388.getSource)(bars, cfg.source);
50875
+ const src = (i) => last - i >= 0 ? srcValues[last - i] : NaN;
50834
50876
  const high16 = (i) => last - i >= 0 ? bars[last - i].high : NaN;
50835
50877
  const low17 = (i) => last - i >= 0 ? bars[last - i].low : NaN;
50836
50878
  let sumX = 0;
@@ -53008,39 +53050,18 @@ var metadata435 = {
53008
53050
  };
53009
53051
  var usesVisibleRange = true;
53010
53052
  var PLOT_OFFSET = -1e5;
53011
- function sourceOf4(b, source) {
53012
- switch (source) {
53013
- case "open":
53014
- return b.open;
53015
- case "high":
53016
- return b.high;
53017
- case "low":
53018
- return b.low;
53019
- case "hl2":
53020
- return (b.high + b.low) / 2;
53021
- case "hlc3":
53022
- return (b.high + b.low + b.close) / 3;
53023
- case "ohlc4":
53024
- return (b.open + b.high + b.low + b.close) / 4;
53025
- case "hlcc4":
53026
- return (b.high + b.low + b.close + b.close) / 4;
53027
- case "volume":
53028
- return b.volume ?? NaN;
53029
- default:
53030
- return b.close;
53031
- }
53032
- }
53033
53053
  function calculate435(bars, inputs = {}, chart) {
53034
53054
  const { src } = { ...defaultInputs435, ...inputs };
53035
53055
  const n = bars.length;
53036
53056
  const toMs = chart?.timeUnit === "ms" ? 1 : 1e3;
53037
53057
  const { leftTime, rightTime } = visibleRangeOf(bars, chart);
53038
53058
  const srcVals = import_oakscriptjs400.array.new_float();
53039
- for (const b of bars) {
53059
+ const values = (0, import_oakscriptjs400.getSource)(bars, src);
53060
+ bars.forEach((b, i) => {
53040
53061
  const t = b.time * toMs;
53041
53062
  if (t >= leftTime && t <= rightTime)
53042
- import_oakscriptjs400.array.unshift(srcVals, sourceOf4(b, src));
53043
- }
53063
+ import_oakscriptjs400.array.unshift(srcVals, values[i]);
53064
+ });
53044
53065
  const last = n > 0 ? import_oakscriptjs400.array.avg(srcVals) : NaN;
53045
53066
  const shownBar = n - 1 + PLOT_OFFSET;
53046
53067
  const plot0 = bars.map((b, j) => ({ time: b.time, value: j === shownBar ? last : NaN }));
@@ -136578,7 +136599,7 @@ function calculate1057(bars, inputs = {}) {
136578
136599
  }
136579
136600
  }
136580
136601
  };
136581
- const sourceOf11 = (name) => bars.map((b) => {
136602
+ const sourceOf9 = (name) => bars.map((b) => {
136582
136603
  switch (name) {
136583
136604
  case "High":
136584
136605
  return b.high;
@@ -136635,7 +136656,7 @@ function calculate1057(bars, inputs = {}) {
136635
136656
  NN.forEach((nn, k) => {
136636
136657
  const s = section(cfg, nn);
136637
136658
  const [c3, sc] = SECTION_RGB[k];
136638
- const src = sourceOf11(s.source);
136659
+ const src = sourceOf9(s.source);
136639
136660
  const m = ma2(src, s.length, s.type);
136640
136661
  refma.push(m);
136641
136662
  refmaHigh.push(selects[k] ? ma2(high16, s.length, s.type) : zeros);
@@ -183087,8 +183108,8 @@ function calculate1333(bars, inputs = {}, chart) {
183087
183108
  const txtSize = cfg.textSize === "Tiny" ? "tiny" : cfg.textSize === "Normal" ? "normal" : "small";
183088
183109
  const signalSize = cfg.signalSizeInput === "Tiny" ? "tiny" : cfg.signalSizeInput === "Normal" ? "normal" : cfg.signalSizeInput === "Large" ? "large" : cfg.signalSizeInput === "Huge" ? "huge" : "small";
183089
183110
  const sideCost = (fillPrice) => Math.abs(fillPrice) * cfg.commissionPct / 100 + (cfg.spreadTicks * 0.5 + cfg.slipTicks) * MINTICK;
183090
- const sourceOf11 = (b) => cfg.sourceChoice === "HL2" ? (b.high + b.low) / 2 : cfg.sourceChoice === "HLC3" ? (b.high + b.low + b.close) / 3 : cfg.sourceChoice === "OHLC4" ? (b.open + b.high + b.low + b.close) / 4 : b.close;
183091
- const source = S2(bars.map(sourceOf11));
183111
+ const sourceOf9 = (b) => cfg.sourceChoice === "HL2" ? (b.high + b.low) / 2 : cfg.sourceChoice === "HLC3" ? (b.high + b.low + b.close) / 3 : cfg.sourceChoice === "OHLC4" ? (b.open + b.high + b.low + b.close) / 4 : b.close;
183112
+ const source = S2(bars.map(sourceOf9));
183092
183113
  const emaFast = A7(import_oakscriptjs1289.ta.ema(source, fastLen));
183093
183114
  const emaSlow = A7(import_oakscriptjs1289.ta.ema(source, slowLen));
183094
183115
  const emaTrend = A7(import_oakscriptjs1289.ta.ema(source, trendLen));
@@ -183154,7 +183175,7 @@ function calculate1333(bars, inputs = {}, chart) {
183154
183175
  group2.forEach((g, i) => {
183155
183176
  lastOf[g] = i;
183156
183177
  });
183157
- const htfSource = import_oakscriptjs1289.Series.fromArray(htf, htf.map(sourceOf11));
183178
+ const htfSource = import_oakscriptjs1289.Series.fromArray(htf, htf.map(sourceOf9));
183158
183179
  const fast = A7(import_oakscriptjs1289.ta.ema(htfSource, fastLen));
183159
183180
  const slow = A7(import_oakscriptjs1289.ta.ema(htfSource, slowLen));
183160
183181
  for (let i = 0; i < n; i++) {
@@ -255352,7 +255373,7 @@ var EPS899 = 1e-10;
255352
255373
  var gt896 = (a, b) => a - b > EPS899;
255353
255374
  var lt707 = (a, b) => b - a > EPS899;
255354
255375
  var eq200 = (a, b) => !isNaN(a) && !isNaN(b) && !(Math.abs(a - b) > EPS899);
255355
- function sourceOf5(bars, name) {
255376
+ function sourceOf3(bars, name) {
255356
255377
  return bars.map((b) => {
255357
255378
  switch (name) {
255358
255379
  case "open":
@@ -255532,7 +255553,7 @@ function calculate1543(bars, inputs = {}, chart) {
255532
255553
  htf = sec.htf;
255533
255554
  toChart = (values) => (0, import_oakscriptjs1498.mapToChart)(values, sec.group, sec.latest, false, false);
255534
255555
  }
255535
- const maMtf = toChart(movingAverage4(cfg.maType, sourceOf5(htf, cfg.source), htf, cfg.len));
255556
+ const maMtf = toChart(movingAverage4(cfg.maType, sourceOf3(htf, cfg.source), htf, cfg.len));
255536
255557
  const closeH = toChart(htf.map((b) => b.close));
255537
255558
  const lowH = toChart(htf.map((b) => b.low));
255538
255559
  const highH = toChart(htf.map((b) => b.high));
@@ -261420,7 +261441,7 @@ var RED123 = "#FF5252";
261420
261441
  var BLACK38 = "#363A45";
261421
261442
  var WHITE44 = "#FFFFFF";
261422
261443
  var gt912 = (a, b) => a - b > 1e-10;
261423
- function sourceOf6(b, s) {
261444
+ function sourceOf4(b, s) {
261424
261445
  switch (s) {
261425
261446
  case "open":
261426
261447
  return b.open;
@@ -261458,13 +261479,13 @@ function calculate1562(bars, inputs = {}, chart) {
261458
261479
  const length = cfg.length;
261459
261480
  const A7 = (s) => s.toArray().map((v) => v ?? NaN);
261460
261481
  const { htf, latest } = timeframeBars34(bars, cfg.resolution, chart);
261461
- const htfSrc = import_oakscriptjs1517.Series.fromArray(htf, htf.map((b2) => sourceOf6(b2, cfg.source)));
261482
+ const htfSrc = import_oakscriptjs1517.Series.fromArray(htf, htf.map((b2) => sourceOf4(b2, cfg.source)));
261462
261483
  const lr0 = A7(import_oakscriptjs1517.ta.linreg(htfSrc, length, cfg.offset));
261463
261484
  const lr1 = A7(import_oakscriptjs1517.ta.linreg(htfSrc, length, cfg.offset + 1));
261464
261485
  const onChart = (v) => import_oakscriptjs1517.Series.fromArray(bars, latest.map((g) => g >= 0 ? v[g] : NaN));
261465
261486
  const linreg2 = A7(import_oakscriptjs1517.ta.sma(onChart(lr0), cfg.smoothing));
261466
261487
  const linregP = A7(import_oakscriptjs1517.ta.sma(onChart(lr1), cfg.smoothing));
261467
- const src = bars.map((b2) => sourceOf6(b2, cfg.source));
261488
+ const src = bars.map((b2) => sourceOf4(b2, cfg.source));
261468
261489
  const interval = (0, import_oakscriptjs12.barInterval)(bars);
261469
261490
  const T20 = (index) => (0, import_oakscriptjs12.barTime)(bars, index, interval);
261470
261491
  (0, import_oakscriptjs1517.resetDrawings)({ line: 50 });
@@ -267377,7 +267398,7 @@ var metadata1578 = {
267377
267398
  var EPS929 = 1e-10;
267378
267399
  var gt925 = (a, b) => a - b > EPS929;
267379
267400
  var lt730 = (a, b) => b - a > EPS929;
267380
- function sourceOf7(b, src) {
267401
+ function sourceOf5(b, src) {
267381
267402
  switch (src) {
267382
267403
  case "open":
267383
267404
  return b.open;
@@ -267403,7 +267424,7 @@ function calculate1578(bars, inputs = {}) {
267403
267424
  const prd = Math.trunc(cfg.prd);
267404
267425
  const ppNum = Math.trunc(cfg.ppNum);
267405
267426
  const A7 = (s) => s.toArray().map((v) => v ?? NaN);
267406
- const srcSeries = new import_oakscriptjs1533.Series(bars, (b) => sourceOf7(b, cfg.src));
267427
+ const srcSeries = new import_oakscriptjs1533.Series(bars, (b) => sourceOf5(b, cfg.src));
267407
267428
  const osc = cfg.indi === "RSI" ? A7(import_oakscriptjs1533.ta.rsi(srcSeries, cfg.rsiLen)) : cfg.indi === "CCI" ? A7(import_oakscriptjs1533.ta.cci(srcSeries, cfg.cciLen)) : cfg.indi === "Momentum" ? A7(import_oakscriptjs1533.ta.cci(srcSeries, cfg.momLen)) : A7(import_oakscriptjs1533.ta.obv(bars));
267408
267429
  const oscSeries = import_oakscriptjs1533.Series.fromArray(bars, osc);
267409
267430
  const ph = A7(import_oakscriptjs1533.ta.pivothigh(oscSeries, prd, prd));
@@ -273361,7 +273382,7 @@ function habClose(sub, cfg) {
273361
273382
  }
273362
273383
  return res;
273363
273384
  }
273364
- function sourceOf8(bars, cfg) {
273385
+ function sourceOf6(bars, cfg) {
273365
273386
  const opt = cfg.srcoption;
273366
273387
  if (opt.startsWith("HAB ")) {
273367
273388
  const hc = habClose(bars, cfg);
@@ -273435,7 +273456,7 @@ function sourceOf8(bars, cfg) {
273435
273456
  function calculate1594(bars, inputs = {}) {
273436
273457
  const cfg = { ...defaultInputs1594, ...inputs };
273437
273458
  const n = bars.length;
273438
- let src = sourceOf8(bars, cfg);
273459
+ let src = sourceOf6(bars, cfg);
273439
273460
  if (cfg.filterop === "Both" || cfg.filterop === "Price" && gt937(cfg.filter, 0)) {
273440
273461
  src = stdFilter(bars, src, cfg.filterperiod, cfg.filter);
273441
273462
  }
@@ -290095,7 +290116,7 @@ function calculate1639(bars, inputs = {}) {
290095
290116
  const A7 = (s) => s.toArray().map((v) => v === null || v === void 0 ? NaN : v);
290096
290117
  const S2 = (a) => import_oakscriptjs1594.Series.fromArray(bars, a);
290097
290118
  const field = (f) => bars.map(f);
290098
- const sourceOf11 = (s) => {
290119
+ const sourceOf9 = (s) => {
290099
290120
  switch (s) {
290100
290121
  case "open":
290101
290122
  return field((b) => b.open);
@@ -290124,7 +290145,7 @@ function calculate1639(bars, inputs = {}) {
290124
290145
  const closeS = S2(close11);
290125
290146
  const scale = cfg.scale;
290126
290147
  const lengthM = Math.trunc(cfg.lengthM);
290127
- const srcM = sourceOf11(cfg.srcM);
290148
+ const srcM = sourceOf9(cfg.srcM);
290128
290149
  const hh = A7(import_oakscriptjs1594.ta.highest(highS, lengthM));
290129
290150
  const ll = A7(import_oakscriptjs1594.ta.lowest(lowS, lengthM));
290130
290151
  const smaM = A7(import_oakscriptjs1594.ta.sma(closeS, lengthM));
@@ -290194,7 +290215,7 @@ function calculate1639(bars, inputs = {}) {
290194
290215
  const low58 = A7(import_oakscriptjs1594.ta.lowest(lowS, 58));
290195
290216
  const var7 = low58.map((v) => !Number.isNaN(v) && v !== 0 ? 1 : 0);
290196
290217
  const var8 = A7(import_oakscriptjs1594.ta.ema(S2(low17.map((v, i) => le303(v, var5[i]) ? (var4[i] + var6[i] * 2) / 2 : 0)), 3)).map((v, i) => v / 618 * var7[i]);
290197
- const src = sourceOf11(cfg.src);
290218
+ const src = sourceOf9(cfg.src);
290198
290219
  const srcS = S2(src);
290199
290220
  const rsi = A7(import_oakscriptjs1594.ta.rsi(srcS, Math.trunc(cfg.len)));
290200
290221
  const rsiScale = rsi.map((v, i) => sc(v + cfg.rsiApart, i));
@@ -290209,7 +290230,7 @@ function calculate1639(bars, inputs = {}) {
290209
290230
  const divergence = rsiFast.map((v, i) => v - rsiSlow[i]);
290210
290231
  const kSto = A7(import_oakscriptjs1594.ta.sma(import_oakscriptjs1594.ta.stoch(closeS, highS, lowS, Math.trunc(cfg.periodK)), Math.trunc(cfg.smoothK)));
290211
290232
  const dSto = A7(import_oakscriptjs1594.ta.sma(S2(kSto), Math.trunc(cfg.periodD)));
290212
- const hl2S = S2(sourceOf11("hl2"));
290233
+ const hl2S = S2(sourceOf9("hl2"));
290213
290234
  const aoSlow = A7(import_oakscriptjs1594.ta.sma(hl2S, Math.trunc(cfg.slowLength)));
290214
290235
  const ao = A7(import_oakscriptjs1594.ta.sma(hl2S, Math.trunc(cfg.fastLength))).map((v, i) => v - aoSlow[i]);
290215
290236
  const histColor = (h, i) => {
@@ -290228,7 +290249,7 @@ function calculate1639(bars, inputs = {}) {
290228
290249
  const macd = macd1.map((v) => v * cfg.macdScale);
290229
290250
  const sign = signal.map((v) => v * cfg.macdScale);
290230
290251
  const m = Math.trunc(cfg.m);
290231
- const tprice = sourceOf11(cfg.srcTprice);
290252
+ const tprice = sourceOf9(cfg.srcTprice);
290232
290253
  const tpriceS = S2(tprice);
290233
290254
  const pvi = A7(import_oakscriptjs1594.ta.pvi(bars));
290234
290255
  const pvim = A7(import_oakscriptjs1594.ta.ema(S2(pvi), m));
@@ -290240,7 +290261,7 @@ function calculate1639(bars, inputs = {}) {
290240
290261
  const nvimax = A7(import_oakscriptjs1594.ta.highest(S2(nvim), Math.trunc(cfg.longitudNVI)));
290241
290262
  const nvimin = A7(import_oakscriptjs1594.ta.lowest(S2(nvim), Math.trunc(cfg.longitudNVI)));
290242
290263
  const azul = nvi.map((v, i) => (v - nvim[i]) * 100 / (nvimax[i] - nvimin[i]));
290243
- const xmf = A7(import_oakscriptjs1594.ta.mfi(S2(sourceOf11(cfg.srcMfi)), Math.trunc(cfg.longitudMFI), S2(field((b) => b.volume ?? NaN))));
290264
+ const xmf = A7(import_oakscriptjs1594.ta.mfi(S2(sourceOf9(cfg.srcMfi)), Math.trunc(cfg.longitudMFI), S2(field((b) => b.volume ?? NaN))));
290244
290265
  const boLength = Math.trunc(cfg.boLength);
290245
290266
  const basisK = A7(import_oakscriptjs1594.ta.sma(tpriceS, boLength));
290246
290267
  const devK = A7(import_oakscriptjs1594.ta.stdev(tpriceS, boLength)).map((v) => cfg.mult * v);
@@ -290258,12 +290279,12 @@ function calculate1639(bars, inputs = {}) {
290258
290279
  const media = A7(import_oakscriptjs1594.ta.ema(S2(marron), m));
290259
290280
  const konBull = A7(import_oakscriptjs1594.ta.crossover(S2(marron), S2(media)));
290260
290281
  const konBear = A7(import_oakscriptjs1594.ta.crossunder(S2(marron), S2(media)));
290261
- const cci = A7(import_oakscriptjs1594.ta.cci(S2(sourceOf11(cfg.cciSrc)), Math.trunc(cfg.cciLen)));
290282
+ const cci = A7(import_oakscriptjs1594.ta.cci(S2(sourceOf9(cfg.cciSrc)), Math.trunc(cfg.cciLen)));
290262
290283
  const rsiMFI = A7(import_oakscriptjs1594.ta.sma(
290263
290284
  S2(bars.map((b) => (b.close - b.open) / (b.high - b.low) * cfg.rsiMFIMultiplier)),
290264
290285
  Math.trunc(cfg.rsiMFIperiod)
290265
290286
  )).map((v) => v - cfg.rsiMFIPosY);
290266
- const ap = sourceOf11("hlc3");
290287
+ const ap = sourceOf9("hlc3");
290267
290288
  const esa = A7(import_oakscriptjs1594.ta.ema(S2(ap), Math.trunc(cfg.n1)));
290268
290289
  const dw = A7(import_oakscriptjs1594.ta.ema(S2(ap.map((v, i) => Math.abs(v - esa[i]))), Math.trunc(cfg.n1)));
290269
290290
  const ci = ap.map((v, i) => (v - esa[i]) / (0.015 * dw[i]));
@@ -298473,7 +298494,7 @@ var eq228 = (a, b) => Math.abs(a - b) <= EPS1002;
298473
298494
  var ne117 = (a, b) => !isNaN(a) && !isNaN(b) && Math.abs(a - b) > EPS1002;
298474
298495
  var cnew2 = (c2, t) => String(import_oakscriptjs1613.color.new(c2, t));
298475
298496
  var WHITE56 = "#FFFFFF";
298476
- function sourceOf9(bars, name) {
298497
+ function sourceOf7(bars, name) {
298477
298498
  switch (name) {
298478
298499
  case "open":
298479
298500
  return bars.map((b) => b.open);
@@ -298546,7 +298567,7 @@ function calculate1658(bars, inputs = {}, chart) {
298546
298567
  for (let i = 0; i < n; i++) {
298547
298568
  haOpen.push(i === 0 || isNaN(haOpen[i - 1]) ? (open11[i] + close11[i]) / 2 : (haOpen[i - 1] + ohlc4[i - 1]) / 2);
298548
298569
  }
298549
- const srcPrice = sourceOf9(bars, cfg.srcPrice);
298570
+ const srcPrice = sourceOf7(bars, cfg.srcPrice);
298550
298571
  const alternative = bars.map((b, i) => {
298551
298572
  switch (cfg.altSourceFormula) {
298552
298573
  case "(open + close +3 * (high + low)) / 8":
@@ -303077,7 +303098,7 @@ var ge457 = (a, b) => !isNaN(a) && !isNaN(b) && !(b - a > EPS1005);
303077
303098
  var le311 = (a, b) => !isNaN(a) && !isNaN(b) && !(a - b > EPS1005);
303078
303099
  var eq229 = (a, b) => !isNaN(a) && !isNaN(b) && Math.abs(a - b) <= EPS1005;
303079
303100
  var nz115 = (x, y = 0) => isNaN(x) ? y : x;
303080
- function sourceOf10(bars, src) {
303101
+ function sourceOf8(bars, src) {
303081
303102
  return bars.map((b) => {
303082
303103
  switch (src) {
303083
303104
  case "open":
@@ -303107,7 +303128,7 @@ function calculate1668(bars, inputs = {}, chart) {
303107
303128
  const mom = Math.trunc(cfg.mom);
303108
303129
  const A7 = (s) => s.toArray().map((v) => v ?? NaN);
303109
303130
  const S2 = (a) => import_oakscriptjs1623.Series.fromArray(bars, a);
303110
- const src = sourceOf10(bars, cfg.maSrc);
303131
+ const src = sourceOf8(bars, cfg.maSrc);
303111
303132
  const srcS = S2(src);
303112
303133
  const variant4 = () => {
303113
303134
  switch (cfg.maType) {
@@ -325386,5 +325407,5 @@ var registryPart11 = [
325386
325407
  calculate: calculate435
325387
325408
  }
325388
325409
  ];
325389
- var indicatorRegistry = [...registryPart1, ...registryPart11, ...registryPart2, ...registryPart3, ...registryPart4, ...registryPart5, ...registryPart6, ...registryPart7, ...registryPart8, ...registryPart9, ...registryPart10].map(withReferenceNames);
325390
- var version = "0.15.2";
325410
+ var indicatorRegistry = [...registryPart1, ...registryPart11, ...registryPart2, ...registryPart3, ...registryPart4, ...registryPart5, ...registryPart6, ...registryPart7, ...registryPart8, ...registryPart9, ...registryPart10].map(withReferenceNames).map(withValueFormat);
325411
+ var version = "0.15.4";
package/dist/index.d.ts CHANGED
@@ -729,6 +729,7 @@ export type { RealtimeVolumeBarsInputs } from './community/realtime-volume-bars'
729
729
  export type { VolumaticSRLevelsInputs } from './community/volumatic-sr-levels';
730
730
  export type { VwapMvwapEmaCrossoverInputs } from './community/vwap-mvwap-ema-crossover';
731
731
  export type { VolumeFootprintInputs } from './community/volume-footprint';
732
+ export { VALUE_FORMATS, type StudyFormat } from './value-formats';
732
733
  export { REFERENCE_NAMES } from './reference-names';
733
734
  export { candlestickPortIndicators, candlestickPortEntries, candlestickPortAllPatterns } from './candlestick-port/adapter';
734
735
  export declare const Hammer: import("./candlestick-port/adapter").PortIndicator;
@@ -3343,6 +3344,8 @@ export interface IndicatorRegistryEntry {
3343
3344
  * the result's `outputValues`. Unset: its line plots in plotConfig order.
3344
3345
  */
3345
3346
  outputs?: import('./types').OutputDecl[];
3347
+ /** Format of its values (reference metaInfo format); unset: the symbol's price format. */
3348
+ format?: import('./value-formats').StudyFormat;
3346
3349
  defaultInputs: Record<string, unknown>;
3347
3350
  /**
3348
3351
  * True when the output depends on the bars visible on the chart (`leftVisibleBarTime` / `rightVisibleBarTime` of
@@ -3377,5 +3380,5 @@ export type { ChartContext, VisibleRange, SymbolRequest, SymbolInfo } from './ch
3377
3380
  export { MissingSymbolDataError, symbolBarsOf } from './chart-context';
3378
3381
  export { mintickOf, timezoneOf, tickeridOf, tickerOf, symbolTypeOf, currencyOf, basecurrencyOf, rootOf, foregroundColorOf, backgroundColorOf, lastBarConfirmedOf, nowOf, visibleRangeOf, } from './chart-context';
3379
3382
  export { securityOther, securityOtherValues, securityLowerTf, otherSymbolChart, spreadSymbols, spreadBars, spreadOptions, type OtherSymbolOptions, type OtherSymbolChart, type SymbolCalendar, } from './other-symbol';
3380
- export declare const version = "0.15.2";
3383
+ export declare const version = "0.15.4";
3381
3384
  //# sourceMappingURL=index.d.ts.map