ohlcv-indicators 3.3.1 → 3.3.2

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.3.1",
3
+ "version": "3.3.2",
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",
@@ -26,8 +26,7 @@ export const movingAverages = (main, index, indicatorName, size, { target, diff
26
26
 
27
27
  // Create the main moving average instance.
28
28
  instances[keyName] = {
29
- maInstance: new indicatorClasses[indicatorName](size),
30
- arrayChunk: {[diffKeyName]: []}
29
+ maInstance: new indicatorClasses[indicatorName](size)
31
30
  };
32
31
 
33
32
  verticalOhlcv[keyName] = [...nullArray];
@@ -64,7 +63,7 @@ export const movingAverages = (main, index, indicatorName, size, { target, diff
64
63
 
65
64
  // Retrieve the current price value.
66
65
  const value = verticalOhlcv[target][index];
67
- const { maInstance, diffInstance, arrayChunk } = instances[keyName];
66
+ const { maInstance, diffInstance } = instances[keyName];
68
67
 
69
68
  // Update the moving average instance.
70
69
  maInstance.update(value, lastIndexReplace);
@@ -83,7 +82,6 @@ export const movingAverages = (main, index, indicatorName, size, { target, diff
83
82
  for (const targetKey of diff.targets) {
84
83
  // Compute diffValue only if we have a valid MA value.
85
84
  let diffValue = null;
86
- let zScore = null
87
85
  if (currMa !== null && typeof currMa === 'number') {
88
86
  diffValue = verticalOhlcv[targetKey][index] - currMa;
89
87
  }
@@ -91,7 +89,6 @@ export const movingAverages = (main, index, indicatorName, size, { target, diff
91
89
  // Update the diff indicator only if diffValue is a valid number.
92
90
  if (diffValue !== null && typeof diffValue === 'number') {
93
91
  diffInstance.update(Math.abs(diffValue), lastIndexReplace);
94
- zScore = calcZScore(arrayChunk, diffKeyName, diff.size, diffValue, lastIndexReplace)
95
92
  }
96
93
 
97
94
  let diffBoll = null;
@@ -105,7 +102,7 @@ export const movingAverages = (main, index, indicatorName, size, { target, diff
105
102
  main.pushToMain({
106
103
  index,
107
104
  key: `${diffKeyName}_${targetKey}`,
108
- value: zScore
105
+ value: classified
109
106
  });
110
107
  }
111
108
  }