@tradingaction/indicators 2.0.1
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 +24 -0
- package/README.md +5 -0
- package/lib/calculator/atr.d.ts +18 -0
- package/lib/calculator/atr.js +51 -0
- package/lib/calculator/atr.js.map +1 -0
- package/lib/calculator/bollingerband.d.ts +14 -0
- package/lib/calculator/bollingerband.js +72 -0
- package/lib/calculator/bollingerband.js.map +1 -0
- package/lib/calculator/change.d.ts +14 -0
- package/lib/calculator/change.js +30 -0
- package/lib/calculator/change.js.map +1 -0
- package/lib/calculator/compare.d.ts +10 -0
- package/lib/calculator/compare.js +50 -0
- package/lib/calculator/compare.js.map +1 -0
- package/lib/calculator/defaultOptionsForComputation.d.ts +91 -0
- package/lib/calculator/defaultOptionsForComputation.js +100 -0
- package/lib/calculator/defaultOptionsForComputation.js.map +1 -0
- package/lib/calculator/elderRay.d.ts +23 -0
- package/lib/calculator/elderRay.js +69 -0
- package/lib/calculator/elderRay.js.map +1 -0
- package/lib/calculator/ema.d.ts +12 -0
- package/lib/calculator/ema.js +73 -0
- package/lib/calculator/ema.js.map +1 -0
- package/lib/calculator/forceIndex.d.ts +12 -0
- package/lib/calculator/forceIndex.js +27 -0
- package/lib/calculator/forceIndex.js.map +1 -0
- package/lib/calculator/heikinAshi.d.ts +4 -0
- package/lib/calculator/heikinAshi.js +30 -0
- package/lib/calculator/heikinAshi.js.map +1 -0
- package/lib/calculator/index.d.ts +19 -0
- package/lib/calculator/index.js +20 -0
- package/lib/calculator/index.js.map +1 -0
- package/lib/calculator/kagi.d.ts +11 -0
- package/lib/calculator/kagi.js +200 -0
- package/lib/calculator/kagi.js.map +1 -0
- package/lib/calculator/macd.d.ts +18 -0
- package/lib/calculator/macd.js +57 -0
- package/lib/calculator/macd.js.map +1 -0
- package/lib/calculator/pointAndFigure.d.ts +10 -0
- package/lib/calculator/pointAndFigure.js +215 -0
- package/lib/calculator/pointAndFigure.js.map +1 -0
- package/lib/calculator/renko.d.ts +12 -0
- package/lib/calculator/renko.js +170 -0
- package/lib/calculator/renko.js.map +1 -0
- package/lib/calculator/rsi.d.ts +12 -0
- package/lib/calculator/rsi.js +87 -0
- package/lib/calculator/rsi.js.map +1 -0
- package/lib/calculator/sar.d.ts +12 -0
- package/lib/calculator/sar.js +87 -0
- package/lib/calculator/sar.js.map +1 -0
- package/lib/calculator/sma.d.ts +12 -0
- package/lib/calculator/sma.js +27 -0
- package/lib/calculator/sma.js.map +1 -0
- package/lib/calculator/smoothedForceIndex.d.ts +13 -0
- package/lib/calculator/smoothedForceIndex.js +40 -0
- package/lib/calculator/smoothedForceIndex.js.map +1 -0
- package/lib/calculator/sto.d.ts +19 -0
- package/lib/calculator/sto.js +91 -0
- package/lib/calculator/sto.js.map +1 -0
- package/lib/calculator/tma.d.ts +12 -0
- package/lib/calculator/tma.js +66 -0
- package/lib/calculator/tma.js.map +1 -0
- package/lib/calculator/wma.d.ts +12 -0
- package/lib/calculator/wma.js +33 -0
- package/lib/calculator/wma.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/indicator/algorithm.d.ts +10 -0
- package/lib/indicator/algorithm.js +35 -0
- package/lib/indicator/algorithm.js.map +1 -0
- package/lib/indicator/atr.d.ts +26 -0
- package/lib/indicator/atr.js +27 -0
- package/lib/indicator/atr.js.map +1 -0
- package/lib/indicator/baseIndicator.d.ts +16 -0
- package/lib/indicator/baseIndicator.js +59 -0
- package/lib/indicator/baseIndicator.js.map +1 -0
- package/lib/indicator/bollingerBand.d.ts +24 -0
- package/lib/indicator/bollingerBand.js +27 -0
- package/lib/indicator/bollingerBand.js.map +1 -0
- package/lib/indicator/change.d.ts +24 -0
- package/lib/indicator/change.js +25 -0
- package/lib/indicator/change.js.map +1 -0
- package/lib/indicator/compare.d.ts +24 -0
- package/lib/indicator/compare.js +29 -0
- package/lib/indicator/compare.js.map +1 -0
- package/lib/indicator/defaultOptionsForAppearance.d.ts +105 -0
- package/lib/indicator/defaultOptionsForAppearance.js +77 -0
- package/lib/indicator/defaultOptionsForAppearance.js.map +1 -0
- package/lib/indicator/elderImpulse.d.ts +7 -0
- package/lib/indicator/elderImpulse.js +61 -0
- package/lib/indicator/elderImpulse.js.map +1 -0
- package/lib/indicator/elderRay.d.ts +24 -0
- package/lib/indicator/elderRay.js +29 -0
- package/lib/indicator/elderRay.js.map +1 -0
- package/lib/indicator/ema.d.ts +24 -0
- package/lib/indicator/ema.js +29 -0
- package/lib/indicator/ema.js.map +1 -0
- package/lib/indicator/forceIndex.d.ts +24 -0
- package/lib/indicator/forceIndex.js +29 -0
- package/lib/indicator/forceIndex.js.map +1 -0
- package/lib/indicator/heikinAshi.d.ts +3 -0
- package/lib/indicator/heikinAshi.js +28 -0
- package/lib/indicator/heikinAshi.js.map +1 -0
- package/lib/indicator/index.d.ts +23 -0
- package/lib/indicator/index.js +24 -0
- package/lib/indicator/index.js.map +1 -0
- package/lib/indicator/kagi.d.ts +11 -0
- package/lib/indicator/kagi.js +13 -0
- package/lib/indicator/kagi.js.map +1 -0
- package/lib/indicator/macd.d.ts +24 -0
- package/lib/indicator/macd.js +32 -0
- package/lib/indicator/macd.js.map +1 -0
- package/lib/indicator/pointAndFigure.d.ts +10 -0
- package/lib/indicator/pointAndFigure.js +13 -0
- package/lib/indicator/pointAndFigure.js.map +1 -0
- package/lib/indicator/renko.d.ts +12 -0
- package/lib/indicator/renko.js +13 -0
- package/lib/indicator/renko.js.map +1 -0
- package/lib/indicator/rsi.d.ts +24 -0
- package/lib/indicator/rsi.js +29 -0
- package/lib/indicator/rsi.js.map +1 -0
- package/lib/indicator/sar.d.ts +24 -0
- package/lib/indicator/sar.js +29 -0
- package/lib/indicator/sar.js.map +1 -0
- package/lib/indicator/sma.d.ts +24 -0
- package/lib/indicator/sma.js +29 -0
- package/lib/indicator/sma.js.map +1 -0
- package/lib/indicator/stochasticOscillator.d.ts +24 -0
- package/lib/indicator/stochasticOscillator.js +27 -0
- package/lib/indicator/stochasticOscillator.js.map +1 -0
- package/lib/indicator/tma.d.ts +24 -0
- package/lib/indicator/tma.js +29 -0
- package/lib/indicator/tma.js.map +1 -0
- package/lib/indicator/wma.d.ts +24 -0
- package/lib/indicator/wma.js +29 -0
- package/lib/indicator/wma.js.map +1 -0
- package/lib/utils/functor.d.ts +1 -0
- package/lib/utils/functor.js +4 -0
- package/lib/utils/functor.js.map +1 -0
- package/lib/utils/identity.d.ts +1 -0
- package/lib/utils/identity.js +2 -0
- package/lib/utils/identity.js.map +1 -0
- package/lib/utils/index.d.ts +8 -0
- package/lib/utils/index.js +9 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/mappedSlidingWindow.d.ts +15 -0
- package/lib/utils/mappedSlidingWindow.js +77 -0
- package/lib/utils/mappedSlidingWindow.js.map +1 -0
- package/lib/utils/merge.d.ts +11 -0
- package/lib/utils/merge.js +70 -0
- package/lib/utils/merge.js.map +1 -0
- package/lib/utils/path.d.ts +1 -0
- package/lib/utils/path.js +15 -0
- package/lib/utils/path.js.map +1 -0
- package/lib/utils/rebind.d.ts +1 -0
- package/lib/utils/rebind.js +18 -0
- package/lib/utils/rebind.js.map +1 -0
- package/lib/utils/slidingWindow.d.ts +19 -0
- package/lib/utils/slidingWindow.js +111 -0
- package/lib/utils/slidingWindow.js.map +1 -0
- package/lib/utils/zipper.d.ts +7 -0
- package/lib/utils/zipper.js +36 -0
- package/lib/utils/zipper.js.map +1 -0
- package/package.json +49 -0
- package/src/calculator/atr.ts +88 -0
- package/src/calculator/bollingerband.ts +102 -0
- package/src/calculator/change.ts +53 -0
- package/src/calculator/compare.ts +68 -0
- package/src/calculator/defaultOptionsForComputation.ts +117 -0
- package/src/calculator/elderRay.ts +90 -0
- package/src/calculator/ema.ts +92 -0
- package/src/calculator/forceIndex.ts +43 -0
- package/src/calculator/heikinAshi.ts +38 -0
- package/src/calculator/index.ts +19 -0
- package/src/calculator/kagi.ts +249 -0
- package/src/calculator/macd.ts +90 -0
- package/src/calculator/pointAndFigure.ts +255 -0
- package/src/calculator/renko.ts +227 -0
- package/src/calculator/rsi.ts +114 -0
- package/src/calculator/sar.ts +117 -0
- package/src/calculator/sma.ts +41 -0
- package/src/calculator/smoothedForceIndex.ts +53 -0
- package/src/calculator/sto.ts +118 -0
- package/src/calculator/tma.ts +82 -0
- package/src/calculator/wma.ts +49 -0
- package/src/index.ts +1 -0
- package/src/indicator/algorithm.ts +53 -0
- package/src/indicator/atr.ts +58 -0
- package/src/indicator/baseIndicator.ts +97 -0
- package/src/indicator/bollingerBand.ts +55 -0
- package/src/indicator/change.ts +51 -0
- package/src/indicator/compare.ts +57 -0
- package/src/indicator/defaultOptionsForAppearance.ts +77 -0
- package/src/indicator/elderImpulse.ts +73 -0
- package/src/indicator/elderRay.ts +56 -0
- package/src/indicator/ema.ts +58 -0
- package/src/indicator/forceIndex.ts +57 -0
- package/src/indicator/heikinAshi.ts +35 -0
- package/src/indicator/index.ts +25 -0
- package/src/indicator/kagi.ts +18 -0
- package/src/indicator/macd.ts +60 -0
- package/src/indicator/pointAndFigure.ts +18 -0
- package/src/indicator/renko.ts +18 -0
- package/src/indicator/rsi.ts +58 -0
- package/src/indicator/sar.ts +56 -0
- package/src/indicator/sma.ts +57 -0
- package/src/indicator/stochasticOscillator.ts +56 -0
- package/src/indicator/tma.ts +57 -0
- package/src/indicator/wma.ts +58 -0
- package/src/utils/functor.ts +3 -0
- package/src/utils/identity.ts +1 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/mappedSlidingWindow.ts +95 -0
- package/src/utils/merge.ts +93 -0
- package/src/utils/path.ts +16 -0
- package/src/utils/rebind.ts +19 -0
- package/src/utils/slidingWindow.ts +142 -0
- package/src/utils/zipper.ts +45 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { change } from "../calculator";
|
|
2
|
+
import { merge, rebind } from "../utils";
|
|
3
|
+
import baseIndicator from "./baseIndicator";
|
|
4
|
+
const ALGORITHM_TYPE = "Change";
|
|
5
|
+
export default function () {
|
|
6
|
+
const base = baseIndicator().type(ALGORITHM_TYPE);
|
|
7
|
+
const underlyingAlgorithm = change();
|
|
8
|
+
const mergedAlgorithm = merge()
|
|
9
|
+
.algorithm(underlyingAlgorithm)
|
|
10
|
+
.merge((datum, i) => {
|
|
11
|
+
datum.absoluteChange = i.absoluteChange;
|
|
12
|
+
datum.percentChange = i.percentChange;
|
|
13
|
+
});
|
|
14
|
+
const indicator = (data, options = { merge: true }) => {
|
|
15
|
+
if (options.merge) {
|
|
16
|
+
return mergedAlgorithm(data);
|
|
17
|
+
}
|
|
18
|
+
return underlyingAlgorithm(data);
|
|
19
|
+
};
|
|
20
|
+
rebind(indicator, base, "id", "accessor", "stroke", "fill", "echo", "type");
|
|
21
|
+
rebind(indicator, underlyingAlgorithm, "options");
|
|
22
|
+
rebind(indicator, mergedAlgorithm, "merge", "skipUndefined");
|
|
23
|
+
return indicator;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=change.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change.js","sourceRoot":"","sources":["../../src/indicator/change.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,MAAM,cAAc,GAAG,QAAQ,CAAC;AAsBhC,MAAM,CAAC,OAAO;IACV,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAElD,MAAM,mBAAmB,GAAG,MAAM,EAAE,CAAC;IAErC,MAAM,eAAe,GAAG,KAAK,EAAE;SAC1B,SAAS,CAAC,mBAAmB,CAAC;SAC9B,KAAK,CAAC,CAAC,KAAU,EAAE,CAAM,EAAE,EAAE;QAC1B,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,cAAc,CAAC;QACxC,KAAK,CAAC,aAAa,GAAG,CAAC,CAAC,aAAa,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEP,MAAM,SAAS,GAAG,CAAC,IAAW,EAAE,OAAO,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;QACzD,IAAI,OAAO,CAAC,KAAK,EAAE;YACf,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;SAChC;QACD,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC,CAAC;IACF,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5E,MAAM,CAAC,SAAS,EAAE,mBAAmB,EAAE,SAAS,CAAC,CAAC;IAClD,MAAM,CAAC,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;IAE7D,OAAO,SAA4B,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CompareOptions } from "../calculator/compare";
|
|
2
|
+
interface CompareIndicator {
|
|
3
|
+
(data: any[], options?: {
|
|
4
|
+
merge: boolean;
|
|
5
|
+
}): any;
|
|
6
|
+
id(): number;
|
|
7
|
+
id(x: number): CompareIndicator;
|
|
8
|
+
accessor(): any;
|
|
9
|
+
accessor(x: any): CompareIndicator;
|
|
10
|
+
stroke(): string | any;
|
|
11
|
+
stroke(x: string | any): CompareIndicator;
|
|
12
|
+
fill(): string | any;
|
|
13
|
+
fill(x: string | any): CompareIndicator;
|
|
14
|
+
echo(): any;
|
|
15
|
+
echo(x: any): CompareIndicator;
|
|
16
|
+
type(): string;
|
|
17
|
+
type(x: string): CompareIndicator;
|
|
18
|
+
merge(): any;
|
|
19
|
+
merge(newMerge: any): CompareIndicator;
|
|
20
|
+
options(): CompareOptions;
|
|
21
|
+
options(newOptions: CompareOptions): CompareIndicator;
|
|
22
|
+
}
|
|
23
|
+
export default function (): CompareIndicator;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { merge, rebind } from "../utils";
|
|
2
|
+
import { compare } from "../calculator";
|
|
3
|
+
import baseIndicator from "./baseIndicator";
|
|
4
|
+
const ALGORITHM_TYPE = "Compare";
|
|
5
|
+
export default function () {
|
|
6
|
+
const base = baseIndicator()
|
|
7
|
+
.type(ALGORITHM_TYPE)
|
|
8
|
+
.accessor((d) => d.compare);
|
|
9
|
+
const underlyingAlgorithm = compare();
|
|
10
|
+
const mergedAlgorithm = merge()
|
|
11
|
+
.algorithm(underlyingAlgorithm)
|
|
12
|
+
.merge((datum, i) => {
|
|
13
|
+
datum.compare = i;
|
|
14
|
+
});
|
|
15
|
+
const indicator = (data, options = { merge: true }) => {
|
|
16
|
+
if (options.merge) {
|
|
17
|
+
if (!base.accessor()) {
|
|
18
|
+
throw new Error(`Set an accessor to ${ALGORITHM_TYPE} before calculating`);
|
|
19
|
+
}
|
|
20
|
+
return mergedAlgorithm(data);
|
|
21
|
+
}
|
|
22
|
+
return underlyingAlgorithm(data);
|
|
23
|
+
};
|
|
24
|
+
rebind(indicator, base, "id", "accessor", "stroke", "fill", "echo", "type");
|
|
25
|
+
rebind(indicator, underlyingAlgorithm, "options");
|
|
26
|
+
rebind(indicator, mergedAlgorithm, "merge");
|
|
27
|
+
return indicator;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=compare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../src/indicator/compare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,MAAM,cAAc,GAAG,SAAS,CAAC;AAsBjC,MAAM,CAAC,OAAO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|
|
10
|
+
};
|
|
11
|
+
ElderImpulse: {
|
|
12
|
+
stroke: {
|
|
13
|
+
up: string;
|
|
14
|
+
down: string;
|
|
15
|
+
neutral: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
MACD: {
|
|
19
|
+
fill: {
|
|
20
|
+
divergence: string;
|
|
21
|
+
};
|
|
22
|
+
stroke: {
|
|
23
|
+
macd: string;
|
|
24
|
+
signal: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
FullStochasticOscillator: {
|
|
28
|
+
stroke: {
|
|
29
|
+
top: string;
|
|
30
|
+
middle: string;
|
|
31
|
+
bottom: string;
|
|
32
|
+
dLine: string;
|
|
33
|
+
kLine: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
dark: {
|
|
38
|
+
BollingerBand: {
|
|
39
|
+
stroke: {
|
|
40
|
+
top: string;
|
|
41
|
+
middle: string;
|
|
42
|
+
bottom: string;
|
|
43
|
+
};
|
|
44
|
+
fill: string;
|
|
45
|
+
};
|
|
46
|
+
ElderImpulse: {
|
|
47
|
+
stroke: {
|
|
48
|
+
up: string;
|
|
49
|
+
down: string;
|
|
50
|
+
neutral: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
MACD: {
|
|
54
|
+
fill: {
|
|
55
|
+
divergence: string;
|
|
56
|
+
};
|
|
57
|
+
stroke: {
|
|
58
|
+
macd: string;
|
|
59
|
+
signal: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
FullStochasticOscillator: {
|
|
63
|
+
stroke: {
|
|
64
|
+
top: string;
|
|
65
|
+
middle: string;
|
|
66
|
+
bottom: string;
|
|
67
|
+
dLine: string;
|
|
68
|
+
kLine: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export declare const BollingerBand: {
|
|
74
|
+
stroke: {
|
|
75
|
+
top: string;
|
|
76
|
+
middle: string;
|
|
77
|
+
bottom: string;
|
|
78
|
+
};
|
|
79
|
+
fill: string;
|
|
80
|
+
};
|
|
81
|
+
export declare const ElderImpulse: {
|
|
82
|
+
stroke: {
|
|
83
|
+
up: string;
|
|
84
|
+
down: string;
|
|
85
|
+
neutral: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export declare const MACD: {
|
|
89
|
+
fill: {
|
|
90
|
+
divergence: string;
|
|
91
|
+
};
|
|
92
|
+
stroke: {
|
|
93
|
+
macd: string;
|
|
94
|
+
signal: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export declare const FullStochasticOscillator: {
|
|
98
|
+
stroke: {
|
|
99
|
+
top: string;
|
|
100
|
+
middle: string;
|
|
101
|
+
bottom: string;
|
|
102
|
+
dLine: string;
|
|
103
|
+
kLine: string;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export const themes = {
|
|
2
|
+
light: {
|
|
3
|
+
BollingerBand: {
|
|
4
|
+
stroke: {
|
|
5
|
+
top: "#964B00",
|
|
6
|
+
middle: "#000000",
|
|
7
|
+
bottom: "#964B00",
|
|
8
|
+
},
|
|
9
|
+
fill: "#4682B4",
|
|
10
|
+
},
|
|
11
|
+
ElderImpulse: {
|
|
12
|
+
stroke: {
|
|
13
|
+
up: "#6BA583",
|
|
14
|
+
down: "#FF0000",
|
|
15
|
+
neutral: "#0000FF",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
MACD: {
|
|
19
|
+
fill: {
|
|
20
|
+
divergence: "#4682B4",
|
|
21
|
+
},
|
|
22
|
+
stroke: {
|
|
23
|
+
macd: "#FF0000",
|
|
24
|
+
signal: "#00F300",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
FullStochasticOscillator: {
|
|
28
|
+
stroke: {
|
|
29
|
+
top: "#37a600",
|
|
30
|
+
middle: "#b8ab00",
|
|
31
|
+
bottom: "#37a600",
|
|
32
|
+
dLine: "#17becf",
|
|
33
|
+
kLine: "#ff7f0e",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
dark: {
|
|
38
|
+
BollingerBand: {
|
|
39
|
+
stroke: {
|
|
40
|
+
top: "#964B00",
|
|
41
|
+
middle: "#FF6600",
|
|
42
|
+
bottom: "#964B00",
|
|
43
|
+
},
|
|
44
|
+
fill: "#4682B4",
|
|
45
|
+
},
|
|
46
|
+
ElderImpulse: {
|
|
47
|
+
stroke: {
|
|
48
|
+
up: "#6BA583",
|
|
49
|
+
down: "#FF0000",
|
|
50
|
+
neutral: "#0000FF",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
MACD: {
|
|
54
|
+
fill: {
|
|
55
|
+
divergence: "#FF6600",
|
|
56
|
+
},
|
|
57
|
+
stroke: {
|
|
58
|
+
macd: "#ea2bff",
|
|
59
|
+
signal: "#74d400",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
FullStochasticOscillator: {
|
|
63
|
+
stroke: {
|
|
64
|
+
top: "#37a600",
|
|
65
|
+
middle: "#b8ab00",
|
|
66
|
+
bottom: "#37a600",
|
|
67
|
+
dLine: "#ea2bff",
|
|
68
|
+
kLine: "#74d400",
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
export const BollingerBand = themes.light.BollingerBand;
|
|
74
|
+
export const ElderImpulse = themes.light.ElderImpulse;
|
|
75
|
+
export const MACD = themes.light.MACD;
|
|
76
|
+
export const FullStochasticOscillator = themes.light.FullStochasticOscillator;
|
|
77
|
+
//# sourceMappingURL=defaultOptionsForAppearance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultOptionsForAppearance.js","sourceRoot":"","sources":["../../src/indicator/defaultOptionsForAppearance.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG;IAClB,KAAK,EAAE;QACH,aAAa,EAAE;YAC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,CAAC,aAAa,CAAC;AACxD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC;AACtD,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;AACtC,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { merge, rebind, slidingWindow } from "../utils";
|
|
2
|
+
import baseIndicator from "./baseIndicator";
|
|
3
|
+
import { ElderImpulse as appearanceOptions } from "./defaultOptionsForAppearance";
|
|
4
|
+
const ALGORITHM_TYPE = "ElderImpulse";
|
|
5
|
+
export default function () {
|
|
6
|
+
let macdSource;
|
|
7
|
+
let emaSource;
|
|
8
|
+
const base = baseIndicator().type(ALGORITHM_TYPE).stroke(appearanceOptions.stroke).fill(undefined);
|
|
9
|
+
const underlyingAlgorithm = slidingWindow()
|
|
10
|
+
.windowSize(2)
|
|
11
|
+
.undefinedValue("neutral")
|
|
12
|
+
.accumulator(([prev, curr]) => {
|
|
13
|
+
if (macdSource === undefined) {
|
|
14
|
+
throw new Error(`macdSource not defined for ${ALGORITHM_TYPE} calculator`);
|
|
15
|
+
}
|
|
16
|
+
if (emaSource === undefined) {
|
|
17
|
+
throw new Error(`emaSource not defined for ${ALGORITHM_TYPE} calculator`);
|
|
18
|
+
}
|
|
19
|
+
const prevMacd = macdSource(prev);
|
|
20
|
+
const prevEMA = emaSource(prev);
|
|
21
|
+
if (prevMacd !== undefined && prevEMA !== undefined) {
|
|
22
|
+
const prevMACDDivergence = prevMacd.divergence;
|
|
23
|
+
const currMACDDivergence = macdSource(curr).divergence;
|
|
24
|
+
const currEMA = emaSource(curr);
|
|
25
|
+
if (currMACDDivergence >= prevMACDDivergence && currEMA >= prevEMA) {
|
|
26
|
+
return "up";
|
|
27
|
+
}
|
|
28
|
+
if (currMACDDivergence <= prevMACDDivergence && currEMA <= prevEMA) {
|
|
29
|
+
return "down";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return "neutral";
|
|
33
|
+
});
|
|
34
|
+
const mergedAlgorithm = merge()
|
|
35
|
+
.algorithm(underlyingAlgorithm)
|
|
36
|
+
.merge((datum, i) => {
|
|
37
|
+
datum.elderImpulse = i;
|
|
38
|
+
});
|
|
39
|
+
const indicator = function (data, options = { merge: true }) {
|
|
40
|
+
const newData = options.merge ? mergedAlgorithm(data) : underlyingAlgorithm(data);
|
|
41
|
+
return newData;
|
|
42
|
+
};
|
|
43
|
+
indicator.macdSource = function (x) {
|
|
44
|
+
if (!arguments.length) {
|
|
45
|
+
return macdSource;
|
|
46
|
+
}
|
|
47
|
+
macdSource = x;
|
|
48
|
+
return indicator;
|
|
49
|
+
};
|
|
50
|
+
indicator.emaSource = function (x) {
|
|
51
|
+
if (!arguments.length) {
|
|
52
|
+
return emaSource;
|
|
53
|
+
}
|
|
54
|
+
emaSource = x;
|
|
55
|
+
return indicator;
|
|
56
|
+
};
|
|
57
|
+
rebind(indicator, base, "id", "echo", "type", "stroke");
|
|
58
|
+
rebind(indicator, mergedAlgorithm, "merge", "skipUndefined");
|
|
59
|
+
return indicator;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=elderImpulse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elderImpulse.js","sourceRoot":"","sources":["../../src/indicator/elderImpulse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElF,MAAM,cAAc,GAAG,cAAc,CAAC;AAEtC,MAAM,CAAC,OAAO;IACV,IAAI,UAA2B,CAAC;IAChC,IAAI,SAA0B,CAAC;IAE/B,MAAM,IAAI,GAAG,aAAa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YAAY,GAAG,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEP,MAAM,SAAS,GAAG,UAAU,IAAS,EAAE,OAAO,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE;QAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAElF,OAAO,OAAO,CAAC;IACnB,CAAC,CAAC;IACF,SAAS,CAAC,UAAU,GAAG,UAAU,CAAM;QACnC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;YACnB,OAAO,UAAU,CAAC;SACrB;QACD,UAAU,GAAG,CAAC,CAAC;QACf,OAAO,SAAS,CAAC;IACrB,CAAC,CAAC;IACF,SAAS,CAAC,SAAS,GAAG,UAAU,CAAM;QAClC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;YACnB,OAAO,SAAS,CAAC;SACpB;QACD,SAAS,GAAG,CAAC,CAAC;QACd,OAAO,SAAS,CAAC;IACrB,CAAC,CAAC;IACF,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACxD,MAAM,CAAC,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;IAE7D,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ElderRayOptions } from "../calculator/elderRay";
|
|
2
|
+
interface ElderRayIndicator {
|
|
3
|
+
(data: any[], options?: {
|
|
4
|
+
merge: boolean;
|
|
5
|
+
}): any;
|
|
6
|
+
id(): number;
|
|
7
|
+
id(x: number): ElderRayIndicator;
|
|
8
|
+
accessor(): any;
|
|
9
|
+
accessor(x: any): ElderRayIndicator;
|
|
10
|
+
stroke(): string | any;
|
|
11
|
+
stroke(x: string | any): ElderRayIndicator;
|
|
12
|
+
fill(): string | any;
|
|
13
|
+
fill(x: string | any): ElderRayIndicator;
|
|
14
|
+
echo(): any;
|
|
15
|
+
echo(x: any): ElderRayIndicator;
|
|
16
|
+
type(): string;
|
|
17
|
+
type(x: string): ElderRayIndicator;
|
|
18
|
+
merge(): any;
|
|
19
|
+
merge(newMerge: any): ElderRayIndicator;
|
|
20
|
+
options(): ElderRayOptions;
|
|
21
|
+
options(newOptions: ElderRayOptions): ElderRayIndicator;
|
|
22
|
+
}
|
|
23
|
+
export default function (): ElderRayIndicator;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { elderRay } from "../calculator";
|
|
2
|
+
import { merge, rebind } from "../utils";
|
|
3
|
+
import baseIndicator from "./baseIndicator";
|
|
4
|
+
const ALGORITHM_TYPE = "ElderRay";
|
|
5
|
+
export default function () {
|
|
6
|
+
const base = baseIndicator()
|
|
7
|
+
.type(ALGORITHM_TYPE)
|
|
8
|
+
.accessor((d) => d.elderRay);
|
|
9
|
+
const underlyingAlgorithm = elderRay();
|
|
10
|
+
const mergedAlgorithm = merge()
|
|
11
|
+
.algorithm(underlyingAlgorithm)
|
|
12
|
+
.merge((datum, i) => {
|
|
13
|
+
datum.elderRay = i;
|
|
14
|
+
});
|
|
15
|
+
const indicator = (data, options = { merge: true }) => {
|
|
16
|
+
if (options.merge) {
|
|
17
|
+
if (!base.accessor()) {
|
|
18
|
+
throw new Error(`Set an accessor to ${ALGORITHM_TYPE} before calculating`);
|
|
19
|
+
}
|
|
20
|
+
return mergedAlgorithm(data);
|
|
21
|
+
}
|
|
22
|
+
return underlyingAlgorithm(data);
|
|
23
|
+
};
|
|
24
|
+
rebind(indicator, base, "id", "accessor", "stroke", "fill", "echo", "type");
|
|
25
|
+
rebind(indicator, underlyingAlgorithm, "options");
|
|
26
|
+
rebind(indicator, mergedAlgorithm, "merge", "skipUndefined");
|
|
27
|
+
return indicator;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=elderRay.js.map
|
|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SAAS,CAAC,CAAC;IAClD,MAAM,CAAC,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;IAE7D,OAAO,SAA8B,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EMAOptions } from "../calculator/ema";
|
|
2
|
+
interface EMAIndicator {
|
|
3
|
+
(data: any[], options?: {
|
|
4
|
+
merge: boolean;
|
|
5
|
+
}): any;
|
|
6
|
+
id(): number;
|
|
7
|
+
id(x: number): EMAIndicator;
|
|
8
|
+
accessor(): any;
|
|
9
|
+
accessor(x: any): EMAIndicator;
|
|
10
|
+
stroke(): string | any;
|
|
11
|
+
stroke(x: string | any): EMAIndicator;
|
|
12
|
+
fill(): string | any;
|
|
13
|
+
fill(x: string | any): EMAIndicator;
|
|
14
|
+
echo(): any;
|
|
15
|
+
echo(x: any): EMAIndicator;
|
|
16
|
+
type(): string;
|
|
17
|
+
type(x: string): EMAIndicator;
|
|
18
|
+
merge(): any;
|
|
19
|
+
merge(newMerge: any): EMAIndicator;
|
|
20
|
+
options(): EMAOptions;
|
|
21
|
+
options(newOptions: EMAOptions): EMAIndicator;
|
|
22
|
+
}
|
|
23
|
+
export default function (): EMAIndicator;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { merge, rebind } from "../utils";
|
|
2
|
+
import { ema } from "../calculator";
|
|
3
|
+
import baseIndicator from "./baseIndicator";
|
|
4
|
+
const ALGORITHM_TYPE = "EMA";
|
|
5
|
+
export default function () {
|
|
6
|
+
const base = baseIndicator()
|
|
7
|
+
.type(ALGORITHM_TYPE)
|
|
8
|
+
.accessor((d) => d.ema);
|
|
9
|
+
const underlyingAlgorithm = ema();
|
|
10
|
+
const mergedAlgorithm = merge()
|
|
11
|
+
.algorithm(underlyingAlgorithm)
|
|
12
|
+
.merge((datum, i) => {
|
|
13
|
+
datum.ema = i;
|
|
14
|
+
});
|
|
15
|
+
const indicator = (data, options = { merge: true }) => {
|
|
16
|
+
if (options.merge) {
|
|
17
|
+
if (!base.accessor()) {
|
|
18
|
+
throw new Error(`Set an accessor to ${ALGORITHM_TYPE} before calculating`);
|
|
19
|
+
}
|
|
20
|
+
return mergedAlgorithm(data);
|
|
21
|
+
}
|
|
22
|
+
return underlyingAlgorithm(data);
|
|
23
|
+
};
|
|
24
|
+
rebind(indicator, base, "id", "accessor", "stroke", "fill", "echo", "type");
|
|
25
|
+
rebind(indicator, underlyingAlgorithm, "options", "undefinedLength");
|
|
26
|
+
rebind(indicator, mergedAlgorithm, "merge", "skipUndefined");
|
|
27
|
+
return indicator;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=ema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ema.js","sourceRoot":"","sources":["../../src/indicator/ema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,MAAM,cAAc,GAAG,KAAK,CAAC;AAsB7B,MAAM,CAAC,OAAO;IACV,MAAM,IAAI,GAAG,aAAa,EAAE;SACvB,IAAI,CAAC,cAAc,CAAC;SACpB,QAAQ,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAEjC,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC;IAElC,MAAM,eAAe,GAAG,KAAK,EAAE;SAC1B,SAAS,CAAC,mBAAmB,CAAC;SAC9B,KAAK,CAAC,CAAC,KAAU,EAAE,CAAS,EAAE,EAAE;QAC7B,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEP,MAAM,SAAS,GAAG,CAAC,IAAW,EAAE,OAAO,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;QACzD,IAAI,OAAO,CAAC,KAAK,EAAE;YACf,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE;gBAClB,MAAM,IAAI,KAAK,CAAC,sBAAsB,cAAc,qBAAqB,CAAC,CAAC;aAC9E;YAED,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;SAChC;QAED,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC,CAAC;IAEF,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5E,MAAM,CAAC,SAAS,EAAE,mBAAmB,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;IACrE,MAAM,CAAC,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;IAE7D,OAAO,SAAyB,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ForceIndexOptions } from "../calculator/forceIndex";
|
|
2
|
+
interface ForceIndexIndicator {
|
|
3
|
+
(data: any[], options?: {
|
|
4
|
+
merge: boolean;
|
|
5
|
+
}): any;
|
|
6
|
+
id(): number;
|
|
7
|
+
id(x: number): ForceIndexIndicator;
|
|
8
|
+
accessor(): any;
|
|
9
|
+
accessor(x: any): ForceIndexIndicator;
|
|
10
|
+
stroke(): string | any;
|
|
11
|
+
stroke(x: string | any): ForceIndexIndicator;
|
|
12
|
+
fill(): string | any;
|
|
13
|
+
fill(x: string | any): ForceIndexIndicator;
|
|
14
|
+
echo(): any;
|
|
15
|
+
echo(x: any): ForceIndexIndicator;
|
|
16
|
+
type(): string;
|
|
17
|
+
type(x: string): ForceIndexIndicator;
|
|
18
|
+
merge(): any;
|
|
19
|
+
merge(newMerge: any): ForceIndexIndicator;
|
|
20
|
+
options(): ForceIndexOptions;
|
|
21
|
+
options(newOptions: ForceIndexOptions): ForceIndexIndicator;
|
|
22
|
+
}
|
|
23
|
+
export default function (): ForceIndexIndicator;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { merge, rebind } from "../utils";
|
|
2
|
+
import { forceIndex } from "../calculator";
|
|
3
|
+
import baseIndicator from "./baseIndicator";
|
|
4
|
+
const ALGORITHM_TYPE = "ForceIndex";
|
|
5
|
+
export default function () {
|
|
6
|
+
const base = baseIndicator()
|
|
7
|
+
.type(ALGORITHM_TYPE)
|
|
8
|
+
.accessor((d) => d.forceIndex);
|
|
9
|
+
const underlyingAlgorithm = forceIndex();
|
|
10
|
+
const mergedAlgorithm = merge()
|
|
11
|
+
.algorithm(underlyingAlgorithm)
|
|
12
|
+
.merge((datum, i) => {
|
|
13
|
+
datum.forceIndex = i;
|
|
14
|
+
});
|
|
15
|
+
const indicator = (data, options = { merge: true }) => {
|
|
16
|
+
if (options.merge) {
|
|
17
|
+
if (!base.accessor()) {
|
|
18
|
+
throw new Error(`Set an accessor to ${ALGORITHM_TYPE} before calculating`);
|
|
19
|
+
}
|
|
20
|
+
return mergedAlgorithm(data);
|
|
21
|
+
}
|
|
22
|
+
return underlyingAlgorithm(data);
|
|
23
|
+
};
|
|
24
|
+
rebind(indicator, base, "id", "accessor", "stroke", "fill", "echo", "type");
|
|
25
|
+
rebind(indicator, underlyingAlgorithm, "options");
|
|
26
|
+
rebind(indicator, mergedAlgorithm, "merge", "skipUndefined");
|
|
27
|
+
return indicator;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=forceIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forceIndex.js","sourceRoot":"","sources":["../../src/indicator/forceIndex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,MAAM,cAAc,GAAG,YAAY,CA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inAshi";
|
|
5
|
+
export default function () {
|
|
6
|
+
const base = baseIndicator()
|
|
7
|
+
.type(ALGORITHM_TYPE)
|
|
8
|
+
.accessor((d) => d.ha);
|
|
9
|
+
const underlyingAlgorithm = heikinAshi();
|
|
10
|
+
const mergedAlgorithm = merge()
|
|
11
|
+
.algorithm(underlyingAlgorithm)
|
|
12
|
+
.merge((datum, i) => {
|
|
13
|
+
return Object.assign(Object.assign({}, datum), i);
|
|
14
|
+
});
|
|
15
|
+
const indicator = (data, options = { merge: true }) => {
|
|
16
|
+
if (options.merge) {
|
|
17
|
+
if (!base.accessor()) {
|
|
18
|
+
throw new Error(`Set an accessor to ${ALGORITHM_TYPE} before calculating`);
|
|
19
|
+
}
|
|
20
|
+
return mergedAlgorithm(data);
|
|
21
|
+
}
|
|
22
|
+
return underlyingAlgorithm(data);
|
|
23
|
+
};
|
|
24
|
+
rebind(indicator, base, "accessor", "stroke", "fill", "echo", "type");
|
|
25
|
+
rebind(indicator, mergedAlgorithm, "merge");
|
|
26
|
+
return indicator;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=heikinAshi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heikinAshi.js","sourceRoot":"","sources":["../../src/indicator/heikinAshi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,cAAc,GAAG,YAAY,CAAC;AAEpC,MAAM,CAAC,OAAO;IACV,MAAM,IAAI,GAAG,aAAa,EAAE;SACvB,IAAI,CAAC,cAAc,CAAC;SACpB,QAAQ,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAEhC,MAAM,mBAAmB,GAAG,UAAU,EAAE,CAAC;IAEzC,MAAM,eAAe,GAAG,KAAK,EAAE;SAC1B,SAAS,CAAC,mBAAmB,CAAC;SAC9B,KAAK,CAAC,CAAC,KAAU,EAAE,CAAM,EAAE,EAAE;QAC1B,uCAAY,KAAK,GAAK,CAAC,EAAG;IAC9B,CAAC,CAAC,CAAC;IAEP,MAAM,SAAS,GAAG,CAAC,IAAW,EAAE,OAAO,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;QACzD,IAAI,OAAO,CAAC,KAAK,EAAE;YACf,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE;gBAClB,MAAM,IAAI,KAAK,CAAC,sBAAsB,cAAc,qBAAqB,CAAC,CAAC;aAC9E;YAED,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;SAChC;QACD,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC,CAAC;IAEF,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACtE,MAAM,CAAC,SAAS,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IAE5C,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { default as algo } from "./algorithm";
|
|
2
|
+
export { default as ema } from "./ema";
|
|
3
|
+
export { default as sma } from "./sma";
|
|
4
|
+
export { default as wma } from "./wma";
|
|
5
|
+
export { default as tma } from "./tma";
|
|
6
|
+
export { default as bollingerBand } from "./bollingerBand";
|
|
7
|
+
export { default as heikinAshi } from "./heikinAshi";
|
|
8
|
+
export { default as kagi } from "./kagi";
|
|
9
|
+
export { default as pointAndFigure } from "./pointAndFigure";
|
|
10
|
+
export { default as renko } from "./renko";
|
|
11
|
+
export { default as macd } from "./macd";
|
|
12
|
+
export { default as rsi } from "./rsi";
|
|
13
|
+
export { default as atr } from "./atr";
|
|
14
|
+
export { default as stochasticOscillator } from "./stochasticOscillator";
|
|
15
|
+
export { default as forceIndex } from "./forceIndex";
|
|
16
|
+
export { default as sar } from "./sar";
|
|
17
|
+
export { default as elderRay } from "./elderRay";
|
|
18
|
+
export { default as change } from "./change";
|
|
19
|
+
export { default as elderImpulse } from "./elderImpulse";
|
|
20
|
+
export { default as compare } from "./compare";
|
|
21
|
+
import * as defaultOptionsForComputation from "../calculator/defaultOptionsForComputation";
|
|
22
|
+
import * as defaultOptionsForAppearance from "./defaultOptionsForAppearance";
|
|
23
|
+
export { defaultOptionsForComputation, defaultOptionsForAppearance };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export { default as algo } from "./algorithm";
|
|
2
|
+
export { default as ema } from "./ema";
|
|
3
|
+
export { default as sma } from "./sma";
|
|
4
|
+
export { default as wma } from "./wma";
|
|
5
|
+
export { default as tma } from "./tma";
|
|
6
|
+
export { default as bollingerBand } from "./bollingerBand";
|
|
7
|
+
export { default as heikinAshi } from "./heikinAshi";
|
|
8
|
+
export { default as kagi } from "./kagi";
|
|
9
|
+
export { default as pointAndFigure } from "./pointAndFigure";
|
|
10
|
+
export { default as renko } from "./renko";
|
|
11
|
+
export { default as macd } from "./macd";
|
|
12
|
+
export { default as rsi } from "./rsi";
|
|
13
|
+
export { default as atr } from "./atr";
|
|
14
|
+
export { default as stochasticOscillator } from "./stochasticOscillator";
|
|
15
|
+
export { default as forceIndex } from "./forceIndex";
|
|
16
|
+
export { default as sar } from "./sar";
|
|
17
|
+
export { default as elderRay } from "./elderRay";
|
|
18
|
+
export { default as change } from "./change";
|
|
19
|
+
export { default as elderImpulse } from "./elderImpulse";
|
|
20
|
+
export { default as compare } from "./compare";
|
|
21
|
+
import * as defaultOptionsForComputation from "../calculator/defaultOptionsForComputation";
|
|
22
|
+
import * as defaultOptionsForAppearance from "./defaultOptionsForAppearance";
|
|
23
|
+
export { defaultOptionsForComputation, defaultOptionsForAppearance };
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,KAAK,4BAA4B,MAAM,4CAA4C,CAAC;AAC3F,OAAO,KAAK,2BAA2B,MAAM,+BAA+B,CAAC;AAE7E,OAAO,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default function (): {
|
|
2
|
+
(data: any[]): any[];
|
|
3
|
+
options(newOptions?: any): {
|
|
4
|
+
reversalType: string;
|
|
5
|
+
windowSize: number;
|
|
6
|
+
reversal: number;
|
|
7
|
+
sourcePath: string;
|
|
8
|
+
} | any;
|
|
9
|
+
dateMutator(newDateMutator?: any): ((d: any, date: any) => void) | any;
|
|
10
|
+
dateAccessor(newDateAccessor?: any): ((d: any) => any) | any;
|
|
11
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { rebind } from "../utils";
|
|
2
|
+
import { kagi } from "../calculator";
|
|
3
|
+
import baseIndicator from "./baseIndicator";
|
|
4
|
+
const ALGORITHM_TYPE = "Kagi";
|
|
5
|
+
export default function () {
|
|
6
|
+
const base = baseIndicator().type(ALGORITHM_TYPE);
|
|
7
|
+
const underlyingAlgorithm = kagi();
|
|
8
|
+
const indicator = underlyingAlgorithm;
|
|
9
|
+
rebind(indicator, base, "id", "stroke", "fill", "echo", "type");
|
|
10
|
+
rebind(indicator, underlyingAlgorithm, "dateAccessor", "dateMutator", "options");
|
|
11
|
+
return indicator;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=kagi.js.map
|