ohlcv-indicators 3.2.5 → 3.2.6
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.
|
@@ -3243,7 +3243,7 @@ var OHLCV_INDICATORS;
|
|
|
3243
3243
|
if (0 === e) return !0;
|
|
3244
3244
|
var I = s.candleVectors, R = I.bodyVectors, C = I.lookBackVectors, D = I.bodyInstance, V = null, B = c.open[e], N = c.close[e], L = We(N, B);
|
|
3245
3245
|
// Update instances with current absolute values
|
|
3246
|
-
D.update(L, f);
|
|
3246
|
+
D.update(Math.abs(L), f);
|
|
3247
3247
|
try {
|
|
3248
3248
|
V = D.getResult();
|
|
3249
3249
|
} catch (t) {
|
|
@@ -3838,9 +3838,9 @@ var OHLCV_INDICATORS;
|
|
|
3838
3838
|
}, {
|
|
3839
3839
|
key: "candleVectors",
|
|
3840
3840
|
value: function() {
|
|
3841
|
-
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] :
|
|
3841
|
+
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 200, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
3842
3842
|
if (i(this), "number" != typeof t || t <= 0) throw new Error('"size" must be a positive number greater than 0 in candleVectors.');
|
|
3843
|
-
var r = e.stdDev, n = void 0 === r ?
|
|
3843
|
+
var r = e.stdDev, n = void 0 === r ? 1 : r, o = e.lag, a = void 0 === o ? 0 : o, u = e.scale, l = void 0 === u ? .05 : u, c = e.patternSize, s = void 0 === c ? 1 : c, f = e.autoMinMax, h = void 0 !== f && f;
|
|
3844
3844
|
if ("number" != typeof n || n <= 0) throw new Error('"stdDev" must be a positive number greater than 0 in candleVectors.');
|
|
3845
3845
|
if ("number" == typeof l && !Nr.includes(l)) throw new Error('"scale" value in candleVectors must be any of the following numbers: '.concat(Nr.join(", ")));
|
|
3846
3846
|
if ("number" != typeof s || !Number.isInteger(s) || s < 1) throw new Error('"patternSize" value in candleVectors must be an integer greater than 0.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ohlcv-indicators",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.6",
|
|
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",
|
|
@@ -33,6 +33,11 @@ export const classifyBoll = (value, bollingerBands, scale = 0.05, autoMinMax = f
|
|
|
33
33
|
const rangeValue = (absValue - lower) / (upper - lower)
|
|
34
34
|
let magnitude = calcMagnitude(rangeValue, scale)
|
|
35
35
|
|
|
36
|
+
if(magnitude === 0)
|
|
37
|
+
{
|
|
38
|
+
return (positive) ? 0.01 : -0.01
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
if(autoMinMax)
|
|
37
42
|
{
|
|
38
43
|
return positive ? Math.min(magnitude, 1) : Math.max(-magnitude, -1)
|