ohlcv-indicators 3.5.46 → 3.5.47

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.46",
3
+ "version": "3.5.47",
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",
@@ -147,18 +147,7 @@ export const crossPairs = (main, index, crossPairsList, {limit, oneHot}) => {
147
147
 
148
148
  const col = slow.toString()
149
149
  verticalOhlcvTempCols.add(col)
150
-
151
- let slowNumArrType = 'Int16Array'
152
-
153
- if(slow === 0 || slow === 1)
154
- {
155
- slowNumArrType = 'Uint8Array'
156
- } else if(slow >= -125 && slow <= 125)
157
- {
158
- slowNumArrType = 'Int8Array'
159
- }
160
-
161
- verticalOhlcv[col] = buildArray(slowNumArrType, len)
150
+ verticalOhlcv[col] = buildArray('Int16Array', len)
162
151
  }
163
152
 
164
153
  if(!instances.hasOwnProperty('crossPairs'))
@@ -220,15 +209,21 @@ export const crossPairs = (main, index, crossPairsList, {limit, oneHot}) => {
220
209
 
221
210
  const rawValue = run.getResult()
222
211
 
223
- const value = Math.max(-limit, Math.min(limit, rawValue))
212
+ const value = rawValue//Math.max(-limit, Math.min(limit, rawValue))
224
213
 
225
214
  main.pushToMain({index, key: crossName, value})
226
215
 
227
216
  if(oneHot)
228
217
  {
229
- const oneHotIdx = value + limit
230
- const oneHotSize = 2 * limit + 1
231
- main.pushToMain({index, key: `one_hot_${crossName}`, value: oneHotEncode(oneHotIdx, oneHotSize)})
218
+ // clamp _just_ for the one-hot index
219
+ const clamped = Math.max(-limit, Math.min(limit, rawValue));
220
+ const oneHotIdx = clamped + limit;
221
+ const oneHotSize = 2 * limit + 1;
222
+ main.pushToMain({
223
+ index,
224
+ key: `one_hot_${crossName}`,
225
+ value: oneHotEncode(oneHotIdx, oneHotSize)
226
+ });
232
227
  }
233
228
 
234
229
  }