ohlcv-indicators 3.5.50 → 3.5.51
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 +1 -1
- package/src/studies/findCrosses.js +3 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ohlcv-indicators",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.51",
|
|
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",
|
|
@@ -132,7 +132,7 @@ class CrossInstance {
|
|
|
132
132
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
export const crossPairs = (main, index, crossPairsList
|
|
135
|
+
export const crossPairs = (main, index, crossPairsList) => {
|
|
136
136
|
|
|
137
137
|
const {verticalOhlcv, verticalOhlcvTempCols, instances, len} = main
|
|
138
138
|
|
|
@@ -165,11 +165,6 @@ export const crossPairs = (main, index, crossPairsList, {limit, oneHot}) => {
|
|
|
165
165
|
const crossArrType = 'Int16Array'
|
|
166
166
|
|
|
167
167
|
verticalOhlcv[crossName] = buildArray(crossArrType, len)
|
|
168
|
-
|
|
169
|
-
if(oneHot)
|
|
170
|
-
{
|
|
171
|
-
verticalOhlcv[`one_hot_${crossName}`] = buildArray('Array', len)
|
|
172
|
-
}
|
|
173
168
|
|
|
174
169
|
} else if(index + 1 === len) {
|
|
175
170
|
// sanity checks
|
|
@@ -181,7 +176,7 @@ export const crossPairs = (main, index, crossPairsList, {limit, oneHot}) => {
|
|
|
181
176
|
}
|
|
182
177
|
}
|
|
183
178
|
|
|
184
|
-
if (fast !==
|
|
179
|
+
if (fast !== 'price' && !verticalOhlcv.hasOwnProperty(fast)) return
|
|
185
180
|
if (!verticalOhlcv.hasOwnProperty(slow)) return
|
|
186
181
|
|
|
187
182
|
const {run} = instances.crossPairs[crossName]
|
|
@@ -202,25 +197,9 @@ export const crossPairs = (main, index, crossPairsList, {limit, oneHot}) => {
|
|
|
202
197
|
run.update(index, { fast: fastVal, slow: slowVal })
|
|
203
198
|
}
|
|
204
199
|
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
const value = rawValue//Math.max(-limit, Math.min(limit, rawValue))
|
|
208
|
-
|
|
200
|
+
const value = run.getResult()
|
|
209
201
|
main.pushToMain({index, key: crossName, value})
|
|
210
202
|
|
|
211
|
-
if(oneHot)
|
|
212
|
-
{
|
|
213
|
-
// clamp _just_ for the one-hot index
|
|
214
|
-
const clamped = Math.max(-limit, Math.min(limit, rawValue));
|
|
215
|
-
const oneHotIdx = clamped + limit;
|
|
216
|
-
const oneHotSize = 2 * limit + 1;
|
|
217
|
-
main.pushToMain({
|
|
218
|
-
index,
|
|
219
|
-
key: `one_hot_${crossName}`,
|
|
220
|
-
value: oneHotEncode(oneHotIdx, oneHotSize)
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
203
|
}
|
|
225
204
|
|
|
226
205
|
return true
|