trading-signals 2.4.0 → 3.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 +30 -14
- package/dist/ABANDS/AccelerationBands.d.ts +2 -2
- package/dist/ABANDS/AccelerationBands.js.map +1 -1
- package/dist/AC/AC.d.ts +2 -4
- package/dist/AC/AC.js +1 -11
- package/dist/AC/AC.js.map +1 -1
- package/dist/ADX/ADX.d.ts +11 -23
- package/dist/ADX/ADX.js +18 -66
- package/dist/ADX/ADX.js.map +1 -1
- package/dist/AO/AO.d.ts +2 -4
- package/dist/AO/AO.js +2 -13
- package/dist/AO/AO.js.map +1 -1
- package/dist/ATR/ATR.d.ts +13 -11
- package/dist/ATR/ATR.js +22 -37
- package/dist/ATR/ATR.js.map +1 -1
- package/dist/BBANDS/BollingerBands.d.ts +4 -4
- package/dist/BBANDS/BollingerBands.js +4 -4
- package/dist/BBANDS/BollingerBands.js.map +1 -1
- package/dist/CCI/CCI.d.ts +23 -0
- package/dist/CCI/CCI.js +66 -0
- package/dist/CCI/CCI.js.map +1 -0
- package/dist/CG/CG.d.ts +2 -3
- package/dist/CG/CG.js +1 -8
- package/dist/CG/CG.js.map +1 -1
- package/dist/DEMA/DEMA.d.ts +2 -3
- package/dist/DEMA/DEMA.js +1 -7
- package/dist/DEMA/DEMA.js.map +1 -1
- package/dist/DMA/DMA.d.ts +2 -2
- package/dist/DMA/DMA.js.map +1 -1
- package/dist/DX/DX.d.ts +15 -0
- package/dist/DX/DX.js +56 -0
- package/dist/DX/DX.js.map +1 -0
- package/dist/EMA/EMA.d.ts +10 -1
- package/dist/EMA/EMA.js +31 -3
- package/dist/EMA/EMA.js.map +1 -1
- package/dist/Indicator.d.ts +18 -10
- package/dist/Indicator.js +34 -4
- package/dist/Indicator.js.map +1 -1
- package/dist/MA/MovingAverage.d.ts +9 -2
- package/dist/MA/MovingAverage.js +18 -2
- package/dist/MA/MovingAverage.js.map +1 -1
- package/dist/MA/MovingAverageTypes.d.ts +5 -0
- package/dist/MA/{MovingAverageTypeContext.js → MovingAverageTypes.js} +1 -1
- package/dist/MA/MovingAverageTypes.js.map +1 -0
- package/dist/MAD/MAD.d.ts +16 -0
- package/dist/MAD/MAD.js +65 -0
- package/dist/MAD/MAD.js.map +1 -0
- package/dist/MOM/MOM.d.ts +5 -7
- package/dist/MOM/MOM.js +4 -14
- package/dist/MOM/MOM.js.map +1 -1
- package/dist/ROC/ROC.d.ts +2 -4
- package/dist/ROC/ROC.js +1 -11
- package/dist/ROC/ROC.js.map +1 -1
- package/dist/RSI/RSI.d.ts +16 -8
- package/dist/RSI/RSI.js +44 -34
- package/dist/RSI/RSI.js.map +1 -1
- package/dist/SMA/SMA.d.ts +2 -5
- package/dist/SMA/SMA.js +4 -4
- package/dist/SMA/SMA.js.map +1 -1
- package/dist/STOCH/StochasticOscillator.d.ts +2 -2
- package/dist/STOCH/StochasticOscillator.js.map +1 -1
- package/dist/STOCH/StochasticRSI.d.ts +17 -0
- package/dist/STOCH/StochasticRSI.js +52 -0
- package/dist/STOCH/StochasticRSI.js.map +1 -0
- package/dist/TR/TR.d.ts +11 -0
- package/dist/TR/TR.js +40 -0
- package/dist/TR/TR.js.map +1 -0
- package/dist/WSMA/WSMA.d.ts +8 -2
- package/dist/WSMA/WSMA.js +18 -14
- package/dist/WSMA/WSMA.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/util/HighLowClose.d.ts +5 -0
- package/dist/util/Period.d.ts +22 -0
- package/dist/util/Period.js +48 -0
- package/dist/util/Period.js.map +1 -0
- package/dist/util/getAverage.js.map +1 -1
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.js +1 -0
- package/dist/util/index.js.map +1 -1
- package/package.json +13 -13
- package/dist/MA/MovingAverageTypeContext.d.ts +0 -5
- package/dist/MA/MovingAverageTypeContext.js.map +0 -1
- package/dist/SMMA/SMMA.d.ts +0 -11
- package/dist/SMMA/SMMA.js +0 -42
- package/dist/SMMA/SMMA.js.map +0 -1
package/README.md
CHANGED
|
@@ -6,20 +6,30 @@ Technical indicators and overlays to run technical analysis with JavaScript / Ty
|
|
|
6
6
|
|
|
7
7
|
## Motivation
|
|
8
8
|
|
|
9
|
-
The "trading-signals" library provides a TypeScript implementation for common technical indicators with arbitrary-precision decimal arithmetic.
|
|
9
|
+
The "trading-signals" library provides a TypeScript implementation for common technical indicators with arbitrary-precision decimal arithmetic.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
The main focus of this library is on the accuracy of calculations, but using the provided [faster implementations][2] you can also use it where performance is important.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
All indicators can be updated over time by streaming data (prices or candles) to the `update` method. Some indicators also provide `static` batch methods for further performance improvements when providing data up-front during a backtest or historical data import.
|
|
14
|
+
|
|
15
|
+
## Benefits & Features
|
|
16
|
+
|
|
17
|
+
- **Accurate.** Indicators with intervals will return a result only when the period is reached.
|
|
18
|
+
- **Convenient.** Indicators with intervals will save their all-time highs and lows.
|
|
19
|
+
- **Fast.** If you need high throughput, you can use the included [faster implementations][2].
|
|
20
|
+
- **Flexible.** All advanced indicators support different smoothing overlays (WSMA, etc.).
|
|
21
|
+
- **Precise.** Better accuracy than calculating with primitive numbers thanks to [big.js][1].
|
|
15
22
|
- **Tested.** Code coverage is 100%. No surprises when using it.
|
|
23
|
+
- **Typed.** Source code is 100% TypeScript. No need to install external typings.
|
|
24
|
+
- **Verified.** All results are verified with [other libraries](#alternatives) to guarantee correctness.
|
|
25
|
+
- **Versatile.** Indicators can be updated up-front or by streaming prices.
|
|
16
26
|
|
|
17
27
|
## Technical Indicator Types
|
|
18
28
|
|
|
19
|
-
- Trend indicators: Measure the direction of a trend
|
|
29
|
+
- Trend indicators: Measure the direction of a trend (uptrend, downtrend or sideways trend)
|
|
20
30
|
- Volume indicators: Measure the strength of a trend (based on volume)
|
|
21
|
-
- Volatility indicators: Measure
|
|
22
|
-
- Momentum indicators: Measure the speed of price movement
|
|
31
|
+
- Volatility indicators: Measure how much disagreement there is in the market based on price (statistical measure of its dispersion)
|
|
32
|
+
- Momentum indicators: Measure the strength of a trend (based on price / speed of price movement)
|
|
23
33
|
|
|
24
34
|
## Supported Technical Indicators
|
|
25
35
|
|
|
@@ -30,21 +40,25 @@ The "trading-signals" library provides a TypeScript implementation for common te
|
|
|
30
40
|
1. Awesome Oscillator (AO)
|
|
31
41
|
1. Bollinger Bands (BBANDS)
|
|
32
42
|
1. Center of Gravity (CG)
|
|
43
|
+
1. Commodity Channel Index (CCI)
|
|
44
|
+
1. Directional Movement Index (DMI / DX)
|
|
33
45
|
1. Double Exponential Moving Average (DEMA)
|
|
34
46
|
1. Dual Moving Average (DMA)
|
|
35
47
|
1. Exponential Moving Average (EMA)
|
|
48
|
+
1. Mean Absolute Deviation (MAD)
|
|
36
49
|
1. Momentum (MOM)
|
|
37
50
|
1. Moving Average Convergence Divergence (MACD)
|
|
38
51
|
1. Rate-of-Change (ROC)
|
|
39
52
|
1. Relative Strength Index (RSI)
|
|
40
53
|
1. Simple Moving Average (SMA)
|
|
41
|
-
1. Smoothed Moving Average (SMMA)
|
|
42
54
|
1. Stochastic Oscillator (STOCH)
|
|
43
|
-
1.
|
|
55
|
+
1. Stochastic RSI (STOCHRSI)
|
|
56
|
+
1. True Range (TR)
|
|
57
|
+
1. Wilder's Smoothed Moving Average (WSMA / WMA / WWS / SMMA / MEMA)
|
|
44
58
|
|
|
45
59
|
Utility Methods:
|
|
46
60
|
|
|
47
|
-
1. Average
|
|
61
|
+
1. Average / Mean
|
|
48
62
|
1. Standard Deviation
|
|
49
63
|
1. Rolling Standard Deviation
|
|
50
64
|
|
|
@@ -134,13 +148,14 @@ It is very important to do your own analysis before making any investment based
|
|
|
134
148
|
|
|
135
149
|
## Alternatives
|
|
136
150
|
|
|
137
|
-
- [Tulip Indicators (ANSI C)](https://github.com/TulipCharts/tulipindicators)
|
|
138
|
-
- [Pandas TA (Python)](https://github.com/twopirllc/pandas-ta)
|
|
139
|
-
- [Jesse Trading Bot Indicators (Python)](https://docs.jesse.trade/docs/indicators/reference.html)
|
|
140
|
-
- [libindicators (C#)](https://github.com/mgfx/libindicators)
|
|
141
151
|
- [Cloud9Trader Indicators (JavaScript)](https://github.com/Cloud9Trader/TechnicalIndicators)
|
|
142
152
|
- [Crypto Trading Hub Indicators (TypeScript)](https://github.com/anandanand84/technicalindicators)
|
|
153
|
+
- [Jesse Trading Bot Indicators (Python)](https://docs.jesse.trade/docs/indicators/reference.html)
|
|
154
|
+
- [libindicators (C#)](https://github.com/mgfx/libindicators)
|
|
155
|
+
- [Pandas TA (Python)](https://github.com/twopirllc/pandas-ta)
|
|
156
|
+
- [Technical Analysis for Rust (Rust)](https://github.com/greyblake/ta-rs)
|
|
143
157
|
- [Technical Analysis Library using Pandas and Numpy (Python)](https://github.com/bukosabino/ta)
|
|
158
|
+
- [Tulip Indicators (ANSI C)](https://github.com/TulipCharts/tulipindicators)
|
|
144
159
|
|
|
145
160
|
## Maintainers
|
|
146
161
|
|
|
@@ -167,5 +182,6 @@ If you like this project, you might also like these related projects:
|
|
|
167
182
|
- [**binance-api-node**](https://github.com/Ashlar/binance-api-node), Heavily tested and Promise-based Binance API with TypeScript definitions.
|
|
168
183
|
|
|
169
184
|
[1]: http://mikemcl.github.io/big.js/
|
|
185
|
+
[2]: #faster-implementations
|
|
170
186
|
[stack_exchange_bennycode_badge]: https://stackexchange.com/users/flair/203782.png?theme=default
|
|
171
187
|
[stack_exchange_bennycode_url]: https://stackexchange.com/users/203782/benny-neugebauer?tab=accounts
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { BigSource } from 'big.js';
|
|
2
2
|
import { BandsResult } from '../util/BandsResult';
|
|
3
3
|
import { Indicator } from '../Indicator';
|
|
4
|
-
import {
|
|
4
|
+
import { MovingAverageTypes } from '../MA/MovingAverageTypes';
|
|
5
5
|
export declare class AccelerationBands implements Indicator<BandsResult> {
|
|
6
6
|
readonly interval: number;
|
|
7
7
|
readonly width: number;
|
|
8
8
|
private readonly lowerBand;
|
|
9
9
|
private readonly middleBand;
|
|
10
10
|
private readonly upperBand;
|
|
11
|
-
constructor(interval: number, width: number, Indicator?:
|
|
11
|
+
constructor(interval: number, width: number, Indicator?: MovingAverageTypes);
|
|
12
12
|
get isStable(): boolean;
|
|
13
13
|
update(high: BigSource, low: BigSource, close: BigSource): void;
|
|
14
14
|
getResult(): BandsResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccelerationBands.js","sourceRoot":"","sources":["../../src/ABANDS/AccelerationBands.ts"],"names":[],"mappings":";;;;;;AAAA,oCAA+B;AAC/B,oDAAsC;AACtC,oCAA4C;AAM5C,MAAa,iBAAiB;IAyB5B,
|
|
1
|
+
{"version":3,"file":"AccelerationBands.js","sourceRoot":"","sources":["../../src/ABANDS/AccelerationBands.ts"],"names":[],"mappings":";;;;;;AAAA,oCAA+B;AAC/B,oDAAsC;AACtC,oCAA4C;AAM5C,MAAa,iBAAiB;IAyB5B,YAA4B,QAAgB,EAAkB,KAAa,EAAE,YAAgC,SAAG;QAApF,aAAQ,GAAR,QAAQ,CAAQ;QAAkB,UAAK,GAAL,KAAK,CAAQ;QACzE,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC1C,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,QAAQ;QACV,IAAI;YACF,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;SACb;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,KAAK,CAAC;SACd;IACH,CAAC;IAED,MAAM,CAAC,IAAe,EAAE,GAAc,EAAE,KAAgB;QACtD,MAAM,WAAW,GAAG,IAAI,gBAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,gBAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAG1F,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,gBAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,gBAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAEvE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAE9B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,gBAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,gBAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,SAAS;QACP,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,MAAM,IAAI,0BAAkB,EAAE,CAAC;SAChC;QAED,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;YACjC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE;YACnC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;SAClC,CAAC;IACJ,CAAC;CACF;AA9DD,8CA8DC"}
|
package/dist/AC/AC.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BigIndicatorSeries } from '../Indicator';
|
|
2
2
|
import Big, { BigSource } from 'big.js';
|
|
3
3
|
import { AO } from '../AO/AO';
|
|
4
4
|
import { SMA } from '../SMA/SMA';
|
|
5
5
|
import { MOM } from '../MOM/MOM';
|
|
6
|
-
export declare class AC extends
|
|
6
|
+
export declare class AC extends BigIndicatorSeries {
|
|
7
7
|
readonly shortAO: number;
|
|
8
8
|
readonly longAO: number;
|
|
9
9
|
readonly signalInterval: number;
|
|
@@ -11,7 +11,5 @@ export declare class AC extends SimpleIndicator {
|
|
|
11
11
|
readonly momentum: MOM;
|
|
12
12
|
readonly signal: SMA;
|
|
13
13
|
constructor(shortAO: number, longAO: number, signalInterval: number);
|
|
14
|
-
get isStable(): boolean;
|
|
15
|
-
getResult(): Big;
|
|
16
14
|
update(low: BigSource, high: BigSource): void | Big;
|
|
17
15
|
}
|
package/dist/AC/AC.js
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AC = void 0;
|
|
4
4
|
const Indicator_1 = require("../Indicator");
|
|
5
|
-
const error_1 = require("../error");
|
|
6
5
|
const AO_1 = require("../AO/AO");
|
|
7
6
|
const SMA_1 = require("../SMA/SMA");
|
|
8
7
|
const MOM_1 = require("../MOM/MOM");
|
|
9
|
-
class AC extends Indicator_1.
|
|
8
|
+
class AC extends Indicator_1.BigIndicatorSeries {
|
|
10
9
|
constructor(shortAO, longAO, signalInterval) {
|
|
11
10
|
super();
|
|
12
11
|
this.shortAO = shortAO;
|
|
@@ -16,15 +15,6 @@ class AC extends Indicator_1.SimpleIndicator {
|
|
|
16
15
|
this.signal = new SMA_1.SMA(signalInterval);
|
|
17
16
|
this.momentum = new MOM_1.MOM(1);
|
|
18
17
|
}
|
|
19
|
-
get isStable() {
|
|
20
|
-
return this.result !== undefined;
|
|
21
|
-
}
|
|
22
|
-
getResult() {
|
|
23
|
-
if (!this.result) {
|
|
24
|
-
throw new error_1.NotEnoughDataError();
|
|
25
|
-
}
|
|
26
|
-
return this.result;
|
|
27
|
-
}
|
|
28
18
|
update(low, high) {
|
|
29
19
|
const ao = this.ao.update(low, high);
|
|
30
20
|
if (ao) {
|
package/dist/AC/AC.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AC.js","sourceRoot":"","sources":["../../src/AC/AC.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"AC.js","sourceRoot":"","sources":["../../src/AC/AC.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAEhD,iCAA4B;AAC5B,oCAA+B;AAC/B,oCAA+B;AAc/B,MAAa,EAAG,SAAQ,8BAAkB;IAKxC,YAA4B,OAAe,EAAkB,MAAc,EAAkB,cAAsB;QACjH,KAAK,EAAE,CAAC;QADkB,YAAO,GAAP,OAAO,CAAQ;QAAkB,WAAM,GAAN,MAAM,CAAQ;QAAkB,mBAAc,GAAd,cAAc,CAAQ;QAEjH,IAAI,CAAC,EAAE,GAAG,IAAI,OAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,IAAI,SAAG,CAAC,cAAc,CAAC,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,IAAI,SAAG,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;IAEQ,MAAM,CAAC,GAAc,EAAE,IAAe;QAC7C,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACrC,IAAI,EAAE,EAAE;YACN,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACvB,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;gBACxB,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;gBAC/D,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBAC7B,OAAO,IAAI,CAAC,MAAM,CAAC;aACpB;SACF;IACH,CAAC;CACF;AAvBD,gBAuBC"}
|
package/dist/ADX/ADX.d.ts
CHANGED
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
import { Big } from 'big.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
private readonly smoothedPDM;
|
|
14
|
-
private readonly smoothedMDM;
|
|
15
|
-
private readonly dxValues;
|
|
16
|
-
private prevCandle;
|
|
17
|
-
private adx;
|
|
18
|
-
private pdi;
|
|
19
|
-
private mdi;
|
|
20
|
-
constructor(interval: number, SmoothingIndicator?: MovingAverageTypeContext);
|
|
21
|
-
get isStable(): boolean;
|
|
22
|
-
update(candle: HighLowClose): void;
|
|
23
|
-
getResult(): ADXResult;
|
|
24
|
-
private directionalMovement;
|
|
2
|
+
import { BigIndicatorSeries } from '../Indicator';
|
|
3
|
+
import { HighLowClose } from '../util/HighLowClose';
|
|
4
|
+
import { MovingAverageTypes } from '../MA/MovingAverageTypes';
|
|
5
|
+
export declare class ADX extends BigIndicatorSeries {
|
|
6
|
+
readonly interval: number;
|
|
7
|
+
private readonly dx;
|
|
8
|
+
private readonly adx;
|
|
9
|
+
constructor(interval: number, SmoothingIndicator?: MovingAverageTypes);
|
|
10
|
+
get mdi(): Big | void;
|
|
11
|
+
get pdi(): Big | void;
|
|
12
|
+
update(candle: HighLowClose): Big | void;
|
|
25
13
|
}
|
package/dist/ADX/ADX.js
CHANGED
|
@@ -1,78 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ADX = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const Indicator_1 = require("../Indicator");
|
|
5
|
+
const WSMA_1 = require("../WSMA/WSMA");
|
|
6
|
+
const DX_1 = require("../DX/DX");
|
|
7
|
+
class ADX extends Indicator_1.BigIndicatorSeries {
|
|
8
|
+
constructor(interval, SmoothingIndicator = WSMA_1.WSMA) {
|
|
9
|
+
super();
|
|
10
10
|
this.interval = interval;
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
13
|
-
this.pdi = new big_js_1.Big(0);
|
|
14
|
-
this.mdi = new big_js_1.Big(0);
|
|
15
|
-
this.atr = new __1.ATR(interval, SmoothingIndicator);
|
|
16
|
-
this.smoothedPDM = new SmoothingIndicator(interval);
|
|
17
|
-
this.smoothedMDM = new SmoothingIndicator(interval);
|
|
11
|
+
this.dx = new DX_1.DX(interval, SmoothingIndicator);
|
|
12
|
+
this.adx = new SmoothingIndicator(this.interval);
|
|
18
13
|
}
|
|
19
|
-
get
|
|
20
|
-
return this.
|
|
14
|
+
get mdi() {
|
|
15
|
+
return this.dx.mdi;
|
|
16
|
+
}
|
|
17
|
+
get pdi() {
|
|
18
|
+
return this.dx.pdi;
|
|
21
19
|
}
|
|
22
20
|
update(candle) {
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.prevCandle = candle;
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const { mdm, pdm } = this.directionalMovement(this.prevCandle, candle);
|
|
30
|
-
this.smoothedMDM.update(mdm);
|
|
31
|
-
this.smoothedPDM.update(pdm);
|
|
32
|
-
this.prevCandle = candle;
|
|
33
|
-
if (this.candles.length <= this.interval) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
this.pdi = this.smoothedPDM.getResult().div(atrResult).times(100);
|
|
37
|
-
this.mdi = this.smoothedMDM.getResult().div(atrResult).times(100);
|
|
38
|
-
const dx = this.pdi.sub(this.mdi).abs().div(this.pdi.add(this.mdi)).times(100);
|
|
39
|
-
this.dxValues.push(dx);
|
|
40
|
-
if (this.dxValues.length > this.interval) {
|
|
41
|
-
this.dxValues.shift();
|
|
42
|
-
}
|
|
43
|
-
if (this.dxValues.length < this.interval) {
|
|
44
|
-
return;
|
|
21
|
+
const result = this.dx.update(candle);
|
|
22
|
+
if (result) {
|
|
23
|
+
this.adx.update(result);
|
|
45
24
|
}
|
|
46
|
-
if (
|
|
47
|
-
this.
|
|
48
|
-
return;
|
|
25
|
+
if (this.adx.isStable) {
|
|
26
|
+
return this.setResult(this.adx.getResult());
|
|
49
27
|
}
|
|
50
|
-
this.adx = this.adx
|
|
51
|
-
.times(this.interval - 1)
|
|
52
|
-
.add(dx)
|
|
53
|
-
.div(this.interval);
|
|
54
|
-
}
|
|
55
|
-
getResult() {
|
|
56
|
-
if (!this.adx) {
|
|
57
|
-
throw new error_1.NotEnoughDataError();
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
adx: this.adx,
|
|
61
|
-
mdi: this.mdi,
|
|
62
|
-
pdi: this.pdi,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
directionalMovement(prevCandle, currentCandle) {
|
|
66
|
-
const currentHigh = new big_js_1.Big(currentCandle.high);
|
|
67
|
-
const lastHigh = new big_js_1.Big(prevCandle.high);
|
|
68
|
-
const currentLow = new big_js_1.Big(currentCandle.low);
|
|
69
|
-
const lastLow = new big_js_1.Big(prevCandle.low);
|
|
70
|
-
const upMove = currentHigh.sub(lastHigh);
|
|
71
|
-
const downMove = lastLow.sub(currentLow);
|
|
72
|
-
return {
|
|
73
|
-
mdm: downMove.gt(upMove) && downMove.gt(new big_js_1.Big(0)) ? downMove : new big_js_1.Big(0),
|
|
74
|
-
pdm: upMove.gt(downMove) && upMove.gt(new big_js_1.Big(0)) ? upMove : new big_js_1.Big(0),
|
|
75
|
-
};
|
|
76
28
|
}
|
|
77
29
|
}
|
|
78
30
|
exports.ADX = ADX;
|
package/dist/ADX/ADX.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ADX.js","sourceRoot":"","sources":["../../src/ADX/ADX.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ADX.js","sourceRoot":"","sources":["../../src/ADX/ADX.ts"],"names":[],"mappings":";;;AACA,4CAAgD;AAIhD,uCAAkC;AAClC,iCAA4B;AAyB5B,MAAa,GAAI,SAAQ,8BAAkB;IAIzC,YAA4B,QAAgB,EAAE,qBAAyC,WAAI;QACzF,KAAK,EAAE,CAAC;QADkB,aAAQ,GAAR,QAAQ,CAAQ;QAE1C,IAAI,CAAC,EAAE,GAAG,IAAI,OAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;QAC/C,IAAI,CAAC,GAAG,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC;IACrB,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,MAAoB;QACzB,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SACzB;QACD,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE;YACrB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;SAC7C;IACH,CAAC;CACF;AA3BD,kBA2BC"}
|
package/dist/AO/AO.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BigIndicatorSeries } from '../Indicator';
|
|
2
2
|
import Big, { BigSource } from 'big.js';
|
|
3
3
|
import { SMA } from '../SMA/SMA';
|
|
4
|
-
export declare class AO extends
|
|
4
|
+
export declare class AO extends BigIndicatorSeries {
|
|
5
5
|
readonly shortInterval: number;
|
|
6
6
|
readonly longInterval: number;
|
|
7
7
|
readonly long: SMA;
|
|
8
8
|
readonly short: SMA;
|
|
9
9
|
constructor(shortInterval: number, longInterval: number);
|
|
10
|
-
get isStable(): boolean;
|
|
11
|
-
getResult(): Big;
|
|
12
10
|
update(low: BigSource, high: BigSource): void | Big;
|
|
13
11
|
}
|
package/dist/AO/AO.js
CHANGED
|
@@ -7,8 +7,7 @@ exports.AO = void 0;
|
|
|
7
7
|
const Indicator_1 = require("../Indicator");
|
|
8
8
|
const big_js_1 = __importDefault(require("big.js"));
|
|
9
9
|
const SMA_1 = require("../SMA/SMA");
|
|
10
|
-
|
|
11
|
-
class AO extends Indicator_1.SimpleIndicator {
|
|
10
|
+
class AO extends Indicator_1.BigIndicatorSeries {
|
|
12
11
|
constructor(shortInterval, longInterval) {
|
|
13
12
|
super();
|
|
14
13
|
this.shortInterval = shortInterval;
|
|
@@ -16,23 +15,13 @@ class AO extends Indicator_1.SimpleIndicator {
|
|
|
16
15
|
this.short = new SMA_1.SMA(shortInterval);
|
|
17
16
|
this.long = new SMA_1.SMA(longInterval);
|
|
18
17
|
}
|
|
19
|
-
get isStable() {
|
|
20
|
-
return this.result !== undefined;
|
|
21
|
-
}
|
|
22
|
-
getResult() {
|
|
23
|
-
if (!this.result) {
|
|
24
|
-
throw new error_1.NotEnoughDataError();
|
|
25
|
-
}
|
|
26
|
-
return this.result;
|
|
27
|
-
}
|
|
28
18
|
update(low, high) {
|
|
29
19
|
const candleSum = new big_js_1.default(low).add(high);
|
|
30
20
|
const medianPrice = candleSum.div(2);
|
|
31
21
|
this.short.update(medianPrice);
|
|
32
22
|
this.long.update(medianPrice);
|
|
33
23
|
if (this.short.isStable && this.long.isStable) {
|
|
34
|
-
|
|
35
|
-
return result;
|
|
24
|
+
return this.setResult(this.short.getResult().sub(this.long.getResult()));
|
|
36
25
|
}
|
|
37
26
|
}
|
|
38
27
|
}
|
package/dist/AO/AO.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AO.js","sourceRoot":"","sources":["../../src/AO/AO.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"AO.js","sourceRoot":"","sources":["../../src/AO/AO.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAgD;AAChD,oDAAsC;AACtC,oCAA+B;AAgB/B,MAAa,EAAG,SAAQ,8BAAkB;IAIxC,YAA4B,aAAqB,EAAkB,YAAoB;QACrF,KAAK,EAAE,CAAC;QADkB,kBAAa,GAAb,aAAa,CAAQ;QAAkB,iBAAY,GAAZ,YAAY,CAAQ;QAErF,IAAI,CAAC,KAAK,GAAG,IAAI,SAAG,CAAC,aAAa,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,SAAG,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC;IAEQ,MAAM,CAAC,GAAc,EAAE,IAAe;QAC7C,MAAM,SAAS,GAAG,IAAI,gBAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,WAAW,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAErC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAE9B,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAC7C,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;SAC1E;IACH,CAAC;CACF;AArBD,gBAqBC"}
|
package/dist/ATR/ATR.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import Big from 'big.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { HighLowClose } from '../util';
|
|
5
|
-
export declare class ATR extends
|
|
2
|
+
import { BigIndicatorSeries, NumberIndicatorSeries } from '../Indicator';
|
|
3
|
+
import { FasterMovingAverageTypes, MovingAverageTypes } from '../MA/MovingAverageTypes';
|
|
4
|
+
import { HighLowClose, HighLowCloseNumbers } from '../util';
|
|
5
|
+
export declare class ATR extends BigIndicatorSeries {
|
|
6
6
|
readonly interval: number;
|
|
7
|
-
private readonly
|
|
7
|
+
private readonly tr;
|
|
8
8
|
private readonly smoothing;
|
|
9
|
-
|
|
10
|
-
constructor(interval: number, SmoothingIndicator?: MovingAverageTypeContext);
|
|
11
|
-
get isStable(): boolean;
|
|
9
|
+
constructor(interval: number, SmoothingIndicator?: MovingAverageTypes);
|
|
12
10
|
update(candle: HighLowClose): Big | void;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
}
|
|
12
|
+
export declare class FasterATR extends NumberIndicatorSeries {
|
|
13
|
+
readonly interval: number;
|
|
14
|
+
private readonly tr;
|
|
15
|
+
private readonly smoothing;
|
|
16
|
+
constructor(interval: number, SmoothingIndicator?: FasterMovingAverageTypes);
|
|
17
|
+
update(candle: HighLowCloseNumbers): number | void;
|
|
16
18
|
}
|
package/dist/ATR/ATR.js
CHANGED
|
@@ -1,54 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ATR = void 0;
|
|
7
|
-
const big_js_1 = __importDefault(require("big.js"));
|
|
8
|
-
const error_1 = require("../error");
|
|
3
|
+
exports.FasterATR = exports.ATR = void 0;
|
|
9
4
|
const Indicator_1 = require("../Indicator");
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
const TR_1 = require("../TR/TR");
|
|
6
|
+
const WSMA_1 = require("../WSMA/WSMA");
|
|
7
|
+
class ATR extends Indicator_1.BigIndicatorSeries {
|
|
8
|
+
constructor(interval, SmoothingIndicator = WSMA_1.WSMA) {
|
|
13
9
|
super();
|
|
14
10
|
this.interval = interval;
|
|
15
|
-
this.
|
|
11
|
+
this.tr = new TR_1.TR();
|
|
16
12
|
this.smoothing = new SmoothingIndicator(interval);
|
|
17
13
|
}
|
|
18
|
-
get isStable() {
|
|
19
|
-
return this.candles.length > this.interval;
|
|
20
|
-
}
|
|
21
14
|
update(candle) {
|
|
22
|
-
this.
|
|
23
|
-
if (!this.prevCandle) {
|
|
24
|
-
this.prevCandle = candle;
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (this.candles.length > this.interval + 1) {
|
|
28
|
-
this.candles.shift();
|
|
29
|
-
}
|
|
30
|
-
const trueRange = this.trueRange(this.prevCandle, candle);
|
|
15
|
+
const trueRange = this.tr.update(candle);
|
|
31
16
|
this.smoothing.update(trueRange);
|
|
32
|
-
this.prevCandle = candle;
|
|
33
17
|
if (this.smoothing.isStable) {
|
|
34
18
|
return this.setResult(this.smoothing.getResult());
|
|
35
19
|
}
|
|
36
20
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const low = new big_js_1.default(currentCandle.low);
|
|
46
|
-
const high = new big_js_1.default(currentCandle.high);
|
|
47
|
-
return this.getMaximum([high.sub(low), high.sub(prevClose).abs(), low.sub(prevClose).abs()]);
|
|
21
|
+
}
|
|
22
|
+
exports.ATR = ATR;
|
|
23
|
+
class FasterATR extends Indicator_1.NumberIndicatorSeries {
|
|
24
|
+
constructor(interval, SmoothingIndicator = WSMA_1.FasterWSMA) {
|
|
25
|
+
super();
|
|
26
|
+
this.interval = interval;
|
|
27
|
+
this.tr = new TR_1.FasterTR();
|
|
28
|
+
this.smoothing = new SmoothingIndicator(interval);
|
|
48
29
|
}
|
|
49
|
-
|
|
50
|
-
|
|
30
|
+
update(candle) {
|
|
31
|
+
const trueRange = this.tr.update(candle);
|
|
32
|
+
this.smoothing.update(trueRange);
|
|
33
|
+
if (this.smoothing.isStable) {
|
|
34
|
+
return this.setResult(this.smoothing.getResult());
|
|
35
|
+
}
|
|
51
36
|
}
|
|
52
37
|
}
|
|
53
|
-
exports.
|
|
38
|
+
exports.FasterATR = FasterATR;
|
|
54
39
|
//# sourceMappingURL=ATR.js.map
|
package/dist/ATR/ATR.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ATR.js","sourceRoot":"","sources":["../../src/ATR/ATR.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ATR.js","sourceRoot":"","sources":["../../src/ATR/ATR.ts"],"names":[],"mappings":";;;AACA,4CAAuE;AAGvE,iCAAsC;AAEtC,uCAA8C;AAY9C,MAAa,GAAI,SAAQ,8BAAkB;IAIzC,YAA4B,QAAgB,EAAE,qBAAyC,WAAI;QACzF,KAAK,EAAE,CAAC;QADkB,aAAQ,GAAR,QAAQ,CAAQ;QAE1C,IAAI,CAAC,EAAE,GAAG,IAAI,OAAE,EAAE,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,IAAI,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC;IAEQ,MAAM,CAAC,MAAoB;QAClC,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACjC,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;YAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC;SACnD;IACH,CAAC;CACF;AAjBD,kBAiBC;AAED,MAAa,SAAU,SAAQ,iCAAqB;IAIlD,YAA4B,QAAgB,EAAE,qBAA+C,iBAAU;QACrG,KAAK,EAAE,CAAC;QADkB,aAAQ,GAAR,QAAQ,CAAQ;QAE1C,IAAI,CAAC,EAAE,GAAG,IAAI,aAAQ,EAAE,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,IAAI,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,CAAC,MAA2B;QAChC,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACjC,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;YAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC;SACnD;IACH,CAAC;CACF;AAjBD,8BAiBC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Big, { BigSource } from 'big.js';
|
|
2
2
|
import { BandsResult, FasterBandsResult } from '../util/BandsResult';
|
|
3
|
-
import {
|
|
3
|
+
import { Indicator } from '../Indicator';
|
|
4
4
|
export declare class BollingerBands implements Indicator<BandsResult> {
|
|
5
5
|
readonly interval: number;
|
|
6
6
|
readonly deviationMultiplier: number;
|
|
@@ -8,16 +8,16 @@ export declare class BollingerBands implements Indicator<BandsResult> {
|
|
|
8
8
|
private result;
|
|
9
9
|
constructor(interval: number, deviationMultiplier?: number);
|
|
10
10
|
get isStable(): boolean;
|
|
11
|
-
update(price: BigSource): void;
|
|
11
|
+
update(price: BigSource): void | BandsResult;
|
|
12
12
|
getResult(): BandsResult;
|
|
13
13
|
}
|
|
14
|
-
export declare class FasterBollingerBands implements
|
|
14
|
+
export declare class FasterBollingerBands implements Indicator<FasterBandsResult> {
|
|
15
15
|
readonly interval: number;
|
|
16
16
|
readonly deviationMultiplier: number;
|
|
17
17
|
readonly prices: number[];
|
|
18
18
|
private result;
|
|
19
19
|
constructor(interval: number, deviationMultiplier?: number);
|
|
20
|
-
update(price: number): void;
|
|
20
|
+
update(price: number): void | FasterBandsResult;
|
|
21
21
|
getResult(): FasterBandsResult;
|
|
22
22
|
get isStable(): boolean;
|
|
23
23
|
}
|
|
@@ -27,11 +27,11 @@ class BollingerBands {
|
|
|
27
27
|
}
|
|
28
28
|
const middle = SMA_1.SMA.getResultFromBatch(this.prices);
|
|
29
29
|
const standardDeviation = (0, util_1.getStandardDeviation)(this.prices, middle);
|
|
30
|
-
this.result = {
|
|
30
|
+
return (this.result = {
|
|
31
31
|
lower: middle.sub(standardDeviation.times(this.deviationMultiplier)),
|
|
32
32
|
middle,
|
|
33
33
|
upper: middle.add(standardDeviation.times(this.deviationMultiplier)),
|
|
34
|
-
};
|
|
34
|
+
});
|
|
35
35
|
}
|
|
36
36
|
getResult() {
|
|
37
37
|
if (!this.result) {
|
|
@@ -54,11 +54,11 @@ class FasterBollingerBands {
|
|
|
54
54
|
}
|
|
55
55
|
const middle = (0, util_1.getFasterAverage)(this.prices);
|
|
56
56
|
const standardDeviation = (0, util_1.getFasterStandardDeviation)(this.prices, middle);
|
|
57
|
-
this.result = {
|
|
57
|
+
return (this.result = {
|
|
58
58
|
lower: middle - standardDeviation * this.deviationMultiplier,
|
|
59
59
|
middle,
|
|
60
60
|
upper: middle + standardDeviation * this.deviationMultiplier,
|
|
61
|
-
};
|
|
61
|
+
});
|
|
62
62
|
}
|
|
63
63
|
getResult() {
|
|
64
64
|
if (!this.result) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BollingerBands.js","sourceRoot":"","sources":["../../src/BBANDS/BollingerBands.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAsC;AACtC,oCAA+B;AAC/B,oCAA4C;AAG5C,kCAA2F;AAiB3F,MAAa,cAAc;IAIzB,YAA4B,QAAgB,EAAkB,sBAA8B,CAAC;QAAjE,aAAQ,GAAR,QAAQ,CAAQ;QAAkB,wBAAmB,GAAnB,mBAAmB,CAAY;QAH7E,WAAM,GAAU,EAAE,CAAC;IAG6D,CAAC;IAEjG,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,QAAQ,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,KAAgB;QACrB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,gBAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QAEjC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE;YACtC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;SACrB;QAED,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO;SACR;QAED,MAAM,MAAM,GAAG,SAAG,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnD,MAAM,iBAAiB,GAAG,IAAA,2BAAoB,EAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAEpE,IAAI,CAAC,MAAM,GAAG;
|
|
1
|
+
{"version":3,"file":"BollingerBands.js","sourceRoot":"","sources":["../../src/BBANDS/BollingerBands.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAsC;AACtC,oCAA+B;AAC/B,oCAA4C;AAG5C,kCAA2F;AAiB3F,MAAa,cAAc;IAIzB,YAA4B,QAAgB,EAAkB,sBAA8B,CAAC;QAAjE,aAAQ,GAAR,QAAQ,CAAQ;QAAkB,wBAAmB,GAAnB,mBAAmB,CAAY;QAH7E,WAAM,GAAU,EAAE,CAAC;IAG6D,CAAC;IAEjG,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,QAAQ,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,KAAgB;QACrB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,gBAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QAEjC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE;YACtC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;SACrB;QAED,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO;SACR;QAED,MAAM,MAAM,GAAG,SAAG,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnD,MAAM,iBAAiB,GAAG,IAAA,2BAAoB,EAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAEpE,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG;YACpB,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACpE,MAAM;YACN,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;SACrE,CAAC,CAAC;IACL,CAAC;IAED,SAAS;QACP,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,MAAM,IAAI,0BAAkB,EAAE,CAAC;SAChC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AAtCD,wCAsCC;AAED,MAAa,oBAAoB;IAI/B,YAA4B,QAAgB,EAAkB,sBAA8B,CAAC;QAAjE,aAAQ,GAAR,QAAQ,CAAQ;QAAkB,wBAAmB,GAAnB,mBAAmB,CAAY;QAH7E,WAAM,GAAa,EAAE,CAAC;IAG0D,CAAC;IAEjG,MAAM,CAAC,KAAa;QAClB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAExB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE;YACtC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;SACrB;QAED,MAAM,MAAM,GAAG,IAAA,uBAAgB,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7C,MAAM,iBAAiB,GAAG,IAAA,iCAA0B,EAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAE1E,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG;YACpB,KAAK,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAAC,mBAAmB;YAC5D,MAAM;YACN,KAAK,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAAC,mBAAmB;SAC7D,CAAC,CAAC;IACL,CAAC;IAED,SAAS;QACP,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,MAAM,IAAI,0BAAkB,EAAE,CAAC;SAChC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,QAAQ,CAAC;IAC9C,CAAC;CACF;AAlCD,oDAkCC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BigIndicatorSeries, NumberIndicatorSeries } from '../Indicator';
|
|
2
|
+
import { Big, BigSource } from 'big.js';
|
|
3
|
+
import { HighLowClose, HighLowCloseNumbers } from '../util';
|
|
4
|
+
export declare class CCI extends BigIndicatorSeries {
|
|
5
|
+
readonly interval: number;
|
|
6
|
+
readonly prices: BigSource[];
|
|
7
|
+
protected result?: Big;
|
|
8
|
+
private readonly sma;
|
|
9
|
+
private readonly typicalPrices;
|
|
10
|
+
constructor(interval: number);
|
|
11
|
+
update(candle: HighLowClose): void | Big;
|
|
12
|
+
private cacheTypicalPrice;
|
|
13
|
+
}
|
|
14
|
+
export declare class FasterCCI extends NumberIndicatorSeries {
|
|
15
|
+
readonly interval: number;
|
|
16
|
+
readonly prices: number[];
|
|
17
|
+
protected result?: number;
|
|
18
|
+
private readonly sma;
|
|
19
|
+
private readonly typicalPrices;
|
|
20
|
+
constructor(interval: number);
|
|
21
|
+
update(candle: HighLowCloseNumbers): void | number;
|
|
22
|
+
private cacheTypicalPrice;
|
|
23
|
+
}
|