ohlcv-indicators 3.3.2 → 3.3.5
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/dist/ohlcv-indicators.min.js +1731 -1879
- package/index.js +170 -292
- package/package.json +1 -3
- package/src/core-functions/mainLoop.js +85 -0
- package/src/core-functions/pushToMain.js +15 -0
- package/src/moving-averages/bollingerBands.js +26 -32
- package/src/moving-averages/donchianChannel.js +31 -36
- package/src/moving-averages/macd.js +30 -16
- package/src/moving-averages/movingAverages.js +15 -129
- package/src/moving-averages/relativeVolume.js +20 -14
- package/src/oscillators/rsi.js +21 -25
- package/src/oscillators/volumeOscillator.js +20 -19
- package/src/studies/dateTime.js +22 -20
- package/src/studies/findCrosses.js +17 -17
- package/src/studies/lag.js +22 -13
- package/src/studies/scaler.js +112 -0
- package/src/utilities/assignTypes.js +39 -0
- package/src/utilities/dateUtilities.js +79 -0
- package/src/utilities/numberUtilities.js +51 -10
- package/src/utilities/precisionMultiplier.js +24 -0
- package/src/utilities/validators.js +77 -8
- package/src/utilities/verticalToHorizontal.js +30 -0
- package/src/studies/candleVectors.js +0 -121
- package/src/studies/priceVariations.js +0 -23
- package/src/utilities/classification.js +0 -75
- package/src/utilities/dataParsingUtilities.js +0 -32
- package/src/utilities/parsing-utilities.js +0 -189
- package/src/utilities/pushToMain.js +0 -63
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
export const pushToMain = ({main, index, key, value}) => {
|
|
2
|
-
|
|
3
|
-
const {precision, priceBased, minMaxRanges, verticalOhlcv, autoMinMaxKeys, precisionMultiplier} = main
|
|
4
|
-
|
|
5
|
-
if(value === null || typeof value === 'undefined')
|
|
6
|
-
{
|
|
7
|
-
main.invalidValueIndex = index //do not use let for main.invalidValueIndex
|
|
8
|
-
|
|
9
|
-
for(const k of Object.keys(minMaxRanges))
|
|
10
|
-
{
|
|
11
|
-
minMaxRanges[k] = {min: Infinity, max: -Infinity}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
verticalOhlcv[key][index] = null
|
|
15
|
-
return false
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
verticalOhlcv[key][index] = value
|
|
19
|
-
|
|
20
|
-
if(typeof value === 'number' && !key.includes('_x_'))
|
|
21
|
-
{
|
|
22
|
-
const keyInAutoMinMax = autoMinMaxKeys.includes(key)
|
|
23
|
-
|
|
24
|
-
if(key.includes('_diff_') && keyInAutoMinMax)
|
|
25
|
-
{
|
|
26
|
-
if(!minMaxRanges.hasOwnProperty(key) || (minMaxRanges[key].min === Infinity || minMaxRanges[key].max === -Infinity))
|
|
27
|
-
{
|
|
28
|
-
minMaxRanges[key] = { min: -1, max: 1}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
else if(key.startsWith('candle_') && keyInAutoMinMax)
|
|
32
|
-
{
|
|
33
|
-
minMaxRanges[key] = { min: -3, max: 3}
|
|
34
|
-
}
|
|
35
|
-
else if(key.includes('_range_') && keyInAutoMinMax)
|
|
36
|
-
{
|
|
37
|
-
minMaxRanges[key] = { min: 0, max: 1 }
|
|
38
|
-
}
|
|
39
|
-
else if(key.startsWith('rsi_') && keyInAutoMinMax)
|
|
40
|
-
{
|
|
41
|
-
minMaxRanges[key] = { min: 0, max: 1 }
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
const newValue = (precision && priceBased.includes(key)) ? (value / precisionMultiplier) : value
|
|
45
|
-
|
|
46
|
-
if(!minMaxRanges.hasOwnProperty(key))
|
|
47
|
-
{
|
|
48
|
-
minMaxRanges[key] = { min: Infinity, max: -Infinity }
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if(newValue < minMaxRanges[key].min)
|
|
52
|
-
{
|
|
53
|
-
minMaxRanges[key].min = newValue
|
|
54
|
-
}
|
|
55
|
-
if(newValue > minMaxRanges[key].max)
|
|
56
|
-
{
|
|
57
|
-
minMaxRanges[key].max = newValue
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return true
|
|
63
|
-
}
|