ohlcv-indicators 3.5.43 → 3.5.45
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ohlcv-indicators",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.45",
|
|
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",
|
|
@@ -65,8 +65,8 @@ export const vidya = (main, index, size, momentum, options = {}) => {
|
|
|
65
65
|
const vol = verticalOhlcv.volume[index];
|
|
66
66
|
const prevCross = index > 0 ? verticalOhlcv[keys.cross][index - 1] : 0;
|
|
67
67
|
|
|
68
|
-
const
|
|
69
|
-
const
|
|
68
|
+
const highestHigh = (inst.liquidity.high.length === liquidityLookback) ? Math.max(...inst.liquidity.high) : NaN
|
|
69
|
+
const lowestLow = (inst.liquidity.low.length === liquidityLookback) ? Math.min(...inst.liquidity.low) : NaN
|
|
70
70
|
|
|
71
71
|
// Compute ATR (Wilder's RMA)
|
|
72
72
|
if (index > 0) {
|
|
@@ -145,20 +145,16 @@ export const vidya = (main, index, size, momentum, options = {}) => {
|
|
|
145
145
|
const deltaPct = (inst.upVol - inst.downVol) / avgVol;
|
|
146
146
|
|
|
147
147
|
// Trend-based boundary (reset on crossover)
|
|
148
|
-
const trendValue = (
|
|
149
|
-
? (inst.isTrendUp ? lower : upper)
|
|
150
|
-
: NaN;
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
const trendValue = (inst.isTrendUp) ? lower : upper;
|
|
153
149
|
let liquidity = NaN
|
|
154
150
|
|
|
155
151
|
if(cross > 0)
|
|
156
152
|
{
|
|
157
|
-
liquidity =
|
|
153
|
+
liquidity = lowestLow
|
|
158
154
|
}
|
|
159
155
|
else if(cross < 0)
|
|
160
156
|
{
|
|
161
|
-
liquidity =
|
|
157
|
+
liquidity = highestHigh
|
|
162
158
|
}
|
|
163
159
|
|
|
164
160
|
// Push outputs
|
package/src/oscillators/rsi.js
CHANGED
|
@@ -6,7 +6,7 @@ export const rsi = (main, index, size, { target, lag, parser, prefix, minmax })
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
const { verticalOhlcv, instances } = main;
|
|
9
|
+
const { verticalOhlcv, instances, notNumberKeys } = main;
|
|
10
10
|
|
|
11
11
|
const suffix = target === defaultTarget ? '' : `_${target}`;
|
|
12
12
|
const rsiKey = `${prefix}rsi_${size}${suffix}`;
|
|
@@ -53,6 +53,7 @@ export const rsi = (main, index, size, { target, lag, parser, prefix, minmax })
|
|
|
53
53
|
for(const key of keyNames)
|
|
54
54
|
{
|
|
55
55
|
arrayTypes[key] = 'Float64Array'
|
|
56
|
+
notNumberKeys.add(key)
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
}
|
|
@@ -5,7 +5,7 @@ export const stochastic = (main, index, kPeriod, kSlowingPeriod, dPeriod, {minma
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
const { verticalOhlcv, instances,
|
|
8
|
+
const { verticalOhlcv, instances, notNumberKeys } = main;
|
|
9
9
|
|
|
10
10
|
const paramsKey = (kPeriod === 14 && kSlowingPeriod === 3 && dPeriod === 3) ? '' : `${kPeriod}_${kSlowingPeriod}_${dPeriod}`
|
|
11
11
|
const stochD = `${prefix}stoch_d${paramsKey}`;
|
|
@@ -48,6 +48,7 @@ export const stochastic = (main, index, kPeriod, kSlowingPeriod, dPeriod, {minma
|
|
|
48
48
|
for(const key of keyNames)
|
|
49
49
|
{
|
|
50
50
|
arrayTypes[key] = 'Float64Array'
|
|
51
|
+
notNumberKeys.add(key)
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
|