@vulcan-js/indicators 0.0.0
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/LICENSE +21 -0
- package/README.md +83 -0
- package/dist/index.d.ts +485 -0
- package/dist/index.js +683 -0
- package/dist/index.js.map +1 -0
- package/package.json +27 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present enpitsulin <enpitsulin@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# @vulcan-js/indicators
|
|
2
|
+
|
|
3
|
+
Technical analysis indicators for the [Vulcan](../../README.md) library, built on generator-based streaming with high-precision decimal arithmetic ([`dnum`](https://github.com/bpierre/dnum)).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @vulcan-js/indicators
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Every indicator is a generator function. Pass an iterable source and iterate over the results:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { collect } from '@vulcan-js/core'
|
|
17
|
+
import { sma } from '@vulcan-js/indicators'
|
|
18
|
+
|
|
19
|
+
const prices = [10, 11, 12, 13, 14, 15]
|
|
20
|
+
|
|
21
|
+
// Collect all results into an array
|
|
22
|
+
const results = collect(sma(prices, { period: 3 }))
|
|
23
|
+
|
|
24
|
+
// Or iterate lazily
|
|
25
|
+
for (const value of sma(prices, { period: 3 })) {
|
|
26
|
+
console.log(value) // Dnum tuple: [bigint, number]
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use `.create()` to get a stateful processor for real-time / streaming scenarios:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { rsi } from '@vulcan-js/indicators'
|
|
34
|
+
|
|
35
|
+
const process = rsi.create({ period: 14 })
|
|
36
|
+
|
|
37
|
+
process(100) // feed prices one by one
|
|
38
|
+
process(102)
|
|
39
|
+
process(98)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Supported Indicators
|
|
43
|
+
|
|
44
|
+
### Trend
|
|
45
|
+
|
|
46
|
+
| Indicator | Function | Alias |
|
|
47
|
+
| --- | --- | --- |
|
|
48
|
+
| Aroon Indicator | `aroon` | — |
|
|
49
|
+
| Balance of Power | `bop` | `balanceOfPower` |
|
|
50
|
+
| Chande Forecast Oscillator | `cfo` | `chandeForecastOscillator` |
|
|
51
|
+
| Commodity Channel Index | `cci` | `commodityChannelIndex` |
|
|
52
|
+
| Double Exponential Moving Average | `dema` | `doubleExponentialMovingAverage` |
|
|
53
|
+
| Exponential Moving Average | `ema` | `exponentialMovingAverage` |
|
|
54
|
+
| Mass Index | `mi` | `massIndex` |
|
|
55
|
+
| MACD | `macd` | `movingAverageConvergenceDivergence` |
|
|
56
|
+
| Moving Max | `mmax` | `movingMax` |
|
|
57
|
+
| Moving Min | `mmin` | `movingMin` |
|
|
58
|
+
| Moving Sum | `msum` | — |
|
|
59
|
+
| Rolling Moving Average | `rma` | `rollingMovingAverage` |
|
|
60
|
+
| Simple Moving Average | `sma` | `simpleMovingAverage` |
|
|
61
|
+
| Triangular Moving Average | `trima` | `triangularMovingAverage` |
|
|
62
|
+
|
|
63
|
+
### Momentum
|
|
64
|
+
|
|
65
|
+
| Indicator | Function | Alias |
|
|
66
|
+
| --- | --- | --- |
|
|
67
|
+
| Absolute Price Oscillator | `apo` | `absolutePriceOscillator` |
|
|
68
|
+
| Awesome Oscillator | `ao` | `awesomeOscillator` |
|
|
69
|
+
| Chaikin Oscillator | `cmo` | `chaikinOscillator` |
|
|
70
|
+
| Ichimoku Cloud | `ichimokuCloud` | — |
|
|
71
|
+
| Percentage Price Oscillator | `ppo` | `percentagePriceOscillator` |
|
|
72
|
+
| Relative Strength Index | `rsi` | `relativeStrengthIndex` |
|
|
73
|
+
| Stochastic Oscillator | `stoch` | `stochasticOscillator` |
|
|
74
|
+
|
|
75
|
+
### Volume
|
|
76
|
+
|
|
77
|
+
| Indicator | Function | Alias |
|
|
78
|
+
| --- | --- | --- |
|
|
79
|
+
| Accumulation/Distribution | `ad` | `accumulationDistribution` |
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
import * as _vulcan_js_core0 from "@vulcan-js/core";
|
|
2
|
+
import * as dnum from "dnum";
|
|
3
|
+
import { Dnum, Numberish } from "dnum";
|
|
4
|
+
|
|
5
|
+
//#region src/momentum/absolutePriceOscillator.d.ts
|
|
6
|
+
interface AbsolutePriceOscillatorOptions {
|
|
7
|
+
fastPeriod: number;
|
|
8
|
+
slowPeriod: number;
|
|
9
|
+
}
|
|
10
|
+
declare const defaultAbsolutePriceOscillatorOptions: AbsolutePriceOscillatorOptions;
|
|
11
|
+
declare const apo: _vulcan_js_core0.SignalGenerator<Numberish, dnum.Dnum, AbsolutePriceOscillatorOptions>;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/momentum/awesomeOscillator.d.ts
|
|
14
|
+
interface AwesomeOscillatorOptions {
|
|
15
|
+
fastPeriod: number;
|
|
16
|
+
slowPeriod: number;
|
|
17
|
+
}
|
|
18
|
+
declare const defaultAwesomeOscillatorOptions: AwesomeOscillatorOptions;
|
|
19
|
+
/**
|
|
20
|
+
* Awesome Oscillator (AO)
|
|
21
|
+
*
|
|
22
|
+
* AO = SMA(median, fastPeriod) - SMA(median, slowPeriod)
|
|
23
|
+
* Where median = (high + low) / 2
|
|
24
|
+
*/
|
|
25
|
+
declare const ao: _vulcan_js_core0.SignalGenerator<{
|
|
26
|
+
h: dnum.Numberish;
|
|
27
|
+
l: dnum.Numberish;
|
|
28
|
+
}, dnum.Dnum, AwesomeOscillatorOptions>;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/momentum/chaikinOscillator.d.ts
|
|
31
|
+
interface ChaikinOscillatorOptions {
|
|
32
|
+
fastPeriod: number;
|
|
33
|
+
slowPeriod: number;
|
|
34
|
+
}
|
|
35
|
+
declare const defaultChaikinOscillatorOptions: ChaikinOscillatorOptions;
|
|
36
|
+
/**
|
|
37
|
+
* The ChaikinOscillator function measures the momentum of the
|
|
38
|
+
* Accumulation/Distribution (A/D) using the Moving Average
|
|
39
|
+
* Convergence Divergence (MACD) formula. It takes the
|
|
40
|
+
* difference between fast and slow periods EMA of the A/D.
|
|
41
|
+
* Cross above the A/D line indicates bullish.
|
|
42
|
+
*
|
|
43
|
+
* CO = Ema(fastPeriod, AD) - Ema(slowPeriod, AD)
|
|
44
|
+
*/
|
|
45
|
+
declare const cmo: _vulcan_js_core0.SignalGenerator<{
|
|
46
|
+
h: dnum.Numberish;
|
|
47
|
+
l: dnum.Numberish;
|
|
48
|
+
c: dnum.Numberish;
|
|
49
|
+
v: dnum.Numberish;
|
|
50
|
+
}, dnum.Dnum, ChaikinOscillatorOptions>;
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/momentum/ichimokuCloud.d.ts
|
|
53
|
+
interface IchimokuCloudOptions {
|
|
54
|
+
/** Conversion line period */
|
|
55
|
+
conversionPeriod: number;
|
|
56
|
+
/** Base line period */
|
|
57
|
+
basePeriod: number;
|
|
58
|
+
/** Leading span B period */
|
|
59
|
+
leadingBPeriod: number;
|
|
60
|
+
}
|
|
61
|
+
declare const defaultIchimokuCloudOptions: IchimokuCloudOptions;
|
|
62
|
+
interface IchimokuCloudPoint {
|
|
63
|
+
conversion: Dnum;
|
|
64
|
+
base: Dnum;
|
|
65
|
+
leadingA: Dnum;
|
|
66
|
+
leadingB: Dnum;
|
|
67
|
+
lagging: Dnum;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Ichimoku Cloud (Ichimoku Kinko Hyo)
|
|
71
|
+
*
|
|
72
|
+
* Computes raw values for each component. Displacement (shifting
|
|
73
|
+
* Leading Spans forward and Lagging Span backward on the chart)
|
|
74
|
+
* is a presentation concern left to the consumer.
|
|
75
|
+
*
|
|
76
|
+
* - Conversion (Tenkan-sen): (highest high + lowest low) / 2 over conversionPeriod
|
|
77
|
+
* - Base (Kijun-sen): (highest high + lowest low) / 2 over basePeriod
|
|
78
|
+
* - Leading Span A (Senkou A): (conversion + base) / 2
|
|
79
|
+
* - Leading Span B (Senkou B): (highest high + lowest low) / 2 over leadingBPeriod
|
|
80
|
+
* - Lagging (Chikou): current close price
|
|
81
|
+
*/
|
|
82
|
+
declare const ichimokuCloud: _vulcan_js_core0.SignalGenerator<{
|
|
83
|
+
h: dnum.Numberish;
|
|
84
|
+
l: dnum.Numberish;
|
|
85
|
+
c: dnum.Numberish;
|
|
86
|
+
}, {
|
|
87
|
+
conversion: Dnum;
|
|
88
|
+
base: Dnum;
|
|
89
|
+
leadingA: Dnum;
|
|
90
|
+
leadingB: Dnum;
|
|
91
|
+
lagging: Dnum;
|
|
92
|
+
}, IchimokuCloudOptions>;
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/momentum/percentagePriceOscillator.d.ts
|
|
95
|
+
interface PercentagePriceOscillatorOptions {
|
|
96
|
+
fastPeriod: number;
|
|
97
|
+
slowPeriod: number;
|
|
98
|
+
signalPeriod: number;
|
|
99
|
+
}
|
|
100
|
+
declare const defaultPercentagePriceOscillatorOptions: PercentagePriceOscillatorOptions;
|
|
101
|
+
interface PercentagePriceOscillatorPoint {
|
|
102
|
+
ppo: Dnum;
|
|
103
|
+
signal: Dnum;
|
|
104
|
+
histogram: Dnum;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Percentage Price Oscillator (PPO)
|
|
108
|
+
*
|
|
109
|
+
* The Percentage Price Oscillator (PPO) is a momentum oscillator that measures the difference
|
|
110
|
+
* between two moving averages as a percentage of the slower moving average. It consists of three components:
|
|
111
|
+
* - PPO Line: ((Fast EMA - Slow EMA) / Slow EMA) * 100
|
|
112
|
+
* - Signal Line: EMA of the PPO line
|
|
113
|
+
* - Histogram: PPO - Signal
|
|
114
|
+
*
|
|
115
|
+
* Formula:
|
|
116
|
+
* - PPO = ((EMA(fastPeriod, prices) - EMA(slowPeriod, prices)) / EMA(slowPeriod, prices)) * 100
|
|
117
|
+
* - Signal = EMA(signalPeriod, PPO)
|
|
118
|
+
* - Histogram = PPO - Signal
|
|
119
|
+
*
|
|
120
|
+
* @param source - Iterable of price values
|
|
121
|
+
* @param options - Configuration options
|
|
122
|
+
* @param options.fastPeriod - Period for the fast EMA (default: 12)
|
|
123
|
+
* @param options.slowPeriod - Period for the slow EMA (default: 26)
|
|
124
|
+
* @param options.signalPeriod - Period for the signal EMA (default: 9)
|
|
125
|
+
* @returns Generator yielding PPO point objects
|
|
126
|
+
*/
|
|
127
|
+
declare const ppo: _vulcan_js_core0.SignalGenerator<Numberish, {
|
|
128
|
+
ppo: Dnum;
|
|
129
|
+
signal: Dnum;
|
|
130
|
+
histogram: Dnum;
|
|
131
|
+
}, PercentagePriceOscillatorOptions>;
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/momentum/relativeStrengthIndex.d.ts
|
|
134
|
+
interface RSIOptions {
|
|
135
|
+
period: number;
|
|
136
|
+
}
|
|
137
|
+
declare const defaultRSIOptions: RSIOptions;
|
|
138
|
+
/**
|
|
139
|
+
* Relative Strength Index (RSI). It is a momentum indicator that measures the magnitude of
|
|
140
|
+
* recent price changes to evaluate overbought and oversold conditions
|
|
141
|
+
* using the given window period.
|
|
142
|
+
*
|
|
143
|
+
* RS = Average Gain / Average Loss
|
|
144
|
+
*
|
|
145
|
+
* RSI = 100 - (100 / (1 + RS))
|
|
146
|
+
*/
|
|
147
|
+
declare const rsi: _vulcan_js_core0.SignalGenerator<Numberish, Dnum, RSIOptions>;
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/momentum/stochasticOscillator.d.ts
|
|
150
|
+
interface StochasticOscillatorOptions {
|
|
151
|
+
/** The %k period */
|
|
152
|
+
kPeriod: number;
|
|
153
|
+
/** The %k slowing period */
|
|
154
|
+
slowingPeriod: number;
|
|
155
|
+
/** The %d period */
|
|
156
|
+
dPeriod: number;
|
|
157
|
+
}
|
|
158
|
+
declare const defaultStochasticOscillatorOptions: StochasticOscillatorOptions;
|
|
159
|
+
interface StochPoint {
|
|
160
|
+
k: Dnum;
|
|
161
|
+
d: Dnum;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Stochastic Oscillator
|
|
165
|
+
*
|
|
166
|
+
* %K = ((Close - Lowest Low) / (Highest High - Lowest Low)) * 100
|
|
167
|
+
* %D = SMA(%K, dPeriod)
|
|
168
|
+
*/
|
|
169
|
+
declare const stoch: _vulcan_js_core0.SignalGenerator<{
|
|
170
|
+
h: dnum.Numberish;
|
|
171
|
+
l: dnum.Numberish;
|
|
172
|
+
c: dnum.Numberish;
|
|
173
|
+
}, {
|
|
174
|
+
k: Dnum;
|
|
175
|
+
d: Dnum;
|
|
176
|
+
}, StochasticOscillatorOptions>;
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/trend/aroon.d.ts
|
|
179
|
+
interface AroonOptions {
|
|
180
|
+
period: number;
|
|
181
|
+
}
|
|
182
|
+
declare const defaultAroonOptions: AroonOptions;
|
|
183
|
+
interface AroonPoint {
|
|
184
|
+
up: Dnum;
|
|
185
|
+
down: Dnum;
|
|
186
|
+
oscillator: Dnum;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Aroon Indicator
|
|
190
|
+
*
|
|
191
|
+
* Aroon Up = ((period - days since highest high) / period) * 100
|
|
192
|
+
* Aroon Down = ((period - days since lowest low) / period) * 100
|
|
193
|
+
* Oscillator = Aroon Up - Aroon Down
|
|
194
|
+
*/
|
|
195
|
+
declare const aroon: _vulcan_js_core0.SignalGenerator<{
|
|
196
|
+
h: dnum.Numberish;
|
|
197
|
+
l: dnum.Numberish;
|
|
198
|
+
}, {
|
|
199
|
+
up: Dnum;
|
|
200
|
+
down: Dnum;
|
|
201
|
+
oscillator: Dnum;
|
|
202
|
+
}, AroonOptions>;
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/trend/balanceOfPower.d.ts
|
|
205
|
+
declare const bop: _vulcan_js_core0.SignalGenerator<{
|
|
206
|
+
h: dnum.Numberish;
|
|
207
|
+
l: dnum.Numberish;
|
|
208
|
+
c: dnum.Numberish;
|
|
209
|
+
o: dnum.Numberish;
|
|
210
|
+
}, dnum.Dnum, Record<string, any>>;
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/trend/chandeForecastOscillator.d.ts
|
|
213
|
+
interface ChandeForecastOscillatorOptions {
|
|
214
|
+
/**
|
|
215
|
+
* The period for linear regression
|
|
216
|
+
* @default 14
|
|
217
|
+
*/
|
|
218
|
+
period: number;
|
|
219
|
+
}
|
|
220
|
+
declare const defaultCFOOptions: ChandeForecastOscillatorOptions;
|
|
221
|
+
/**
|
|
222
|
+
* Chande Forecast Oscillator (CFO)
|
|
223
|
+
*
|
|
224
|
+
* Measures the percentage difference between the actual close price and the
|
|
225
|
+
* n-period linear regression forecast price. Positive values indicate bullish
|
|
226
|
+
* momentum (price above forecast), negative values indicate bearish momentum.
|
|
227
|
+
*
|
|
228
|
+
* Formula: CFO = ((Close - Forecast) / Close) * 100
|
|
229
|
+
* Where: Forecast = Linear regression value at current point
|
|
230
|
+
*
|
|
231
|
+
* @param source - Iterable of price values
|
|
232
|
+
* @param options - Configuration options
|
|
233
|
+
* @param options.period - The period for linear regression (default: 14)
|
|
234
|
+
* @returns Generator yielding CFO values as percentages
|
|
235
|
+
*/
|
|
236
|
+
declare const cfo: _vulcan_js_core0.SignalGenerator<Numberish, Dnum, ChandeForecastOscillatorOptions>;
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region src/trend/commodityChannelIndex.d.ts
|
|
239
|
+
interface CommodityChannelIndexOptions {
|
|
240
|
+
/**
|
|
241
|
+
* The period for CCI calculation
|
|
242
|
+
* @default 20
|
|
243
|
+
*/
|
|
244
|
+
period: number;
|
|
245
|
+
}
|
|
246
|
+
declare const defaultCCIOptions: CommodityChannelIndexOptions;
|
|
247
|
+
/**
|
|
248
|
+
* Commodity Channel Index (CCI)
|
|
249
|
+
*
|
|
250
|
+
* Developed by Donald Lambert in 1980, CCI measures the deviation of the
|
|
251
|
+
* typical price from its simple moving average, normalized by mean deviation.
|
|
252
|
+
* The constant 0.015 ensures approximately 70-80% of CCI values fall between
|
|
253
|
+
* +100 and -100.
|
|
254
|
+
*
|
|
255
|
+
* Formula:
|
|
256
|
+
* TP = (High + Low + Close) / 3
|
|
257
|
+
* CCI = (TP - SMA(TP, period)) / (0.015 * Mean Deviation)
|
|
258
|
+
* Mean Deviation = SUM(|TP_i - SMA|) / period
|
|
259
|
+
*
|
|
260
|
+
* @param source - Iterable of OHLC candle data
|
|
261
|
+
* @param options - Configuration options
|
|
262
|
+
* @param options.period - The period for CCI calculation (default: 20)
|
|
263
|
+
* @returns Generator yielding CCI values
|
|
264
|
+
*/
|
|
265
|
+
declare const cci: _vulcan_js_core0.SignalGenerator<{
|
|
266
|
+
h: dnum.Numberish;
|
|
267
|
+
l: dnum.Numberish;
|
|
268
|
+
c: dnum.Numberish;
|
|
269
|
+
}, Dnum, CommodityChannelIndexOptions>;
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region src/trend/doubleExponentialMovingAverage.d.ts
|
|
272
|
+
interface DoubleExponentialMovingAverageOptions {
|
|
273
|
+
period: number;
|
|
274
|
+
}
|
|
275
|
+
declare const defaultDoubleExponentialMovingAverageOptions: DoubleExponentialMovingAverageOptions;
|
|
276
|
+
/**
|
|
277
|
+
* Double Exponential Moving Average (DEMA)
|
|
278
|
+
*
|
|
279
|
+
* DEMA reduces lag compared to a traditional EMA by applying the formula:
|
|
280
|
+
* DEMA = 2 * EMA(data, period) - EMA(EMA(data, period), period)
|
|
281
|
+
*
|
|
282
|
+
* @param source - Iterable of input values
|
|
283
|
+
* @param options - Configuration options
|
|
284
|
+
* @param options.period - The lookback period (default: 12)
|
|
285
|
+
* @returns Generator yielding DEMA values
|
|
286
|
+
*/
|
|
287
|
+
declare const dema: _vulcan_js_core0.SignalGenerator<Numberish, dnum.Dnum, DoubleExponentialMovingAverageOptions>;
|
|
288
|
+
//#endregion
|
|
289
|
+
//#region src/trend/exponentialMovingAverage.d.ts
|
|
290
|
+
interface ExponentialMovingAverageOptions {
|
|
291
|
+
period: number;
|
|
292
|
+
}
|
|
293
|
+
declare const defaultExponentialMovingAverageOptions: ExponentialMovingAverageOptions;
|
|
294
|
+
/**
|
|
295
|
+
* Exponential Moving Average (EMA)
|
|
296
|
+
*
|
|
297
|
+
* EMA = Price * k + PrevEMA * (1 - k)
|
|
298
|
+
* Where k = 2 / (period + 1)
|
|
299
|
+
*/
|
|
300
|
+
declare const ema: _vulcan_js_core0.SignalGenerator<Numberish, Dnum, ExponentialMovingAverageOptions>;
|
|
301
|
+
//#endregion
|
|
302
|
+
//#region src/trend/macd.d.ts
|
|
303
|
+
interface MACDOptions {
|
|
304
|
+
fastPeriod: number;
|
|
305
|
+
slowPeriod: number;
|
|
306
|
+
signalPeriod: number;
|
|
307
|
+
}
|
|
308
|
+
declare const defaultMACDOptions: MACDOptions;
|
|
309
|
+
interface MACDPoint {
|
|
310
|
+
macd: Dnum;
|
|
311
|
+
signal: Dnum;
|
|
312
|
+
histogram: Dnum;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Moving Average Convergence Divergence (MACD)
|
|
316
|
+
*
|
|
317
|
+
* MACD is a trend-following momentum indicator that shows the relationship
|
|
318
|
+
* between two exponential moving averages of prices. It consists of three components:
|
|
319
|
+
* - MACD Line: Fast EMA - Slow EMA
|
|
320
|
+
* - Signal Line: EMA of the MACD line
|
|
321
|
+
* - Histogram: MACD - Signal
|
|
322
|
+
*
|
|
323
|
+
* Formula:
|
|
324
|
+
* - MACD = EMA(fastPeriod, prices) - EMA(slowPeriod, prices)
|
|
325
|
+
* - Signal = EMA(signalPeriod, MACD)
|
|
326
|
+
* - Histogram = MACD - Signal
|
|
327
|
+
*
|
|
328
|
+
* @param source - Iterable of price values
|
|
329
|
+
* @param options - Configuration options
|
|
330
|
+
* @param options.fastPeriod - Period for the fast EMA (default: 12)
|
|
331
|
+
* @param options.slowPeriod - Period for the slow EMA (default: 26)
|
|
332
|
+
* @param options.signalPeriod - Period for the signal EMA (default: 9)
|
|
333
|
+
* @returns Generator yielding MACDPoint objects
|
|
334
|
+
*/
|
|
335
|
+
declare const macd: _vulcan_js_core0.SignalGenerator<Numberish, {
|
|
336
|
+
macd: Dnum;
|
|
337
|
+
signal: Dnum;
|
|
338
|
+
histogram: Dnum;
|
|
339
|
+
}, MACDOptions>;
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region src/trend/massIndex.d.ts
|
|
342
|
+
interface MassIndexOptions {
|
|
343
|
+
/**
|
|
344
|
+
* The period for EMA smoothing of the high-low range
|
|
345
|
+
* @default 9
|
|
346
|
+
*/
|
|
347
|
+
emaPeriod: number;
|
|
348
|
+
/**
|
|
349
|
+
* The period for the moving sum of the EMA ratio
|
|
350
|
+
* @default 25
|
|
351
|
+
*/
|
|
352
|
+
miPeriod: number;
|
|
353
|
+
}
|
|
354
|
+
declare const defaultMassIndexOptions: MassIndexOptions;
|
|
355
|
+
/**
|
|
356
|
+
* Mass Index (MI)
|
|
357
|
+
*
|
|
358
|
+
* Developed by Donald Dorsey, the Mass Index uses the high-low range
|
|
359
|
+
* to identify trend reversals based on range expansions. A "reversal bulge"
|
|
360
|
+
* occurs when the Mass Index rises above 27 and then falls below 26.5.
|
|
361
|
+
*
|
|
362
|
+
* Formula:
|
|
363
|
+
* Range = High - Low
|
|
364
|
+
* EMA1 = EMA(Range, emaPeriod)
|
|
365
|
+
* EMA2 = EMA(EMA1, emaPeriod)
|
|
366
|
+
* Ratio = EMA1 / EMA2
|
|
367
|
+
* MI = MovingSum(Ratio, miPeriod)
|
|
368
|
+
*
|
|
369
|
+
* @param source - Iterable of OHLC candle data (requires high and low)
|
|
370
|
+
* @param options - Configuration options
|
|
371
|
+
* @param options.emaPeriod - The EMA smoothing period (default: 9)
|
|
372
|
+
* @param options.miPeriod - The moving sum period (default: 25)
|
|
373
|
+
* @returns Generator yielding Mass Index values
|
|
374
|
+
*/
|
|
375
|
+
declare const mi: _vulcan_js_core0.SignalGenerator<{
|
|
376
|
+
h: dnum.Numberish;
|
|
377
|
+
l: dnum.Numberish;
|
|
378
|
+
}, dnum.Dnum, MassIndexOptions>;
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/trend/movingMax.d.ts
|
|
381
|
+
interface MovingMaxOptions {
|
|
382
|
+
/**
|
|
383
|
+
* period
|
|
384
|
+
*/
|
|
385
|
+
period: number;
|
|
386
|
+
}
|
|
387
|
+
declare const defaultMovingMaxOptions: MovingMaxOptions;
|
|
388
|
+
/**
|
|
389
|
+
* Moving Maximum (MovingMax)
|
|
390
|
+
*/
|
|
391
|
+
declare const mmax: _vulcan_js_core0.SignalGenerator<Numberish, Dnum, MovingMaxOptions>;
|
|
392
|
+
//#endregion
|
|
393
|
+
//#region src/trend/movingMin.d.ts
|
|
394
|
+
interface MovingMinOptions {
|
|
395
|
+
/**
|
|
396
|
+
* period
|
|
397
|
+
*/
|
|
398
|
+
period: number;
|
|
399
|
+
}
|
|
400
|
+
declare const defaultMovingMinOptions: MovingMinOptions;
|
|
401
|
+
/**
|
|
402
|
+
* Moving Minimum (MovingMin)
|
|
403
|
+
*/
|
|
404
|
+
declare const mmin: _vulcan_js_core0.SignalGenerator<Numberish, Dnum, MovingMinOptions>;
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region src/trend/movingSum.d.ts
|
|
407
|
+
interface MovingSumOptions {
|
|
408
|
+
period: number;
|
|
409
|
+
}
|
|
410
|
+
declare const defaultMovingSumOptions: MovingSumOptions;
|
|
411
|
+
/**
|
|
412
|
+
* Moving Sum
|
|
413
|
+
*
|
|
414
|
+
* Calculates the sum of values in a sliding window of the specified period.
|
|
415
|
+
*/
|
|
416
|
+
declare const msum: _vulcan_js_core0.SignalGenerator<Numberish, Dnum, MovingSumOptions>;
|
|
417
|
+
//#endregion
|
|
418
|
+
//#region src/trend/rollingMovingAverage.d.ts
|
|
419
|
+
interface RMAOptions {
|
|
420
|
+
/**
|
|
421
|
+
* period
|
|
422
|
+
*/
|
|
423
|
+
period: number;
|
|
424
|
+
}
|
|
425
|
+
declare const defaultRMAOptions: RMAOptions;
|
|
426
|
+
/**
|
|
427
|
+
* Rolling moving average (RMA).
|
|
428
|
+
*
|
|
429
|
+
* R[0] to R[p-1] is SMA(values)
|
|
430
|
+
*
|
|
431
|
+
* R[p] and after is R[i] = ((R[i-1]*(p-1)) + v[i]) / p
|
|
432
|
+
*/
|
|
433
|
+
declare const rma: _vulcan_js_core0.SignalGenerator<Numberish, Dnum, RMAOptions>;
|
|
434
|
+
//#endregion
|
|
435
|
+
//#region src/trend/simpleMovingAverage.d.ts
|
|
436
|
+
interface SimpleMovingAverageOptions {
|
|
437
|
+
/**
|
|
438
|
+
* The period for calculating the moving average
|
|
439
|
+
* @default 2
|
|
440
|
+
*/
|
|
441
|
+
period: number;
|
|
442
|
+
}
|
|
443
|
+
declare const defaultSMAOptions: SimpleMovingAverageOptions;
|
|
444
|
+
/**
|
|
445
|
+
* Simple Moving Average (SMA)
|
|
446
|
+
*
|
|
447
|
+
* Calculates the arithmetic mean of a set of values over a specified period.
|
|
448
|
+
* The SMA is calculated by summing all values in the period and dividing by the period length.
|
|
449
|
+
*
|
|
450
|
+
* Formula: SMA = (P1 + P2 + ... + Pn) / n
|
|
451
|
+
* Where: P = Price values, n = Period
|
|
452
|
+
*
|
|
453
|
+
* @param source - Iterable of price values
|
|
454
|
+
* @param options - Configuration options
|
|
455
|
+
* @param options.period - The period for calculating the moving average (default: 2)
|
|
456
|
+
* @returns Generator yielding SMA values
|
|
457
|
+
*/
|
|
458
|
+
declare const sma: _vulcan_js_core0.SignalGenerator<Numberish, Dnum, SimpleMovingAverageOptions>;
|
|
459
|
+
//#endregion
|
|
460
|
+
//#region src/trend/triangularMovingAverage.d.ts
|
|
461
|
+
interface TriangularMovingAverageOptions {
|
|
462
|
+
period: number;
|
|
463
|
+
}
|
|
464
|
+
declare const defaultTriangularMovingAverageOptions: TriangularMovingAverageOptions;
|
|
465
|
+
declare const trima: _vulcan_js_core0.SignalGenerator<Numberish, dnum.Dnum, TriangularMovingAverageOptions>;
|
|
466
|
+
//#endregion
|
|
467
|
+
//#region src/volume/accumulationDistribution.d.ts
|
|
468
|
+
/**
|
|
469
|
+
* Accumulation/Distribution Indicator (A/D). Cumulative indicator
|
|
470
|
+
* that uses volume and price to assess whether a stock is
|
|
471
|
+
* being accumulated or distributed.
|
|
472
|
+
*
|
|
473
|
+
* MFM = ((Closing - Low) - (High - Closing)) / (High - Low)
|
|
474
|
+
* MFV = MFM * Period Volume
|
|
475
|
+
* AD = Previous AD + CMFV
|
|
476
|
+
*/
|
|
477
|
+
declare const ad: _vulcan_js_core0.SignalGenerator<{
|
|
478
|
+
h: dnum.Numberish;
|
|
479
|
+
l: dnum.Numberish;
|
|
480
|
+
c: dnum.Numberish;
|
|
481
|
+
v: dnum.Numberish;
|
|
482
|
+
}, Dnum, Record<string, any>>;
|
|
483
|
+
//#endregion
|
|
484
|
+
export { AbsolutePriceOscillatorOptions, AroonOptions, AroonPoint, AwesomeOscillatorOptions, ChaikinOscillatorOptions, ChandeForecastOscillatorOptions, CommodityChannelIndexOptions, DoubleExponentialMovingAverageOptions, ExponentialMovingAverageOptions, IchimokuCloudOptions, IchimokuCloudPoint, MACDOptions, MACDPoint, MassIndexOptions, MovingMaxOptions, MovingMinOptions, MovingSumOptions, PercentagePriceOscillatorOptions, PercentagePriceOscillatorPoint, RMAOptions, RSIOptions, SimpleMovingAverageOptions, StochPoint, StochasticOscillatorOptions, TriangularMovingAverageOptions, apo as absolutePriceOscillator, apo, ad as accumulationDistribution, ad, ao, ao as awesomeOscillator, aroon, bop as balanceOfPower, bop, cci, cci as commodityChannelIndex, cfo, cfo as chandeForecastOscillator, cmo as chaikinOscillator, cmo, defaultAbsolutePriceOscillatorOptions, defaultAroonOptions, defaultAwesomeOscillatorOptions, defaultCCIOptions, defaultCFOOptions, defaultChaikinOscillatorOptions, defaultDoubleExponentialMovingAverageOptions, defaultExponentialMovingAverageOptions, defaultIchimokuCloudOptions, defaultMACDOptions, defaultMassIndexOptions, defaultMovingMaxOptions, defaultMovingMinOptions, defaultMovingSumOptions, defaultPercentagePriceOscillatorOptions, defaultRMAOptions, defaultRSIOptions, defaultSMAOptions, defaultStochasticOscillatorOptions, defaultTriangularMovingAverageOptions, dema, dema as doubleExponentialMovingAverage, ema, ema as exponentialMovingAverage, ichimokuCloud, macd, macd as movingAverageConvergenceDivergence, mi as massIndex, mi, mmax, mmax as movingMax, mmin, mmin as movingMin, msum, ppo as percentagePriceOscillator, ppo, rsi as relativeStrengthIndex, rsi, rma, rma as rollingMovingAverage, sma as simpleMovingAverage, sma, stoch, stoch as stochasticOscillator, trima as triangularMovingAverage, trima };
|
|
485
|
+
//# sourceMappingURL=index.d.ts.map
|