ohlcv-indicators 3.2.2 → 3.2.5

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.
@@ -3566,31 +3566,31 @@ var OHLCV_INDICATORS;
3566
3566
  this.compute()), this.inputParams = [], this.pushToMain = function(t) {
3567
3567
  var e = t.index, n = t.key, o = t.value;
3568
3568
  return function(t) {
3569
- var e = t.main, r = t.index, n = t.key, o = t.value, i = e.precision, a = e.priceBased, u = e.minMaxRanges, l = e.verticalOhlcv, c = e.autoMinMaxKeys;
3570
- if (e.invalidValueIndex, null == o) for (var s in u) u[s] = {
3569
+ var e = t.main, r = t.index, n = t.key, o = t.value, i = e.precision, a = e.priceBased, u = e.minMaxRanges, l = e.verticalOhlcv, c = e.autoMinMaxKeys, s = e.precisionMultiplier;
3570
+ if (e.invalidValueIndex, null == o) for (var f in u) u[f] = {
3571
3571
  min: 1 / 0,
3572
3572
  max: -1 / 0
3573
3573
  };
3574
3574
  if (l[n][r] = o, "number" == typeof o && !n.includes("_x_")) {
3575
- var f = c.includes(n);
3576
- if (n.includes("_diff_") && f) u.hasOwnProperty(n) && u[n].min !== 1 / 0 && u[n].max !== -1 / 0 || (u[n] = {
3575
+ var h = c.includes(n);
3576
+ if (n.includes("_diff_") && h) u.hasOwnProperty(n) && u[n].min !== 1 / 0 && u[n].max !== -1 / 0 || (u[n] = {
3577
3577
  min: -1,
3578
3578
  max: 1
3579
- }); else if (n.startsWith("candle_") && f) u[n] = {
3579
+ }); else if (n.startsWith("candle_") && h) u[n] = {
3580
3580
  min: -1,
3581
3581
  max: 1
3582
- }; else if (n.includes("_range_") && f) u[n] = {
3582
+ }; else if (n.includes("_range_") && h) u[n] = {
3583
3583
  min: 0,
3584
3584
  max: 1
3585
- }; else if (n.startsWith("rsi_") && f) u[n] = {
3585
+ }; else if (n.startsWith("rsi_") && h) u[n] = {
3586
3586
  min: 0,
3587
3587
  max: 1
3588
3588
  }; else {
3589
- var h = i && a.includes(n) ? o / precisionMultiplier : o;
3589
+ var y = i && a.includes(n) ? o / s : o;
3590
3590
  u.hasOwnProperty(n) || (u[n] = {
3591
3591
  min: 1 / 0,
3592
3592
  max: -1 / 0
3593
- }), h < u[n].min && (u[n].min = h), h > u[n].max && (u[n].max = h);
3593
+ }), y < u[n].min && (u[n].min = y), y > u[n].max && (u[n].max = y);
3594
3594
  }
3595
3595
  }
3596
3596
  return !0;
package/index.js CHANGED
@@ -424,14 +424,14 @@ export default class OHLCV_INDICATORS {
424
424
  }
425
425
 
426
426
 
427
- candleVectors(size = 20, options = {}) {
427
+ candleVectors(size = 200, options = {}) {
428
428
  isAlreadyComputed(this);
429
429
 
430
430
  if (typeof size !== 'number' || size <= 0) {
431
431
  throw new Error('"size" must be a positive number greater than 0 in candleVectors.');
432
432
  }
433
433
 
434
- const { stdDev = 0.5, lag = 0, scale = 0.05, patternSize = 1, autoMinMax = false } = options;
434
+ const { stdDev = 1, lag = 0, scale = 0.05, patternSize = 1, autoMinMax = false } = options;
435
435
 
436
436
 
437
437
  if (typeof stdDev !== 'number' || stdDev <= 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ohlcv-indicators",
3
- "version": "3.2.2",
3
+ "version": "3.2.5",
4
4
  "description": "A JavaScript library featuring optimized trading indicators for OHLCV arrays [{open, high, low, close, value}]. This library is optimized for backtesting and trading bot development.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -96,7 +96,7 @@ export const candleVectors = (main, index, size, {stdDev, patternSize, lag, scal
96
96
  const bodySize = diff(currClose, currOpen)
97
97
 
98
98
  // Update instances with current absolute values
99
- bodyInstance.update(bodySize, lastIndexReplace)
99
+ bodyInstance.update(Math.abs(bodySize), lastIndexReplace)
100
100
 
101
101
  try {
102
102
  bodyBoll = bodyInstance.getResult()
@@ -1,6 +1,6 @@
1
1
  export const pushToMain = ({main, index, key, value}) => {
2
2
 
3
- const {precision, priceBased, minMaxRanges, verticalOhlcv, autoMinMaxKeys} = main
3
+ const {precision, priceBased, minMaxRanges, verticalOhlcv, autoMinMaxKeys, precisionMultiplier} = main
4
4
  let {invalidValueIndex } = main
5
5
 
6
6
  if(value === null || typeof value === 'undefined')