oakscriptjs 0.2.0 → 0.2.1

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.d.ts CHANGED
@@ -33,7 +33,7 @@ export { input_int, input_float, input_bool, input_string, input_source, } from
33
33
  export type { OakScriptContext, ChartAdapter, InputAdapter, SeriesHandle, SeriesOptions, InputConfig, InputOptions, OhlcvData, PlotConfig, HLineConfig, FillConfig, } from './runtime/types';
34
34
  export { LightweightChartsAdapter } from './runtime/adapters/LightweightChartsAdapter';
35
35
  export { SimpleInputAdapter } from './runtime/adapters/SimpleInputAdapter';
36
- export declare const VERSION = "0.3.0";
36
+ export declare const VERSION = "0.2.1";
37
37
  export declare const info: {
38
38
  name: string;
39
39
  version: string;
package/dist/index.js CHANGED
@@ -265,12 +265,12 @@ function macd(source, fastLength, slowLength, signalLength) {
265
265
  }
266
266
  function bb(series, length2, mult2) {
267
267
  const basis = sma(series, length2);
268
- const dev2 = stdev(series, length2);
268
+ const dev3 = stdev(series, length2);
269
269
  const upper2 = [];
270
270
  const lower2 = [];
271
271
  for (let i = 0; i < series.length; i++) {
272
- upper2.push(basis[i] + mult2 * dev2[i]);
273
- lower2.push(basis[i] - mult2 * dev2[i]);
272
+ upper2.push(basis[i] + mult2 * dev3[i]);
273
+ lower2.push(basis[i] - mult2 * dev3[i]);
274
274
  }
275
275
  return [basis, upper2, lower2];
276
276
  }
@@ -474,13 +474,13 @@ function highest(source, length2) {
474
474
  if (i < length2 - 1) {
475
475
  result.push(NaN);
476
476
  } else {
477
- let max5 = -Infinity;
477
+ let max6 = -Infinity;
478
478
  for (let j = 0; j < length2; j++) {
479
479
  if (!isNaN(source[i - j])) {
480
- max5 = Math.max(max5, source[i - j]);
480
+ max6 = Math.max(max6, source[i - j]);
481
481
  }
482
482
  }
483
- result.push(max5 === -Infinity ? NaN : max5);
483
+ result.push(max6 === -Infinity ? NaN : max6);
484
484
  }
485
485
  }
486
486
  return result;
@@ -491,13 +491,13 @@ function lowest(source, length2) {
491
491
  if (i < length2 - 1) {
492
492
  result.push(NaN);
493
493
  } else {
494
- let min5 = Infinity;
494
+ let min6 = Infinity;
495
495
  for (let j = 0; j < length2; j++) {
496
496
  if (!isNaN(source[i - j])) {
497
- min5 = Math.min(min5, source[i - j]);
497
+ min6 = Math.min(min6, source[i - j]);
498
498
  }
499
499
  }
500
- result.push(min5 === Infinity ? NaN : min5);
500
+ result.push(min6 === Infinity ? NaN : min6);
501
501
  }
502
502
  }
503
503
  return result;
@@ -763,10 +763,10 @@ function correlation(source1, source2, length2) {
763
763
  let sum2Sq = 0;
764
764
  for (const [v1, v2] of pairs) {
765
765
  const dev1 = v1 - mean1;
766
- const dev2 = v2 - mean2;
767
- numerator += dev1 * dev2;
766
+ const dev22 = v2 - mean2;
767
+ numerator += dev1 * dev22;
768
768
  sum1Sq += dev1 * dev1;
769
- sum2Sq += dev2 * dev2;
769
+ sum2Sq += dev22 * dev22;
770
770
  }
771
771
  const denominator = Math.sqrt(sum1Sq * sum2Sq);
772
772
  if (denominator === 0) {
@@ -831,11 +831,11 @@ function stoch(source, high, low, length2) {
831
831
  if (isNaN(lowestValues[i]) || isNaN(highestValues[i])) {
832
832
  result.push(NaN);
833
833
  } else {
834
- const range3 = highestValues[i] - lowestValues[i];
835
- if (range3 === 0) {
834
+ const range4 = highestValues[i] - lowestValues[i];
835
+ if (range4 === 0) {
836
836
  result.push(NaN);
837
837
  } else {
838
- const stochValue = 100 * (source[i] - lowestValues[i]) / range3;
838
+ const stochValue = 100 * (source[i] - lowestValues[i]) / range4;
839
839
  result.push(stochValue);
840
840
  }
841
841
  }
@@ -902,7 +902,7 @@ function hma(source, length2) {
902
902
  }
903
903
  return wma(diff2, sqrtLength);
904
904
  }
905
- function sar(start, inc, max5, high, low, close) {
905
+ function sar(start, inc, max6, high, low, close) {
906
906
  if (!high || !low || !close) {
907
907
  throw new Error(
908
908
  "ta.sar() requires high, low, and close series. Either pass them explicitly or use createContext({ chart: { high, low, close } }) for implicit data."
@@ -954,12 +954,12 @@ function sar(start, inc, max5, high, low, close) {
954
954
  if (isUpTrend) {
955
955
  if (high[i] > extremePoint) {
956
956
  extremePoint = high[i];
957
- acceleration = Math.min(acceleration + inc, max5);
957
+ acceleration = Math.min(acceleration + inc, max6);
958
958
  }
959
959
  } else {
960
960
  if (low[i] < extremePoint) {
961
961
  extremePoint = low[i];
962
- acceleration = Math.min(acceleration + inc, max5);
962
+ acceleration = Math.min(acceleration + inc, max6);
963
963
  }
964
964
  }
965
965
  }
@@ -1195,22 +1195,22 @@ function cmo(source, length2) {
1195
1195
  }
1196
1196
  function kc(source, length2, mult2, useTrueRange = true, high, low, close) {
1197
1197
  const middle = ema(source, length2);
1198
- let range3;
1198
+ let range4;
1199
1199
  if (useTrueRange) {
1200
1200
  if (!high || !low || !close) {
1201
1201
  throw new Error("ta.kc() with useTrueRange=true requires high, low, and close data");
1202
1202
  }
1203
- range3 = tr(false, high, low, close);
1203
+ range4 = tr(false, high, low, close);
1204
1204
  } else {
1205
1205
  if (!high || !low) {
1206
1206
  throw new Error("ta.kc() requires high and low data");
1207
1207
  }
1208
- range3 = [];
1208
+ range4 = [];
1209
1209
  for (let i = 0; i < high.length; i++) {
1210
- range3.push(high[i] - low[i]);
1210
+ range4.push(high[i] - low[i]);
1211
1211
  }
1212
1212
  }
1213
- const rangeEma = ema(range3, length2);
1213
+ const rangeEma = ema(range4, length2);
1214
1214
  const upper2 = [];
1215
1215
  const lower2 = [];
1216
1216
  for (let i = 0; i < middle.length; i++) {
@@ -1247,11 +1247,11 @@ function wpr(high, low, close, length2 = 14) {
1247
1247
  if (low[j] < lowestLow)
1248
1248
  lowestLow = low[j];
1249
1249
  }
1250
- const range3 = highestHigh - lowestLow;
1251
- if (range3 === 0) {
1250
+ const range4 = highestHigh - lowestLow;
1251
+ if (range4 === 0) {
1252
1252
  result.push(NaN);
1253
1253
  } else {
1254
- const wprValue = (highestHigh - close[i]) / range3 * -100;
1254
+ const wprValue = (highestHigh - close[i]) / range4 * -100;
1255
1255
  result.push(wprValue);
1256
1256
  }
1257
1257
  }
@@ -1417,8 +1417,8 @@ function cog(source, length2 = 10) {
1417
1417
  if (denominator === 0) {
1418
1418
  result.push(NaN);
1419
1419
  } else {
1420
- const cog2 = -1 * (numerator / denominator) + (length2 + 1) / 2;
1421
- result.push(cog2);
1420
+ const cog3 = -1 * (numerator / denominator) + (length2 + 1) / 2;
1421
+ result.push(cog3);
1422
1422
  }
1423
1423
  }
1424
1424
  return result;
@@ -1680,15 +1680,15 @@ function calculatePivotLevels(type, h, l, c, o) {
1680
1680
  levels[2] = x / 2 - h;
1681
1681
  break;
1682
1682
  case "Camarilla":
1683
- const range3 = h - l;
1684
- levels[1] = c + range3 * 1.1 / 12;
1685
- levels[2] = c - range3 * 1.1 / 12;
1686
- levels[3] = c + range3 * 1.1 / 6;
1687
- levels[4] = c - range3 * 1.1 / 6;
1688
- levels[5] = c + range3 * 1.1 / 4;
1689
- levels[6] = c - range3 * 1.1 / 4;
1690
- levels[7] = c + range3 * 1.1 / 2;
1691
- levels[8] = c - range3 * 1.1 / 2;
1683
+ const range4 = h - l;
1684
+ levels[1] = c + range4 * 1.1 / 12;
1685
+ levels[2] = c - range4 * 1.1 / 12;
1686
+ levels[3] = c + range4 * 1.1 / 6;
1687
+ levels[4] = c - range4 * 1.1 / 6;
1688
+ levels[5] = c + range4 * 1.1 / 4;
1689
+ levels[6] = c - range4 * 1.1 / 4;
1690
+ levels[7] = c + range4 * 1.1 / 2;
1691
+ levels[8] = c - range4 * 1.1 / 2;
1692
1692
  levels[9] = h;
1693
1693
  levels[10] = l;
1694
1694
  break;
@@ -2772,10 +2772,10 @@ function todegrees(radians) {
2772
2772
  }
2773
2773
  return radians * (180 / Math.PI);
2774
2774
  }
2775
- function random(min5, max5, _seed) {
2775
+ function random(min6, max6, _seed) {
2776
2776
  const rand = Math.random();
2777
- if (min5 !== void 0 && max5 !== void 0) {
2778
- return min5 + rand * (max5 - min5);
2777
+ if (min6 !== void 0 && max6 !== void 0) {
2778
+ return min6 + rand * (max6 - min6);
2779
2779
  }
2780
2780
  return rand;
2781
2781
  }
@@ -2987,16 +2987,16 @@ function median2(id) {
2987
2987
  function mode2(id) {
2988
2988
  const frequency = /* @__PURE__ */ new Map();
2989
2989
  let maxFreq = 0;
2990
- let mode4 = id[0];
2990
+ let mode5 = id[0];
2991
2991
  for (const val of id) {
2992
2992
  const freq = (frequency.get(val) || 0) + 1;
2993
2993
  frequency.set(val, freq);
2994
2994
  if (freq > maxFreq) {
2995
2995
  maxFreq = freq;
2996
- mode4 = val;
2996
+ mode5 = val;
2997
2997
  }
2998
2998
  }
2999
- return mode4;
2999
+ return mode5;
3000
3000
  }
3001
3001
  function stdev2(id) {
3002
3002
  const mean = avg2(id);
@@ -5247,21 +5247,45 @@ var ta_series_exports = {};
5247
5247
  __export(ta_series_exports, {
5248
5248
  alma: () => alma2,
5249
5249
  atr: () => atr2,
5250
+ barssince: () => barssince2,
5250
5251
  bb: () => bb2,
5252
+ bbw: () => bbw2,
5251
5253
  cci: () => cci2,
5252
5254
  change: () => change2,
5255
+ cmo: () => cmo2,
5256
+ cog: () => cog2,
5257
+ correlation: () => correlation2,
5253
5258
  cross: () => cross2,
5254
5259
  crossover: () => crossover2,
5255
5260
  crossunder: () => crossunder2,
5256
5261
  cum: () => cum2,
5262
+ dev: () => dev2,
5263
+ dmi: () => dmi2,
5257
5264
  ema: () => ema2,
5258
5265
  falling: () => falling2,
5259
5266
  highest: () => highest2,
5267
+ highestbars: () => highestbars2,
5268
+ hma: () => hma2,
5260
5269
  ichimoku: () => ichimoku2,
5270
+ kc: () => kc2,
5271
+ kcw: () => kcw2,
5261
5272
  linreg: () => linreg2,
5262
5273
  lowest: () => lowest2,
5274
+ lowestbars: () => lowestbars2,
5263
5275
  macd: () => macd2,
5276
+ max: () => max5,
5277
+ median: () => median4,
5278
+ mfi: () => mfi2,
5279
+ min: () => min5,
5280
+ mode: () => mode4,
5264
5281
  mom: () => mom2,
5282
+ percentile_linear_interpolation: () => percentile_linear_interpolation3,
5283
+ percentile_nearest_rank: () => percentile_nearest_rank3,
5284
+ percentrank: () => percentrank3,
5285
+ pivothigh: () => pivothigh2,
5286
+ pivotlow: () => pivotlow2,
5287
+ range: () => range3,
5288
+ rci: () => rci2,
5265
5289
  rising: () => rising2,
5266
5290
  rma: () => rma2,
5267
5291
  roc: () => roc2,
@@ -5271,11 +5295,16 @@ __export(ta_series_exports, {
5271
5295
  stdev: () => stdev3,
5272
5296
  stoch: () => stoch2,
5273
5297
  supertrend: () => supertrend2,
5298
+ swma: () => swma2,
5274
5299
  ta: () => ta,
5275
5300
  tr: () => tr2,
5301
+ tsi: () => tsi2,
5302
+ valuewhen: () => valuewhen2,
5303
+ variance: () => variance3,
5276
5304
  vwap: () => vwap2,
5277
5305
  vwma: () => vwma2,
5278
5306
  wma: () => wma2,
5307
+ wpr: () => wpr2,
5279
5308
  zigzag: () => zigzag2
5280
5309
  });
5281
5310
  function sma2(source, length2) {
@@ -5507,11 +5536,174 @@ function cci2(source, length2) {
5507
5536
  const result = cci(sourceValues, length2);
5508
5537
  return Series.fromArray(bars, result);
5509
5538
  }
5510
- function sar2(bars, start = 0.02, inc = 0.02, max5 = 0.2) {
5539
+ function sar2(bars, start = 0.02, inc = 0.02, max6 = 0.2) {
5511
5540
  const high = bars.map((b2) => b2.high);
5512
5541
  const low = bars.map((b2) => b2.low);
5513
5542
  const close = bars.map((b2) => b2.close);
5514
- const result = sar(start, inc, max5, high, low, close);
5543
+ const result = sar(start, inc, max6, high, low, close);
5544
+ return Series.fromArray(bars, result);
5545
+ }
5546
+ function dev2(source, length2) {
5547
+ const bars = source.bars;
5548
+ const result = dev(source.toArray(), length2);
5549
+ return Series.fromArray(bars, result);
5550
+ }
5551
+ function variance3(source, length2, biased = true) {
5552
+ const bars = source.bars;
5553
+ const result = variance(source.toArray(), length2, biased);
5554
+ return Series.fromArray(bars, result);
5555
+ }
5556
+ function median4(source, length2) {
5557
+ const bars = source.bars;
5558
+ const result = median(source.toArray(), length2);
5559
+ return Series.fromArray(bars, result);
5560
+ }
5561
+ function swma2(source) {
5562
+ const bars = source.bars;
5563
+ const result = swma(source.toArray());
5564
+ return Series.fromArray(bars, result);
5565
+ }
5566
+ function correlation2(source1, source2, length2) {
5567
+ const bars = source1.bars;
5568
+ const result = correlation(source1.toArray(), source2.toArray(), length2);
5569
+ return Series.fromArray(bars, result);
5570
+ }
5571
+ function percentrank3(source, length2) {
5572
+ const bars = source.bars;
5573
+ const result = percentrank(source.toArray(), length2);
5574
+ return Series.fromArray(bars, result);
5575
+ }
5576
+ function mfi2(source, length2, volume) {
5577
+ const bars = source.bars;
5578
+ const result = mfi(source.toArray(), length2, volume.toArray());
5579
+ return Series.fromArray(bars, result);
5580
+ }
5581
+ function hma2(source, length2) {
5582
+ const bars = source.bars;
5583
+ const result = hma(source.toArray(), length2);
5584
+ return Series.fromArray(bars, result);
5585
+ }
5586
+ function pivothigh2(source, leftbars, rightbars) {
5587
+ const bars = source.bars;
5588
+ const result = pivothigh(source.toArray(), leftbars, rightbars);
5589
+ return Series.fromArray(bars, result);
5590
+ }
5591
+ function pivotlow2(source, leftbars, rightbars) {
5592
+ const bars = source.bars;
5593
+ const result = pivotlow(source.toArray(), leftbars, rightbars);
5594
+ return Series.fromArray(bars, result);
5595
+ }
5596
+ function barssince2(condition) {
5597
+ const bars = condition.bars;
5598
+ const boolValues = condition.toArray().map((v) => v === 1);
5599
+ const result = barssince(boolValues);
5600
+ return Series.fromArray(bars, result);
5601
+ }
5602
+ function valuewhen2(condition, source, occurrence) {
5603
+ const bars = condition.bars;
5604
+ const boolValues = condition.toArray().map((v) => v === 1);
5605
+ const result = valuewhen(boolValues, source.toArray(), occurrence);
5606
+ return Series.fromArray(bars, result);
5607
+ }
5608
+ function dmi2(bars, diLength, adxSmoothing) {
5609
+ const high = bars.map((b2) => b2.high);
5610
+ const low = bars.map((b2) => b2.low);
5611
+ const close = bars.map((b2) => b2.close);
5612
+ const [plusDI, minusDI, adx] = dmi(diLength, adxSmoothing, high, low, close);
5613
+ return [
5614
+ Series.fromArray(bars, plusDI),
5615
+ Series.fromArray(bars, minusDI),
5616
+ Series.fromArray(bars, adx)
5617
+ ];
5618
+ }
5619
+ function tsi2(source, shortLength, longLength) {
5620
+ const bars = source.bars;
5621
+ const result = tsi(source.toArray(), shortLength, longLength);
5622
+ return Series.fromArray(bars, result);
5623
+ }
5624
+ function cmo2(source, length2) {
5625
+ const bars = source.bars;
5626
+ const result = cmo(source.toArray(), length2);
5627
+ return Series.fromArray(bars, result);
5628
+ }
5629
+ function kc2(bars, source, length2, mult2, useTrueRange = true) {
5630
+ const high = bars.map((b2) => b2.high);
5631
+ const low = bars.map((b2) => b2.low);
5632
+ const close = bars.map((b2) => b2.close);
5633
+ const [middle, upper2, lower2] = kc(source.toArray(), length2, mult2, useTrueRange, high, low, close);
5634
+ return [
5635
+ Series.fromArray(bars, middle),
5636
+ Series.fromArray(bars, upper2),
5637
+ Series.fromArray(bars, lower2)
5638
+ ];
5639
+ }
5640
+ function bbw2(source, length2, mult2) {
5641
+ const bars = source.bars;
5642
+ const result = bbw(source.toArray(), length2, mult2);
5643
+ return Series.fromArray(bars, result);
5644
+ }
5645
+ function wpr2(bars, length2 = 14) {
5646
+ const high = bars.map((b2) => b2.high);
5647
+ const low = bars.map((b2) => b2.low);
5648
+ const close = bars.map((b2) => b2.close);
5649
+ const result = wpr(high, low, close, length2);
5650
+ return Series.fromArray(bars, result);
5651
+ }
5652
+ function kcw2(bars, source, length2 = 20, mult2 = 2, useTrueRange = true) {
5653
+ const high = bars.map((b2) => b2.high);
5654
+ const low = bars.map((b2) => b2.low);
5655
+ const close = bars.map((b2) => b2.close);
5656
+ const result = kcw(source.toArray(), length2, mult2, useTrueRange, high, low, close);
5657
+ return Series.fromArray(bars, result);
5658
+ }
5659
+ function range3(high, low) {
5660
+ const bars = high.bars;
5661
+ const result = range(high.toArray(), low.toArray());
5662
+ return Series.fromArray(bars, result);
5663
+ }
5664
+ function highestbars2(source, length2) {
5665
+ const bars = source.bars;
5666
+ const result = highestbars(source.toArray(), length2);
5667
+ return Series.fromArray(bars, result);
5668
+ }
5669
+ function lowestbars2(source, length2) {
5670
+ const bars = source.bars;
5671
+ const result = lowestbars(source.toArray(), length2);
5672
+ return Series.fromArray(bars, result);
5673
+ }
5674
+ function max5(source1, source2) {
5675
+ const bars = source1.bars;
5676
+ const result = max(source1.toArray(), source2.toArray());
5677
+ return Series.fromArray(bars, result);
5678
+ }
5679
+ function min5(source1, source2) {
5680
+ const bars = source1.bars;
5681
+ const result = min(source1.toArray(), source2.toArray());
5682
+ return Series.fromArray(bars, result);
5683
+ }
5684
+ function cog2(source, length2 = 10) {
5685
+ const bars = source.bars;
5686
+ const result = cog(source.toArray(), length2);
5687
+ return Series.fromArray(bars, result);
5688
+ }
5689
+ function mode4(source, length2) {
5690
+ const bars = source.bars;
5691
+ const result = mode(source.toArray(), length2);
5692
+ return Series.fromArray(bars, result);
5693
+ }
5694
+ function percentile_linear_interpolation3(source, length2, percentage) {
5695
+ const bars = source.bars;
5696
+ const result = percentile_linear_interpolation(source.toArray(), length2, percentage);
5697
+ return Series.fromArray(bars, result);
5698
+ }
5699
+ function percentile_nearest_rank3(source, length2, percentage) {
5700
+ const bars = source.bars;
5701
+ const result = percentile_nearest_rank(source.toArray(), length2, percentage);
5702
+ return Series.fromArray(bars, result);
5703
+ }
5704
+ function rci2(source, length2) {
5705
+ const bars = source.bars;
5706
+ const result = rci(source.toArray(), length2);
5515
5707
  return Series.fromArray(bars, result);
5516
5708
  }
5517
5709
  var ta = {
@@ -5545,7 +5737,36 @@ var ta = {
5545
5737
  alma: alma2,
5546
5738
  zigzag: zigzag2,
5547
5739
  cci: cci2,
5548
- sar: sar2
5740
+ sar: sar2,
5741
+ dev: dev2,
5742
+ variance: variance3,
5743
+ median: median4,
5744
+ swma: swma2,
5745
+ correlation: correlation2,
5746
+ percentrank: percentrank3,
5747
+ mfi: mfi2,
5748
+ hma: hma2,
5749
+ pivothigh: pivothigh2,
5750
+ pivotlow: pivotlow2,
5751
+ barssince: barssince2,
5752
+ valuewhen: valuewhen2,
5753
+ dmi: dmi2,
5754
+ tsi: tsi2,
5755
+ cmo: cmo2,
5756
+ kc: kc2,
5757
+ bbw: bbw2,
5758
+ wpr: wpr2,
5759
+ kcw: kcw2,
5760
+ range: range3,
5761
+ highestbars: highestbars2,
5762
+ lowestbars: lowestbars2,
5763
+ max: max5,
5764
+ min: min5,
5765
+ cog: cog2,
5766
+ mode: mode4,
5767
+ percentile_linear_interpolation: percentile_linear_interpolation3,
5768
+ percentile_nearest_rank: percentile_nearest_rank3,
5769
+ rci: rci2
5549
5770
  };
5550
5771
 
5551
5772
  // src/utils/index.ts
@@ -5760,9 +5981,9 @@ var ZigZag = class {
5760
5981
  return true;
5761
5982
  }
5762
5983
  } else {
5763
- const dev2 = this.calcDev(last2.end.price, point.price);
5984
+ const dev3 = this.calcDev(last2.end.price, point.price);
5764
5985
  const threshold = this.settings.devThreshold;
5765
- const meetsThreshold = last2.isHigh ? dev2 <= -threshold : dev2 >= threshold;
5986
+ const meetsThreshold = last2.isHigh ? dev3 <= -threshold : dev3 >= threshold;
5766
5987
  if (meetsThreshold) {
5767
5988
  this.pivots.push({
5768
5989
  isHigh,
@@ -6493,7 +6714,7 @@ var SimpleInputAdapter = class {
6493
6714
  };
6494
6715
 
6495
6716
  // src/index.ts
6496
- var VERSION = "0.3.0";
6717
+ var VERSION = "0.2.1";
6497
6718
  var info = {
6498
6719
  name: "OakScriptJS",
6499
6720
  version: VERSION,
package/dist/index.mjs CHANGED
@@ -165,12 +165,12 @@ function macd(source, fastLength, slowLength, signalLength) {
165
165
  }
166
166
  function bb(series, length2, mult2) {
167
167
  const basis = sma(series, length2);
168
- const dev2 = stdev(series, length2);
168
+ const dev3 = stdev(series, length2);
169
169
  const upper2 = [];
170
170
  const lower2 = [];
171
171
  for (let i = 0; i < series.length; i++) {
172
- upper2.push(basis[i] + mult2 * dev2[i]);
173
- lower2.push(basis[i] - mult2 * dev2[i]);
172
+ upper2.push(basis[i] + mult2 * dev3[i]);
173
+ lower2.push(basis[i] - mult2 * dev3[i]);
174
174
  }
175
175
  return [basis, upper2, lower2];
176
176
  }
@@ -374,13 +374,13 @@ function highest(source, length2) {
374
374
  if (i < length2 - 1) {
375
375
  result.push(NaN);
376
376
  } else {
377
- let max5 = -Infinity;
377
+ let max6 = -Infinity;
378
378
  for (let j = 0; j < length2; j++) {
379
379
  if (!isNaN(source[i - j])) {
380
- max5 = Math.max(max5, source[i - j]);
380
+ max6 = Math.max(max6, source[i - j]);
381
381
  }
382
382
  }
383
- result.push(max5 === -Infinity ? NaN : max5);
383
+ result.push(max6 === -Infinity ? NaN : max6);
384
384
  }
385
385
  }
386
386
  return result;
@@ -391,13 +391,13 @@ function lowest(source, length2) {
391
391
  if (i < length2 - 1) {
392
392
  result.push(NaN);
393
393
  } else {
394
- let min5 = Infinity;
394
+ let min6 = Infinity;
395
395
  for (let j = 0; j < length2; j++) {
396
396
  if (!isNaN(source[i - j])) {
397
- min5 = Math.min(min5, source[i - j]);
397
+ min6 = Math.min(min6, source[i - j]);
398
398
  }
399
399
  }
400
- result.push(min5 === Infinity ? NaN : min5);
400
+ result.push(min6 === Infinity ? NaN : min6);
401
401
  }
402
402
  }
403
403
  return result;
@@ -663,10 +663,10 @@ function correlation(source1, source2, length2) {
663
663
  let sum2Sq = 0;
664
664
  for (const [v1, v2] of pairs) {
665
665
  const dev1 = v1 - mean1;
666
- const dev2 = v2 - mean2;
667
- numerator += dev1 * dev2;
666
+ const dev22 = v2 - mean2;
667
+ numerator += dev1 * dev22;
668
668
  sum1Sq += dev1 * dev1;
669
- sum2Sq += dev2 * dev2;
669
+ sum2Sq += dev22 * dev22;
670
670
  }
671
671
  const denominator = Math.sqrt(sum1Sq * sum2Sq);
672
672
  if (denominator === 0) {
@@ -731,11 +731,11 @@ function stoch(source, high, low, length2) {
731
731
  if (isNaN(lowestValues[i]) || isNaN(highestValues[i])) {
732
732
  result.push(NaN);
733
733
  } else {
734
- const range3 = highestValues[i] - lowestValues[i];
735
- if (range3 === 0) {
734
+ const range4 = highestValues[i] - lowestValues[i];
735
+ if (range4 === 0) {
736
736
  result.push(NaN);
737
737
  } else {
738
- const stochValue = 100 * (source[i] - lowestValues[i]) / range3;
738
+ const stochValue = 100 * (source[i] - lowestValues[i]) / range4;
739
739
  result.push(stochValue);
740
740
  }
741
741
  }
@@ -802,7 +802,7 @@ function hma(source, length2) {
802
802
  }
803
803
  return wma(diff2, sqrtLength);
804
804
  }
805
- function sar(start, inc, max5, high, low, close) {
805
+ function sar(start, inc, max6, high, low, close) {
806
806
  if (!high || !low || !close) {
807
807
  throw new Error(
808
808
  "ta.sar() requires high, low, and close series. Either pass them explicitly or use createContext({ chart: { high, low, close } }) for implicit data."
@@ -854,12 +854,12 @@ function sar(start, inc, max5, high, low, close) {
854
854
  if (isUpTrend) {
855
855
  if (high[i] > extremePoint) {
856
856
  extremePoint = high[i];
857
- acceleration = Math.min(acceleration + inc, max5);
857
+ acceleration = Math.min(acceleration + inc, max6);
858
858
  }
859
859
  } else {
860
860
  if (low[i] < extremePoint) {
861
861
  extremePoint = low[i];
862
- acceleration = Math.min(acceleration + inc, max5);
862
+ acceleration = Math.min(acceleration + inc, max6);
863
863
  }
864
864
  }
865
865
  }
@@ -1095,22 +1095,22 @@ function cmo(source, length2) {
1095
1095
  }
1096
1096
  function kc(source, length2, mult2, useTrueRange = true, high, low, close) {
1097
1097
  const middle = ema(source, length2);
1098
- let range3;
1098
+ let range4;
1099
1099
  if (useTrueRange) {
1100
1100
  if (!high || !low || !close) {
1101
1101
  throw new Error("ta.kc() with useTrueRange=true requires high, low, and close data");
1102
1102
  }
1103
- range3 = tr(false, high, low, close);
1103
+ range4 = tr(false, high, low, close);
1104
1104
  } else {
1105
1105
  if (!high || !low) {
1106
1106
  throw new Error("ta.kc() requires high and low data");
1107
1107
  }
1108
- range3 = [];
1108
+ range4 = [];
1109
1109
  for (let i = 0; i < high.length; i++) {
1110
- range3.push(high[i] - low[i]);
1110
+ range4.push(high[i] - low[i]);
1111
1111
  }
1112
1112
  }
1113
- const rangeEma = ema(range3, length2);
1113
+ const rangeEma = ema(range4, length2);
1114
1114
  const upper2 = [];
1115
1115
  const lower2 = [];
1116
1116
  for (let i = 0; i < middle.length; i++) {
@@ -1147,11 +1147,11 @@ function wpr(high, low, close, length2 = 14) {
1147
1147
  if (low[j] < lowestLow)
1148
1148
  lowestLow = low[j];
1149
1149
  }
1150
- const range3 = highestHigh - lowestLow;
1151
- if (range3 === 0) {
1150
+ const range4 = highestHigh - lowestLow;
1151
+ if (range4 === 0) {
1152
1152
  result.push(NaN);
1153
1153
  } else {
1154
- const wprValue = (highestHigh - close[i]) / range3 * -100;
1154
+ const wprValue = (highestHigh - close[i]) / range4 * -100;
1155
1155
  result.push(wprValue);
1156
1156
  }
1157
1157
  }
@@ -1317,8 +1317,8 @@ function cog(source, length2 = 10) {
1317
1317
  if (denominator === 0) {
1318
1318
  result.push(NaN);
1319
1319
  } else {
1320
- const cog2 = -1 * (numerator / denominator) + (length2 + 1) / 2;
1321
- result.push(cog2);
1320
+ const cog3 = -1 * (numerator / denominator) + (length2 + 1) / 2;
1321
+ result.push(cog3);
1322
1322
  }
1323
1323
  }
1324
1324
  return result;
@@ -1580,15 +1580,15 @@ function calculatePivotLevels(type, h, l, c, o) {
1580
1580
  levels[2] = x / 2 - h;
1581
1581
  break;
1582
1582
  case "Camarilla":
1583
- const range3 = h - l;
1584
- levels[1] = c + range3 * 1.1 / 12;
1585
- levels[2] = c - range3 * 1.1 / 12;
1586
- levels[3] = c + range3 * 1.1 / 6;
1587
- levels[4] = c - range3 * 1.1 / 6;
1588
- levels[5] = c + range3 * 1.1 / 4;
1589
- levels[6] = c - range3 * 1.1 / 4;
1590
- levels[7] = c + range3 * 1.1 / 2;
1591
- levels[8] = c - range3 * 1.1 / 2;
1583
+ const range4 = h - l;
1584
+ levels[1] = c + range4 * 1.1 / 12;
1585
+ levels[2] = c - range4 * 1.1 / 12;
1586
+ levels[3] = c + range4 * 1.1 / 6;
1587
+ levels[4] = c - range4 * 1.1 / 6;
1588
+ levels[5] = c + range4 * 1.1 / 4;
1589
+ levels[6] = c - range4 * 1.1 / 4;
1590
+ levels[7] = c + range4 * 1.1 / 2;
1591
+ levels[8] = c - range4 * 1.1 / 2;
1592
1592
  levels[9] = h;
1593
1593
  levels[10] = l;
1594
1594
  break;
@@ -2672,10 +2672,10 @@ function todegrees(radians) {
2672
2672
  }
2673
2673
  return radians * (180 / Math.PI);
2674
2674
  }
2675
- function random(min5, max5, _seed) {
2675
+ function random(min6, max6, _seed) {
2676
2676
  const rand = Math.random();
2677
- if (min5 !== void 0 && max5 !== void 0) {
2678
- return min5 + rand * (max5 - min5);
2677
+ if (min6 !== void 0 && max6 !== void 0) {
2678
+ return min6 + rand * (max6 - min6);
2679
2679
  }
2680
2680
  return rand;
2681
2681
  }
@@ -2887,16 +2887,16 @@ function median2(id) {
2887
2887
  function mode2(id) {
2888
2888
  const frequency = /* @__PURE__ */ new Map();
2889
2889
  let maxFreq = 0;
2890
- let mode4 = id[0];
2890
+ let mode5 = id[0];
2891
2891
  for (const val of id) {
2892
2892
  const freq = (frequency.get(val) || 0) + 1;
2893
2893
  frequency.set(val, freq);
2894
2894
  if (freq > maxFreq) {
2895
2895
  maxFreq = freq;
2896
- mode4 = val;
2896
+ mode5 = val;
2897
2897
  }
2898
2898
  }
2899
- return mode4;
2899
+ return mode5;
2900
2900
  }
2901
2901
  function stdev2(id) {
2902
2902
  const mean = avg2(id);
@@ -5147,21 +5147,45 @@ var ta_series_exports = {};
5147
5147
  __export(ta_series_exports, {
5148
5148
  alma: () => alma2,
5149
5149
  atr: () => atr2,
5150
+ barssince: () => barssince2,
5150
5151
  bb: () => bb2,
5152
+ bbw: () => bbw2,
5151
5153
  cci: () => cci2,
5152
5154
  change: () => change2,
5155
+ cmo: () => cmo2,
5156
+ cog: () => cog2,
5157
+ correlation: () => correlation2,
5153
5158
  cross: () => cross2,
5154
5159
  crossover: () => crossover2,
5155
5160
  crossunder: () => crossunder2,
5156
5161
  cum: () => cum2,
5162
+ dev: () => dev2,
5163
+ dmi: () => dmi2,
5157
5164
  ema: () => ema2,
5158
5165
  falling: () => falling2,
5159
5166
  highest: () => highest2,
5167
+ highestbars: () => highestbars2,
5168
+ hma: () => hma2,
5160
5169
  ichimoku: () => ichimoku2,
5170
+ kc: () => kc2,
5171
+ kcw: () => kcw2,
5161
5172
  linreg: () => linreg2,
5162
5173
  lowest: () => lowest2,
5174
+ lowestbars: () => lowestbars2,
5163
5175
  macd: () => macd2,
5176
+ max: () => max5,
5177
+ median: () => median4,
5178
+ mfi: () => mfi2,
5179
+ min: () => min5,
5180
+ mode: () => mode4,
5164
5181
  mom: () => mom2,
5182
+ percentile_linear_interpolation: () => percentile_linear_interpolation3,
5183
+ percentile_nearest_rank: () => percentile_nearest_rank3,
5184
+ percentrank: () => percentrank3,
5185
+ pivothigh: () => pivothigh2,
5186
+ pivotlow: () => pivotlow2,
5187
+ range: () => range3,
5188
+ rci: () => rci2,
5165
5189
  rising: () => rising2,
5166
5190
  rma: () => rma2,
5167
5191
  roc: () => roc2,
@@ -5171,11 +5195,16 @@ __export(ta_series_exports, {
5171
5195
  stdev: () => stdev3,
5172
5196
  stoch: () => stoch2,
5173
5197
  supertrend: () => supertrend2,
5198
+ swma: () => swma2,
5174
5199
  ta: () => ta,
5175
5200
  tr: () => tr2,
5201
+ tsi: () => tsi2,
5202
+ valuewhen: () => valuewhen2,
5203
+ variance: () => variance3,
5176
5204
  vwap: () => vwap2,
5177
5205
  vwma: () => vwma2,
5178
5206
  wma: () => wma2,
5207
+ wpr: () => wpr2,
5179
5208
  zigzag: () => zigzag2
5180
5209
  });
5181
5210
  function sma2(source, length2) {
@@ -5407,11 +5436,174 @@ function cci2(source, length2) {
5407
5436
  const result = cci(sourceValues, length2);
5408
5437
  return Series.fromArray(bars, result);
5409
5438
  }
5410
- function sar2(bars, start = 0.02, inc = 0.02, max5 = 0.2) {
5439
+ function sar2(bars, start = 0.02, inc = 0.02, max6 = 0.2) {
5411
5440
  const high = bars.map((b2) => b2.high);
5412
5441
  const low = bars.map((b2) => b2.low);
5413
5442
  const close = bars.map((b2) => b2.close);
5414
- const result = sar(start, inc, max5, high, low, close);
5443
+ const result = sar(start, inc, max6, high, low, close);
5444
+ return Series.fromArray(bars, result);
5445
+ }
5446
+ function dev2(source, length2) {
5447
+ const bars = source.bars;
5448
+ const result = dev(source.toArray(), length2);
5449
+ return Series.fromArray(bars, result);
5450
+ }
5451
+ function variance3(source, length2, biased = true) {
5452
+ const bars = source.bars;
5453
+ const result = variance(source.toArray(), length2, biased);
5454
+ return Series.fromArray(bars, result);
5455
+ }
5456
+ function median4(source, length2) {
5457
+ const bars = source.bars;
5458
+ const result = median(source.toArray(), length2);
5459
+ return Series.fromArray(bars, result);
5460
+ }
5461
+ function swma2(source) {
5462
+ const bars = source.bars;
5463
+ const result = swma(source.toArray());
5464
+ return Series.fromArray(bars, result);
5465
+ }
5466
+ function correlation2(source1, source2, length2) {
5467
+ const bars = source1.bars;
5468
+ const result = correlation(source1.toArray(), source2.toArray(), length2);
5469
+ return Series.fromArray(bars, result);
5470
+ }
5471
+ function percentrank3(source, length2) {
5472
+ const bars = source.bars;
5473
+ const result = percentrank(source.toArray(), length2);
5474
+ return Series.fromArray(bars, result);
5475
+ }
5476
+ function mfi2(source, length2, volume) {
5477
+ const bars = source.bars;
5478
+ const result = mfi(source.toArray(), length2, volume.toArray());
5479
+ return Series.fromArray(bars, result);
5480
+ }
5481
+ function hma2(source, length2) {
5482
+ const bars = source.bars;
5483
+ const result = hma(source.toArray(), length2);
5484
+ return Series.fromArray(bars, result);
5485
+ }
5486
+ function pivothigh2(source, leftbars, rightbars) {
5487
+ const bars = source.bars;
5488
+ const result = pivothigh(source.toArray(), leftbars, rightbars);
5489
+ return Series.fromArray(bars, result);
5490
+ }
5491
+ function pivotlow2(source, leftbars, rightbars) {
5492
+ const bars = source.bars;
5493
+ const result = pivotlow(source.toArray(), leftbars, rightbars);
5494
+ return Series.fromArray(bars, result);
5495
+ }
5496
+ function barssince2(condition) {
5497
+ const bars = condition.bars;
5498
+ const boolValues = condition.toArray().map((v) => v === 1);
5499
+ const result = barssince(boolValues);
5500
+ return Series.fromArray(bars, result);
5501
+ }
5502
+ function valuewhen2(condition, source, occurrence) {
5503
+ const bars = condition.bars;
5504
+ const boolValues = condition.toArray().map((v) => v === 1);
5505
+ const result = valuewhen(boolValues, source.toArray(), occurrence);
5506
+ return Series.fromArray(bars, result);
5507
+ }
5508
+ function dmi2(bars, diLength, adxSmoothing) {
5509
+ const high = bars.map((b2) => b2.high);
5510
+ const low = bars.map((b2) => b2.low);
5511
+ const close = bars.map((b2) => b2.close);
5512
+ const [plusDI, minusDI, adx] = dmi(diLength, adxSmoothing, high, low, close);
5513
+ return [
5514
+ Series.fromArray(bars, plusDI),
5515
+ Series.fromArray(bars, minusDI),
5516
+ Series.fromArray(bars, adx)
5517
+ ];
5518
+ }
5519
+ function tsi2(source, shortLength, longLength) {
5520
+ const bars = source.bars;
5521
+ const result = tsi(source.toArray(), shortLength, longLength);
5522
+ return Series.fromArray(bars, result);
5523
+ }
5524
+ function cmo2(source, length2) {
5525
+ const bars = source.bars;
5526
+ const result = cmo(source.toArray(), length2);
5527
+ return Series.fromArray(bars, result);
5528
+ }
5529
+ function kc2(bars, source, length2, mult2, useTrueRange = true) {
5530
+ const high = bars.map((b2) => b2.high);
5531
+ const low = bars.map((b2) => b2.low);
5532
+ const close = bars.map((b2) => b2.close);
5533
+ const [middle, upper2, lower2] = kc(source.toArray(), length2, mult2, useTrueRange, high, low, close);
5534
+ return [
5535
+ Series.fromArray(bars, middle),
5536
+ Series.fromArray(bars, upper2),
5537
+ Series.fromArray(bars, lower2)
5538
+ ];
5539
+ }
5540
+ function bbw2(source, length2, mult2) {
5541
+ const bars = source.bars;
5542
+ const result = bbw(source.toArray(), length2, mult2);
5543
+ return Series.fromArray(bars, result);
5544
+ }
5545
+ function wpr2(bars, length2 = 14) {
5546
+ const high = bars.map((b2) => b2.high);
5547
+ const low = bars.map((b2) => b2.low);
5548
+ const close = bars.map((b2) => b2.close);
5549
+ const result = wpr(high, low, close, length2);
5550
+ return Series.fromArray(bars, result);
5551
+ }
5552
+ function kcw2(bars, source, length2 = 20, mult2 = 2, useTrueRange = true) {
5553
+ const high = bars.map((b2) => b2.high);
5554
+ const low = bars.map((b2) => b2.low);
5555
+ const close = bars.map((b2) => b2.close);
5556
+ const result = kcw(source.toArray(), length2, mult2, useTrueRange, high, low, close);
5557
+ return Series.fromArray(bars, result);
5558
+ }
5559
+ function range3(high, low) {
5560
+ const bars = high.bars;
5561
+ const result = range(high.toArray(), low.toArray());
5562
+ return Series.fromArray(bars, result);
5563
+ }
5564
+ function highestbars2(source, length2) {
5565
+ const bars = source.bars;
5566
+ const result = highestbars(source.toArray(), length2);
5567
+ return Series.fromArray(bars, result);
5568
+ }
5569
+ function lowestbars2(source, length2) {
5570
+ const bars = source.bars;
5571
+ const result = lowestbars(source.toArray(), length2);
5572
+ return Series.fromArray(bars, result);
5573
+ }
5574
+ function max5(source1, source2) {
5575
+ const bars = source1.bars;
5576
+ const result = max(source1.toArray(), source2.toArray());
5577
+ return Series.fromArray(bars, result);
5578
+ }
5579
+ function min5(source1, source2) {
5580
+ const bars = source1.bars;
5581
+ const result = min(source1.toArray(), source2.toArray());
5582
+ return Series.fromArray(bars, result);
5583
+ }
5584
+ function cog2(source, length2 = 10) {
5585
+ const bars = source.bars;
5586
+ const result = cog(source.toArray(), length2);
5587
+ return Series.fromArray(bars, result);
5588
+ }
5589
+ function mode4(source, length2) {
5590
+ const bars = source.bars;
5591
+ const result = mode(source.toArray(), length2);
5592
+ return Series.fromArray(bars, result);
5593
+ }
5594
+ function percentile_linear_interpolation3(source, length2, percentage) {
5595
+ const bars = source.bars;
5596
+ const result = percentile_linear_interpolation(source.toArray(), length2, percentage);
5597
+ return Series.fromArray(bars, result);
5598
+ }
5599
+ function percentile_nearest_rank3(source, length2, percentage) {
5600
+ const bars = source.bars;
5601
+ const result = percentile_nearest_rank(source.toArray(), length2, percentage);
5602
+ return Series.fromArray(bars, result);
5603
+ }
5604
+ function rci2(source, length2) {
5605
+ const bars = source.bars;
5606
+ const result = rci(source.toArray(), length2);
5415
5607
  return Series.fromArray(bars, result);
5416
5608
  }
5417
5609
  var ta = {
@@ -5445,7 +5637,36 @@ var ta = {
5445
5637
  alma: alma2,
5446
5638
  zigzag: zigzag2,
5447
5639
  cci: cci2,
5448
- sar: sar2
5640
+ sar: sar2,
5641
+ dev: dev2,
5642
+ variance: variance3,
5643
+ median: median4,
5644
+ swma: swma2,
5645
+ correlation: correlation2,
5646
+ percentrank: percentrank3,
5647
+ mfi: mfi2,
5648
+ hma: hma2,
5649
+ pivothigh: pivothigh2,
5650
+ pivotlow: pivotlow2,
5651
+ barssince: barssince2,
5652
+ valuewhen: valuewhen2,
5653
+ dmi: dmi2,
5654
+ tsi: tsi2,
5655
+ cmo: cmo2,
5656
+ kc: kc2,
5657
+ bbw: bbw2,
5658
+ wpr: wpr2,
5659
+ kcw: kcw2,
5660
+ range: range3,
5661
+ highestbars: highestbars2,
5662
+ lowestbars: lowestbars2,
5663
+ max: max5,
5664
+ min: min5,
5665
+ cog: cog2,
5666
+ mode: mode4,
5667
+ percentile_linear_interpolation: percentile_linear_interpolation3,
5668
+ percentile_nearest_rank: percentile_nearest_rank3,
5669
+ rci: rci2
5449
5670
  };
5450
5671
 
5451
5672
  // src/utils/index.ts
@@ -5660,9 +5881,9 @@ var ZigZag = class {
5660
5881
  return true;
5661
5882
  }
5662
5883
  } else {
5663
- const dev2 = this.calcDev(last2.end.price, point.price);
5884
+ const dev3 = this.calcDev(last2.end.price, point.price);
5664
5885
  const threshold = this.settings.devThreshold;
5665
- const meetsThreshold = last2.isHigh ? dev2 <= -threshold : dev2 >= threshold;
5886
+ const meetsThreshold = last2.isHigh ? dev3 <= -threshold : dev3 >= threshold;
5666
5887
  if (meetsThreshold) {
5667
5888
  this.pivots.push({
5668
5889
  isHigh,
@@ -6393,7 +6614,7 @@ var SimpleInputAdapter = class {
6393
6614
  };
6394
6615
 
6395
6616
  // src/index.ts
6396
- var VERSION = "0.3.0";
6617
+ var VERSION = "0.2.1";
6397
6618
  var info = {
6398
6619
  name: "OakScriptJS",
6399
6620
  version: VERSION,
@@ -31,6 +31,35 @@ export declare function alma(source: Series, length?: number, offset?: number, s
31
31
  export declare function zigzag(bars: Bar[], deviation?: number, depth?: number, backstep?: number): [Series, Series, Series];
32
32
  export declare function cci(source: Series, length: number): Series;
33
33
  export declare function sar(bars: Bar[], start?: number, inc?: number, max?: number): Series;
34
+ export declare function dev(source: Series, length: number): Series;
35
+ export declare function variance(source: Series, length: number, biased?: boolean): Series;
36
+ export declare function median(source: Series, length: number): Series;
37
+ export declare function swma(source: Series): Series;
38
+ export declare function correlation(source1: Series, source2: Series, length: number): Series;
39
+ export declare function percentrank(source: Series, length: number): Series;
40
+ export declare function mfi(source: Series, length: number, volume: Series): Series;
41
+ export declare function hma(source: Series, length: number): Series;
42
+ export declare function pivothigh(source: Series, leftbars: number, rightbars: number): Series;
43
+ export declare function pivotlow(source: Series, leftbars: number, rightbars: number): Series;
44
+ export declare function barssince(condition: Series): Series;
45
+ export declare function valuewhen(condition: Series, source: Series, occurrence: number): Series;
46
+ export declare function dmi(bars: Bar[], diLength: number, adxSmoothing: number): [Series, Series, Series];
47
+ export declare function tsi(source: Series, shortLength: number, longLength: number): Series;
48
+ export declare function cmo(source: Series, length: number): Series;
49
+ export declare function kc(bars: Bar[], source: Series, length: number, mult: number, useTrueRange?: boolean): [Series, Series, Series];
50
+ export declare function bbw(source: Series, length: number, mult: number): Series;
51
+ export declare function wpr(bars: Bar[], length?: number): Series;
52
+ export declare function kcw(bars: Bar[], source: Series, length?: number, mult?: number, useTrueRange?: boolean): Series;
53
+ export declare function range(high: Series, low: Series): Series;
54
+ export declare function highestbars(source: Series, length: number): Series;
55
+ export declare function lowestbars(source: Series, length: number): Series;
56
+ export declare function max(source1: Series, source2: Series): Series;
57
+ export declare function min(source1: Series, source2: Series): Series;
58
+ export declare function cog(source: Series, length?: number): Series;
59
+ export declare function mode(source: Series, length: number): Series;
60
+ export declare function percentile_linear_interpolation(source: Series, length: number, percentage: number): Series;
61
+ export declare function percentile_nearest_rank(source: Series, length: number, percentage: number): Series;
62
+ export declare function rci(source: Series, length: number): Series;
34
63
  export declare const ta: {
35
64
  sma: typeof sma;
36
65
  ema: typeof ema;
@@ -63,5 +92,34 @@ export declare const ta: {
63
92
  zigzag: typeof zigzag;
64
93
  cci: typeof cci;
65
94
  sar: typeof sar;
95
+ dev: typeof dev;
96
+ variance: typeof variance;
97
+ median: typeof median;
98
+ swma: typeof swma;
99
+ correlation: typeof correlation;
100
+ percentrank: typeof percentrank;
101
+ mfi: typeof mfi;
102
+ hma: typeof hma;
103
+ pivothigh: typeof pivothigh;
104
+ pivotlow: typeof pivotlow;
105
+ barssince: typeof barssince;
106
+ valuewhen: typeof valuewhen;
107
+ dmi: typeof dmi;
108
+ tsi: typeof tsi;
109
+ cmo: typeof cmo;
110
+ kc: typeof kc;
111
+ bbw: typeof bbw;
112
+ wpr: typeof wpr;
113
+ kcw: typeof kcw;
114
+ range: typeof range;
115
+ highestbars: typeof highestbars;
116
+ lowestbars: typeof lowestbars;
117
+ max: typeof max;
118
+ min: typeof min;
119
+ cog: typeof cog;
120
+ mode: typeof mode;
121
+ percentile_linear_interpolation: typeof percentile_linear_interpolation;
122
+ percentile_nearest_rank: typeof percentile_nearest_rank;
123
+ rci: typeof rci;
66
124
  };
67
125
  //# sourceMappingURL=ta-series.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ta-series.d.ts","sourceRoot":"","sources":["../src/ta-series.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,E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EAAE,MAAM,GAAG,MAAM,CAI1G;AASD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAIlG;AAQD,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAI1D;AAGD,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Dd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oakscriptjs",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "PineScript v6 compatible technical analysis library for JavaScript/TypeScript",
6
6
  "main": "dist/index.js",