ohlcv-indicators 3.2.1 → 3.2.3
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.
|
@@ -3211,9 +3211,6 @@ var OHLCV_INDICATORS;
|
|
|
3211
3211
|
return ce(t, e, u, l);
|
|
3212
3212
|
};
|
|
3213
3213
|
if (0 === e) {
|
|
3214
|
-
console.log({
|
|
3215
|
-
autoMinMax: l
|
|
3216
|
-
});
|
|
3217
3214
|
for (var y = t.nullArray, p = [ [ "close", "open" ], [ "close", "high" ], [ "close", "low" ], [ "open", "high" ], [ "open", "low" ], [ "high", "low" ] ], v = [ [ "open", "open" ], [ "high", "high" ], [ "low", "low" ], [ "close", "close" ] ].concat(p), d = [], b = {}, m = 0; m < i; m++) {
|
|
3218
3215
|
var g, w = Ke(v);
|
|
3219
3216
|
try {
|
|
@@ -3569,31 +3566,31 @@ var OHLCV_INDICATORS;
|
|
|
3569
3566
|
this.compute()), this.inputParams = [], this.pushToMain = function(t) {
|
|
3570
3567
|
var e = t.index, n = t.key, o = t.value;
|
|
3571
3568
|
return function(t) {
|
|
3572
|
-
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;
|
|
3573
|
-
if (e.invalidValueIndex, null == o) for (var
|
|
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] = {
|
|
3574
3571
|
min: 1 / 0,
|
|
3575
3572
|
max: -1 / 0
|
|
3576
3573
|
};
|
|
3577
3574
|
if (l[n][r] = o, "number" == typeof o && !n.includes("_x_")) {
|
|
3578
|
-
var
|
|
3579
|
-
if (n.includes("_diff_") &&
|
|
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] = {
|
|
3580
3577
|
min: -1,
|
|
3581
3578
|
max: 1
|
|
3582
|
-
}); else if (n.startsWith("candle_") &&
|
|
3579
|
+
}); else if (n.startsWith("candle_") && h) u[n] = {
|
|
3583
3580
|
min: -1,
|
|
3584
3581
|
max: 1
|
|
3585
|
-
}; else if (n.includes("_range_") &&
|
|
3582
|
+
}; else if (n.includes("_range_") && h) u[n] = {
|
|
3586
3583
|
min: 0,
|
|
3587
3584
|
max: 1
|
|
3588
|
-
}; else if (n.startsWith("rsi_") &&
|
|
3585
|
+
}; else if (n.startsWith("rsi_") && h) u[n] = {
|
|
3589
3586
|
min: 0,
|
|
3590
3587
|
max: 1
|
|
3591
3588
|
}; else {
|
|
3592
|
-
var
|
|
3589
|
+
var y = i && a.includes(n) ? o / s : o;
|
|
3593
3590
|
u.hasOwnProperty(n) || (u[n] = {
|
|
3594
3591
|
min: 1 / 0,
|
|
3595
3592
|
max: -1 / 0
|
|
3596
|
-
}),
|
|
3593
|
+
}), y < u[n].min && (u[n].min = y), y > u[n].max && (u[n].max = y);
|
|
3597
3594
|
}
|
|
3598
3595
|
}
|
|
3599
3596
|
return !0;
|
|
@@ -3774,13 +3771,13 @@ var OHLCV_INDICATORS;
|
|
|
3774
3771
|
value: function() {
|
|
3775
3772
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 20, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
|
|
3776
3773
|
if (i(this), !r || "object" !== Ir(r)) throw new Error('"options" must be an object in bollingerBands. eg: {target, height, range}');
|
|
3777
|
-
var n = r.target, o = void 0 === n ? "close" : n, a = r.height, u = void 0 !== a && a, l = r.range, c = void 0 === l ? [] : l, s = r.scale, f = void 0 === s ? null : s, h = r.lag, y = void 0 === h ? 0 : h, p = r.autoMinMax;
|
|
3774
|
+
var n = r.target, o = void 0 === n ? "close" : n, a = r.height, u = void 0 !== a && a, l = r.range, c = void 0 === l ? [] : l, s = r.scale, f = void 0 === s ? null : s, h = r.lag, y = void 0 === h ? 0 : h, p = r.autoMinMax, v = void 0 !== p && p;
|
|
3778
3775
|
// Validate size and times
|
|
3779
3776
|
if ("number" != typeof t || t <= 0) throw new Error('"size" must be a positive number in bollingerBands.');
|
|
3780
3777
|
if ("number" != typeof e || e <= 0) throw new Error('"stdDev" must be a positive number in bollingerBands.');
|
|
3781
3778
|
if (!Array.isArray(c)) throw new Error('If set, "range" must be a array of column names in bollingerBands.');
|
|
3782
|
-
if ("number" != typeof y) throw new Error('"lag" value
|
|
3783
|
-
if ("boolean" != typeof
|
|
3779
|
+
if ("number" != typeof y) throw new Error('"lag" value must be a number in bollingerBands.');
|
|
3780
|
+
if ("boolean" != typeof v) throw new Error('"autoMinMax" value in rsi must be a number in bollingerBands.');
|
|
3784
3781
|
if ("boolean" != typeof u) throw new Error('"height" must be a boolean in bollingerBands.');
|
|
3785
3782
|
if ("number" == typeof f && !Nr.includes(f)) throw new Error('"scale" value in bollingerBands must be any of the following numbers: '.concat(Nr.join(", ")));
|
|
3786
3783
|
return this.inputParams.push({
|
|
@@ -3791,7 +3788,7 @@ var OHLCV_INDICATORS;
|
|
|
3791
3788
|
scale: f,
|
|
3792
3789
|
range: c,
|
|
3793
3790
|
lag: y,
|
|
3794
|
-
autoMinMax:
|
|
3791
|
+
autoMinMax: v
|
|
3795
3792
|
} ]
|
|
3796
3793
|
}), this;
|
|
3797
3794
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ohlcv-indicators",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.3",
|
|
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",
|
|
@@ -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')
|