@vulcan-js/indicators 0.1.0-beta.2 → 0.1.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/README.md CHANGED
@@ -48,17 +48,15 @@ process(98)
48
48
  | Aroon Indicator | `aroon` | — |
49
49
  | Balance of Power | `bop` | `balanceOfPower` |
50
50
  | Chande Forecast Oscillator | `cfo` | `chandeForecastOscillator` |
51
- | Commodity Channel Index | `cci` | `commodityChannelIndex` |
52
51
  | Double Exponential Moving Average | `dema` | `doubleExponentialMovingAverage` |
53
52
  | Exponential Moving Average | `ema` | `exponentialMovingAverage` |
54
- | Mass Index | `mi` | `massIndex` |
53
+ | Ichimoku Cloud | `ichimokuCloud` | |
55
54
  | MACD | `macd` | `movingAverageConvergenceDivergence` |
56
55
  | Moving Max | `mmax` | `movingMax` |
57
56
  | Moving Min | `mmin` | `movingMin` |
58
57
  | Moving Sum | `msum` | — |
59
58
  | Parabolic SAR | `psar` | `parabolicSar` |
60
59
  | Qstick | `qstick` | `qstickIndicator` |
61
- | Random Index (KDJ) | `kdj` | `randomIndex` |
62
60
  | Rolling Moving Average | `rma` | `rollingMovingAverage` |
63
61
  | Simple Moving Average | `sma` | `simpleMovingAverage` |
64
62
  | Since Change | `since` | `sinceChange` |
@@ -68,6 +66,10 @@ process(98)
68
66
  | Typical Price | `typicalPrice` | `typicalPriceIndicator` |
69
67
  | Volume Weighted Moving Average | `vwma` | `volumeWeightedMovingAverage` |
70
68
  | Vortex Indicator | `vortex` | `vortexIndicator` |
69
+ | ADX/DMI | — | _TODO_ |
70
+ | SuperTrend | — | _TODO_ |
71
+ | ALMA | — | _TODO_ |
72
+ | ZigZag | — | _TODO_ |
71
73
 
72
74
  ### Momentum
73
75
 
@@ -76,19 +78,38 @@ process(98)
76
78
  | Absolute Price Oscillator | `apo` | `absolutePriceOscillator` |
77
79
  | Awesome Oscillator | `ao` | `awesomeOscillator` |
78
80
  | Chaikin Oscillator | `cmo` | `chaikinOscillator` |
79
- | Ichimoku Cloud | `ichimokuCloud` | |
81
+ | Commodity Channel Index | `cci` | `commodityChannelIndex` |
80
82
  | Percentage Price Oscillator | `ppo` | `percentagePriceOscillator` |
81
- | Relative Strength Index | `rsi` | `relativeStrengthIndex` |
82
83
  | Percentage Volume Oscillator | `pvo` | `percentageVolumeOscillator` |
83
84
  | Price Rate of Change | `roc` | `priceRateOfChange` |
85
+ | Random Index (KDJ) | `kdj` | `randomIndex` |
86
+ | Relative Strength Index | `rsi` | `relativeStrengthIndex` |
84
87
  | Stochastic Oscillator | `stoch` | `stochasticOscillator` |
85
88
  | Williams %R | `willr` | `williamsR` |
89
+ | Money Flow Index | — | _TODO_ |
90
+ | Ultimate Oscillator | — | _TODO_ |
91
+ | True Strength Index | — | _TODO_ |
92
+
93
+ ### Volatility
94
+
95
+ | Indicator | Function | Alias |
96
+ | --- | --- | --- |
97
+ | Mass Index | `mi` | `massIndex` |
98
+ | Average True Range | — | _TODO_ |
99
+ | Bollinger Bands | — | _TODO_ |
100
+ | Keltner Channels | — | _TODO_ |
101
+ | Donchian Channels | — | _TODO_ |
102
+ | Standard Deviation | — | _TODO_ |
86
103
 
87
104
  ### Volume
88
105
 
89
106
  | Indicator | Function | Alias |
90
107
  | --- | --- | --- |
91
108
  | Accumulation/Distribution | `ad` | `accumulationDistribution` |
109
+ | On-Balance Volume | — | _TODO_ |
110
+ | VWAP | — | _TODO_ |
111
+ | Force Index | — | _TODO_ |
112
+ | Ease of Movement | — | _TODO_ |
92
113
 
93
114
  ## License
94
115
 
package/dist/index.d.ts CHANGED
@@ -49,47 +49,38 @@ declare const cmo: _vulcan_js_core0.SignalGenerator<{
49
49
  v: dnum.Numberish;
50
50
  }, dnum.Dnum, ChaikinOscillatorOptions>;
51
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;
52
+ //#region src/momentum/commodityChannelIndex.d.ts
53
+ interface CommodityChannelIndexOptions {
54
+ /**
55
+ * The period for CCI calculation
56
+ * @default 20
57
+ */
58
+ period: number;
68
59
  }
60
+ declare const defaultCCIOptions: CommodityChannelIndexOptions;
69
61
  /**
70
- * Ichimoku Cloud (Ichimoku Kinko Hyo)
62
+ * Commodity Channel Index (CCI)
71
63
  *
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.
64
+ * Developed by Donald Lambert in 1980, CCI measures the deviation of the
65
+ * typical price from its simple moving average, normalized by mean deviation.
66
+ * The constant 0.015 ensures approximately 70-80% of CCI values fall between
67
+ * +100 and -100.
75
68
  *
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
69
+ * Formula:
70
+ * TP = (High + Low + Close) / 3
71
+ * CCI = (TP - SMA(TP, period)) / (0.015 * Mean Deviation)
72
+ * Mean Deviation = SUM(|TP_i - SMA|) / period
73
+ *
74
+ * @param source - Iterable of OHLC candle data
75
+ * @param options - Configuration options
76
+ * @param options.period - The period for CCI calculation (default: 20)
77
+ * @returns Generator yielding CCI values
81
78
  */
82
- declare const ichimokuCloud: _vulcan_js_core0.SignalGenerator<{
79
+ declare const cci: _vulcan_js_core0.SignalGenerator<{
83
80
  h: dnum.Numberish;
84
81
  l: dnum.Numberish;
85
82
  c: dnum.Numberish;
86
- }, {
87
- conversion: Dnum;
88
- base: Dnum;
89
- leadingA: Dnum;
90
- leadingB: Dnum;
91
- lagging: Dnum;
92
- }, IchimokuCloudOptions>;
83
+ }, Dnum, CommodityChannelIndexOptions>;
93
84
  //#endregion
94
85
  //#region src/momentum/percentagePriceOscillator.d.ts
95
86
  interface PercentagePriceOscillatorOptions {
@@ -194,6 +185,65 @@ declare const defaultPriceRateOfChangeOptions: PriceRateOfChangeOptions;
194
185
  */
195
186
  declare const roc: _vulcan_js_core0.SignalGenerator<Numberish, Dnum, PriceRateOfChangeOptions>;
196
187
  //#endregion
188
+ //#region src/momentum/randomIndex.d.ts
189
+ interface RandomIndexOptions {
190
+ /**
191
+ * The lookback period for calculating RSV (Raw Stochastic Value)
192
+ * @default 9
193
+ */
194
+ period: number;
195
+ /**
196
+ * The smoothing period for K line
197
+ * @default 3
198
+ */
199
+ kPeriod: number;
200
+ /**
201
+ * The smoothing period for D line
202
+ * @default 3
203
+ */
204
+ dPeriod: number;
205
+ }
206
+ declare const defaultRandomIndexOptions: RandomIndexOptions;
207
+ interface KDJPoint {
208
+ k: Dnum;
209
+ d: Dnum;
210
+ j: Dnum;
211
+ }
212
+ /**
213
+ * Random Index (KDJ)
214
+ *
215
+ * An extension of the Stochastic Oscillator that adds a J line to amplify
216
+ * divergence between K and D. Uses exponential-weighted smoothing with
217
+ * initial K and D values set to 50.
218
+ *
219
+ * Formula:
220
+ * RSV = (Close - LowestLow(period)) / (HighestHigh(period) - LowestLow(period)) × 100
221
+ * K = ((kPeriod - 1) / kPeriod) × prevK + (1 / kPeriod) × RSV
222
+ * D = ((dPeriod - 1) / dPeriod) × prevD + (1 / dPeriod) × K
223
+ * J = 3K - 2D
224
+ *
225
+ * Interpretation:
226
+ * - K crossing above D is a bullish signal (golden cross)
227
+ * - K crossing below D is a bearish signal (death cross)
228
+ * - J below 0 indicates oversold, J above 100 indicates overbought
229
+ *
230
+ * @param source - Iterable of candle data with high, low, and close prices
231
+ * @param options - Configuration options
232
+ * @param options.period - The lookback period for RSV calculation (default: 9)
233
+ * @param options.kPeriod - The smoothing period for K line (default: 3)
234
+ * @param options.dPeriod - The smoothing period for D line (default: 3)
235
+ * @returns Generator yielding KDJPoint values with k, d, and j as Dnum
236
+ */
237
+ declare const kdj: _vulcan_js_core0.SignalGenerator<{
238
+ h: dnum.Numberish;
239
+ l: dnum.Numberish;
240
+ c: dnum.Numberish;
241
+ }, {
242
+ k: Dnum;
243
+ d: Dnum;
244
+ j: Dnum;
245
+ }, RandomIndexOptions>;
246
+ //#endregion
197
247
  //#region src/momentum/relativeStrengthIndex.d.ts
198
248
  interface RSIOptions {
199
249
  period: number;
@@ -330,39 +380,6 @@ declare const defaultCFOOptions: ChandeForecastOscillatorOptions;
330
380
  */
331
381
  declare const cfo: _vulcan_js_core0.SignalGenerator<Numberish, Dnum, ChandeForecastOscillatorOptions>;
332
382
  //#endregion
333
- //#region src/trend/commodityChannelIndex.d.ts
334
- interface CommodityChannelIndexOptions {
335
- /**
336
- * The period for CCI calculation
337
- * @default 20
338
- */
339
- period: number;
340
- }
341
- declare const defaultCCIOptions: CommodityChannelIndexOptions;
342
- /**
343
- * Commodity Channel Index (CCI)
344
- *
345
- * Developed by Donald Lambert in 1980, CCI measures the deviation of the
346
- * typical price from its simple moving average, normalized by mean deviation.
347
- * The constant 0.015 ensures approximately 70-80% of CCI values fall between
348
- * +100 and -100.
349
- *
350
- * Formula:
351
- * TP = (High + Low + Close) / 3
352
- * CCI = (TP - SMA(TP, period)) / (0.015 * Mean Deviation)
353
- * Mean Deviation = SUM(|TP_i - SMA|) / period
354
- *
355
- * @param source - Iterable of OHLC candle data
356
- * @param options - Configuration options
357
- * @param options.period - The period for CCI calculation (default: 20)
358
- * @returns Generator yielding CCI values
359
- */
360
- declare const cci: _vulcan_js_core0.SignalGenerator<{
361
- h: dnum.Numberish;
362
- l: dnum.Numberish;
363
- c: dnum.Numberish;
364
- }, Dnum, CommodityChannelIndexOptions>;
365
- //#endregion
366
383
  //#region src/trend/doubleExponentialMovingAverage.d.ts
367
384
  interface DoubleExponentialMovingAverageOptions {
368
385
  period: number;
@@ -394,6 +411,48 @@ declare const defaultExponentialMovingAverageOptions: ExponentialMovingAverageOp
394
411
  */
395
412
  declare const ema: _vulcan_js_core0.SignalGenerator<Numberish, Dnum, ExponentialMovingAverageOptions>;
396
413
  //#endregion
414
+ //#region src/trend/ichimokuCloud.d.ts
415
+ interface IchimokuCloudOptions {
416
+ /** Conversion line period */
417
+ conversionPeriod: number;
418
+ /** Base line period */
419
+ basePeriod: number;
420
+ /** Leading span B period */
421
+ leadingBPeriod: number;
422
+ }
423
+ declare const defaultIchimokuCloudOptions: IchimokuCloudOptions;
424
+ interface IchimokuCloudPoint {
425
+ conversion: Dnum;
426
+ base: Dnum;
427
+ leadingA: Dnum;
428
+ leadingB: Dnum;
429
+ lagging: Dnum;
430
+ }
431
+ /**
432
+ * Ichimoku Cloud (Ichimoku Kinko Hyo)
433
+ *
434
+ * Computes raw values for each component. Displacement (shifting
435
+ * Leading Spans forward and Lagging Span backward on the chart)
436
+ * is a presentation concern left to the consumer.
437
+ *
438
+ * - Conversion (Tenkan-sen): (highest high + lowest low) / 2 over conversionPeriod
439
+ * - Base (Kijun-sen): (highest high + lowest low) / 2 over basePeriod
440
+ * - Leading Span A (Senkou A): (conversion + base) / 2
441
+ * - Leading Span B (Senkou B): (highest high + lowest low) / 2 over leadingBPeriod
442
+ * - Lagging (Chikou): current close price
443
+ */
444
+ declare const ichimokuCloud: _vulcan_js_core0.SignalGenerator<{
445
+ h: dnum.Numberish;
446
+ l: dnum.Numberish;
447
+ c: dnum.Numberish;
448
+ }, {
449
+ conversion: Dnum;
450
+ base: Dnum;
451
+ leadingA: Dnum;
452
+ leadingB: Dnum;
453
+ lagging: Dnum;
454
+ }, IchimokuCloudOptions>;
455
+ //#endregion
397
456
  //#region src/trend/macd.d.ts
398
457
  interface MACDOptions {
399
458
  fastPeriod: number;
@@ -433,45 +492,6 @@ declare const macd: _vulcan_js_core0.SignalGenerator<Numberish, {
433
492
  histogram: Dnum;
434
493
  }, MACDOptions>;
435
494
  //#endregion
436
- //#region src/trend/massIndex.d.ts
437
- interface MassIndexOptions {
438
- /**
439
- * The period for EMA smoothing of the high-low range
440
- * @default 9
441
- */
442
- emaPeriod: number;
443
- /**
444
- * The period for the moving sum of the EMA ratio
445
- * @default 25
446
- */
447
- miPeriod: number;
448
- }
449
- declare const defaultMassIndexOptions: MassIndexOptions;
450
- /**
451
- * Mass Index (MI)
452
- *
453
- * Developed by Donald Dorsey, the Mass Index uses the high-low range
454
- * to identify trend reversals based on range expansions. A "reversal bulge"
455
- * occurs when the Mass Index rises above 27 and then falls below 26.5.
456
- *
457
- * Formula:
458
- * Range = High - Low
459
- * EMA1 = EMA(Range, emaPeriod)
460
- * EMA2 = EMA(EMA1, emaPeriod)
461
- * Ratio = EMA1 / EMA2
462
- * MI = MovingSum(Ratio, miPeriod)
463
- *
464
- * @param source - Iterable of OHLC candle data (requires high and low)
465
- * @param options - Configuration options
466
- * @param options.emaPeriod - The EMA smoothing period (default: 9)
467
- * @param options.miPeriod - The moving sum period (default: 25)
468
- * @returns Generator yielding Mass Index values
469
- */
470
- declare const mi: _vulcan_js_core0.SignalGenerator<{
471
- h: dnum.Numberish;
472
- l: dnum.Numberish;
473
- }, dnum.Dnum, MassIndexOptions>;
474
- //#endregion
475
495
  //#region src/trend/movingMax.d.ts
476
496
  interface MovingMaxOptions {
477
497
  /**
@@ -589,65 +609,6 @@ declare const qstick: _vulcan_js_core0.SignalGenerator<{
589
609
  o: dnum.Numberish;
590
610
  }, Dnum, QstickOptions>;
591
611
  //#endregion
592
- //#region src/trend/randomIndex.d.ts
593
- interface RandomIndexOptions {
594
- /**
595
- * The lookback period for calculating RSV (Raw Stochastic Value)
596
- * @default 9
597
- */
598
- period: number;
599
- /**
600
- * The smoothing period for K line
601
- * @default 3
602
- */
603
- kPeriod: number;
604
- /**
605
- * The smoothing period for D line
606
- * @default 3
607
- */
608
- dPeriod: number;
609
- }
610
- declare const defaultRandomIndexOptions: RandomIndexOptions;
611
- interface KDJPoint {
612
- k: Dnum;
613
- d: Dnum;
614
- j: Dnum;
615
- }
616
- /**
617
- * Random Index (KDJ)
618
- *
619
- * An extension of the Stochastic Oscillator that adds a J line to amplify
620
- * divergence between K and D. Uses exponential-weighted smoothing with
621
- * initial K and D values set to 50.
622
- *
623
- * Formula:
624
- * RSV = (Close - LowestLow(period)) / (HighestHigh(period) - LowestLow(period)) × 100
625
- * K = ((kPeriod - 1) / kPeriod) × prevK + (1 / kPeriod) × RSV
626
- * D = ((dPeriod - 1) / dPeriod) × prevD + (1 / dPeriod) × K
627
- * J = 3K - 2D
628
- *
629
- * Interpretation:
630
- * - K crossing above D is a bullish signal (golden cross)
631
- * - K crossing below D is a bearish signal (death cross)
632
- * - J below 0 indicates oversold, J above 100 indicates overbought
633
- *
634
- * @param source - Iterable of candle data with high, low, and close prices
635
- * @param options - Configuration options
636
- * @param options.period - The lookback period for RSV calculation (default: 9)
637
- * @param options.kPeriod - The smoothing period for K line (default: 3)
638
- * @param options.dPeriod - The smoothing period for D line (default: 3)
639
- * @returns Generator yielding KDJPoint values with k, d, and j as Dnum
640
- */
641
- declare const kdj: _vulcan_js_core0.SignalGenerator<{
642
- h: dnum.Numberish;
643
- l: dnum.Numberish;
644
- c: dnum.Numberish;
645
- }, {
646
- k: Dnum;
647
- d: Dnum;
648
- j: Dnum;
649
- }, RandomIndexOptions>;
650
- //#endregion
651
612
  //#region src/trend/rollingMovingAverage.d.ts
652
613
  interface RMAOptions {
653
614
  /**
@@ -836,6 +797,45 @@ declare const vortex: _vulcan_js_core0.SignalGenerator<{
836
797
  minus: Dnum;
837
798
  }, VortexOptions>;
838
799
  //#endregion
800
+ //#region src/volatility/massIndex.d.ts
801
+ interface MassIndexOptions {
802
+ /**
803
+ * The period for EMA smoothing of the high-low range
804
+ * @default 9
805
+ */
806
+ emaPeriod: number;
807
+ /**
808
+ * The period for the moving sum of the EMA ratio
809
+ * @default 25
810
+ */
811
+ miPeriod: number;
812
+ }
813
+ declare const defaultMassIndexOptions: MassIndexOptions;
814
+ /**
815
+ * Mass Index (MI)
816
+ *
817
+ * Developed by Donald Dorsey, the Mass Index uses the high-low range
818
+ * to identify trend reversals based on range expansions. A "reversal bulge"
819
+ * occurs when the Mass Index rises above 27 and then falls below 26.5.
820
+ *
821
+ * Formula:
822
+ * Range = High - Low
823
+ * EMA1 = EMA(Range, emaPeriod)
824
+ * EMA2 = EMA(EMA1, emaPeriod)
825
+ * Ratio = EMA1 / EMA2
826
+ * MI = MovingSum(Ratio, miPeriod)
827
+ *
828
+ * @param source - Iterable of OHLC candle data (requires high and low)
829
+ * @param options - Configuration options
830
+ * @param options.emaPeriod - The EMA smoothing period (default: 9)
831
+ * @param options.miPeriod - The moving sum period (default: 25)
832
+ * @returns Generator yielding Mass Index values
833
+ */
834
+ declare const mi: _vulcan_js_core0.SignalGenerator<{
835
+ h: dnum.Numberish;
836
+ l: dnum.Numberish;
837
+ }, dnum.Dnum, MassIndexOptions>;
838
+ //#endregion
839
839
  //#region src/volume/accumulationDistribution.d.ts
840
840
  /**
841
841
  * Accumulation/Distribution Indicator (A/D). Cumulative indicator