@tradecanvas/script 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +120 -3
- package/dist/Column.d.ts +21 -0
- package/dist/Column.d.ts.map +1 -0
- package/dist/Ring.d.ts +28 -0
- package/dist/Ring.d.ts.map +1 -0
- package/dist/ScriptRun.d.ts +75 -0
- package/dist/ScriptRun.d.ts.map +1 -0
- package/dist/defineScript.d.ts +203 -0
- package/dist/defineScript.d.ts.map +1 -0
- package/dist/drawings.d.ts +46 -0
- package/dist/drawings.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1522 -0
- package/dist/index.js.map +1 -0
- package/dist/limits.d.ts +30 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/outputs.d.ts +129 -0
- package/dist/outputs.d.ts.map +1 -0
- package/dist/points.d.ts +13 -0
- package/dist/points.d.ts.map +1 -0
- package/dist/scope.d.ts +33 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/scriptIndicator.d.ts +25 -0
- package/dist/scriptIndicator.d.ts.map +1 -0
- package/dist/security.d.ts +52 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/state.d.ts +52 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/ta/averages.d.ts +19 -0
- package/dist/ta/averages.d.ts.map +1 -0
- package/dist/ta/common.d.ts +24 -0
- package/dist/ta/common.d.ts.map +1 -0
- package/dist/ta/events.d.ts +16 -0
- package/dist/ta/events.d.ts.map +1 -0
- package/dist/ta/index.d.ts +65 -0
- package/dist/ta/index.d.ts.map +1 -0
- package/dist/ta/moves.d.ts +26 -0
- package/dist/ta/moves.d.ts.map +1 -0
- package/dist/ta/oscillators.d.ts +29 -0
- package/dist/ta/oscillators.d.ts.map +1 -0
- package/dist/ta/ranges.d.ts +18 -0
- package/dist/ta/ranges.d.ts.map +1 -0
- package/dist/ta/statistics.d.ts +26 -0
- package/dist/ta/statistics.d.ts.map +1 -0
- package/dist/worker/messages.d.ts +49 -0
- package/dist/worker/messages.d.ts.map +1 -0
- package/dist/worker/scriptWorkerIndicator.d.ts +40 -0
- package/dist/worker/scriptWorkerIndicator.d.ts.map +1 -0
- package/dist/worker/serveScripts.d.ts +28 -0
- package/dist/worker/serveScripts.d.ts.map +1 -0
- package/package.json +39 -3
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { IndicatorDrawing, IndicatorMarkerShape, LineStyle } from '@tradecanvas/commons';
|
|
2
|
+
import { ScriptDrawings } from './drawings.js';
|
|
3
|
+
import { ScriptLimit } from './limits.js';
|
|
4
|
+
import { BarColorHandle, AlertConditionHandle, AlertConditionOptions, BackgroundHandle, BackgroundOptions, FillHandle, FillOptions, HlineOptions, PlotHandle, PlotOptions, ScriptPlotKind, ShapeHandle, ShapeOptions, ShapePosition } from './defineScript.js';
|
|
5
|
+
import { Scope } from './scope.js';
|
|
6
|
+
export interface PlotDeclaration {
|
|
7
|
+
readonly title: string;
|
|
8
|
+
readonly kind: ScriptPlotKind;
|
|
9
|
+
readonly color?: string;
|
|
10
|
+
readonly width?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ShapeDeclaration {
|
|
13
|
+
readonly title: string;
|
|
14
|
+
readonly shape: IndicatorMarkerShape;
|
|
15
|
+
readonly position: ShapePosition;
|
|
16
|
+
readonly color?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface LevelDeclaration {
|
|
19
|
+
readonly price: number;
|
|
20
|
+
readonly color?: string;
|
|
21
|
+
readonly lineStyle?: LineStyle;
|
|
22
|
+
readonly title?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface FillDeclaration {
|
|
25
|
+
/** The two plots it shades between, by their place among the plots. */
|
|
26
|
+
readonly between: readonly [number, number];
|
|
27
|
+
readonly color?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface BackgroundDeclaration {
|
|
30
|
+
readonly title: string;
|
|
31
|
+
}
|
|
32
|
+
export interface AlertConditionDeclaration {
|
|
33
|
+
readonly title: string;
|
|
34
|
+
readonly message?: string;
|
|
35
|
+
}
|
|
36
|
+
/** What a script draws, known once its setup has run. */
|
|
37
|
+
export interface ScriptDeclarations {
|
|
38
|
+
readonly overlay: boolean;
|
|
39
|
+
readonly plots: readonly PlotDeclaration[];
|
|
40
|
+
readonly shapes: readonly ShapeDeclaration[];
|
|
41
|
+
readonly levels: readonly LevelDeclaration[];
|
|
42
|
+
readonly fills: readonly FillDeclaration[];
|
|
43
|
+
readonly backgrounds: readonly BackgroundDeclaration[];
|
|
44
|
+
/** How many `barcolor()` the script asked for. */
|
|
45
|
+
readonly barColors: number;
|
|
46
|
+
readonly alertConditions: readonly AlertConditionDeclaration[];
|
|
47
|
+
}
|
|
48
|
+
/** A colour a bar, by its place in the output's `palette` plus one: 0 for none. */
|
|
49
|
+
export type BarColors = Uint16Array;
|
|
50
|
+
/** A plot's values, a bar each, and the colour each bar was given. */
|
|
51
|
+
export interface PlotOutput extends PlotDeclaration {
|
|
52
|
+
readonly values: Float64Array;
|
|
53
|
+
/** Each bar's colour: 0 for the plot's own. */
|
|
54
|
+
readonly colors: BarColors;
|
|
55
|
+
}
|
|
56
|
+
export interface ShapeOutput extends ShapeDeclaration {
|
|
57
|
+
/** 1 on the bars it marks. */
|
|
58
|
+
readonly on: Uint8Array;
|
|
59
|
+
}
|
|
60
|
+
export interface FillOutput extends FillDeclaration {
|
|
61
|
+
/** Each bar's colour: 0 for the fill's own. */
|
|
62
|
+
readonly colors: BarColors;
|
|
63
|
+
}
|
|
64
|
+
export interface BackgroundOutput extends BackgroundDeclaration {
|
|
65
|
+
/** Each bar's colour: 0 for no background there. */
|
|
66
|
+
readonly colors: BarColors;
|
|
67
|
+
}
|
|
68
|
+
export interface AlertConditionOutput extends AlertConditionDeclaration {
|
|
69
|
+
/** 1 on the bars it holds. */
|
|
70
|
+
readonly on: Uint8Array;
|
|
71
|
+
}
|
|
72
|
+
export interface ScriptError {
|
|
73
|
+
/** The bar it stopped at. */
|
|
74
|
+
readonly bar: number;
|
|
75
|
+
readonly message: string;
|
|
76
|
+
/** The limit it went past, when that is why it stopped. */
|
|
77
|
+
readonly limit?: ScriptLimit;
|
|
78
|
+
}
|
|
79
|
+
/** What a run has drawn so far, a value a bar, without copying. */
|
|
80
|
+
export interface ScriptOutput {
|
|
81
|
+
readonly length: number;
|
|
82
|
+
readonly plots: readonly PlotOutput[];
|
|
83
|
+
readonly shapes: readonly ShapeOutput[];
|
|
84
|
+
readonly levels: readonly LevelDeclaration[];
|
|
85
|
+
readonly fills: readonly FillOutput[];
|
|
86
|
+
readonly backgrounds: readonly BackgroundOutput[];
|
|
87
|
+
/** Each `barcolor()`'s colour a bar: 0 for the chart's own. */
|
|
88
|
+
readonly barColors: readonly BarColors[];
|
|
89
|
+
readonly alertConditions: readonly AlertConditionOutput[];
|
|
90
|
+
/** The colours bars were given, each once. */
|
|
91
|
+
readonly palette: readonly string[];
|
|
92
|
+
/** The labels, lines and boxes it keeps, in the order made. */
|
|
93
|
+
readonly drawings: readonly IndicatorDrawing[];
|
|
94
|
+
readonly errors: readonly ScriptError[];
|
|
95
|
+
}
|
|
96
|
+
/** The plots, marks, fills, backgrounds and levels a script declares, and what its bars set in them. */
|
|
97
|
+
export declare class Outputs {
|
|
98
|
+
private readonly scope;
|
|
99
|
+
private readonly plots;
|
|
100
|
+
private readonly handles;
|
|
101
|
+
private readonly shapes;
|
|
102
|
+
private readonly fills;
|
|
103
|
+
private readonly backgrounds;
|
|
104
|
+
private readonly conditions;
|
|
105
|
+
private readonly barColorSlots;
|
|
106
|
+
private readonly levels;
|
|
107
|
+
private readonly drawingLists;
|
|
108
|
+
private readonly palette;
|
|
109
|
+
private readonly paletteIndex;
|
|
110
|
+
private open;
|
|
111
|
+
constructor(scope: Scope);
|
|
112
|
+
/** No more plots, marks or levels: the setup is over. */
|
|
113
|
+
close(): void;
|
|
114
|
+
private declaring;
|
|
115
|
+
/** A colour's place in the palette plus one. */
|
|
116
|
+
private colorIndex;
|
|
117
|
+
plot(title: string, options?: PlotOptions): PlotHandle;
|
|
118
|
+
shape(title: string, options?: ShapeOptions): ShapeHandle;
|
|
119
|
+
fill(a: PlotHandle, b: PlotHandle, options?: FillOptions): FillHandle;
|
|
120
|
+
bgcolor(options?: BackgroundOptions): BackgroundHandle;
|
|
121
|
+
/** Shapes the script draws, listed with its output. */
|
|
122
|
+
addDrawings(list: ScriptDrawings): ScriptDrawings;
|
|
123
|
+
barcolor(): BarColorHandle;
|
|
124
|
+
alertCondition(title: string, options?: AlertConditionOptions): AlertConditionHandle;
|
|
125
|
+
hline(price: number, options?: HlineOptions): void;
|
|
126
|
+
declarations(overlay: boolean): ScriptDeclarations;
|
|
127
|
+
output(length: number, errors: readonly ScriptError[]): ScriptOutput;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=outputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outputs.d.ts","sourceRoot":"","sources":["../src/outputs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,cAAc,EACd,WAAW,EACX,YAAY,EACZ,aAAa,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM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gD;IAChD,OAAO,CAAC,UAAU;IAWlB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,UAAU;IAmB1D,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,WAAW;IAe7D,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,OAAO,GAAE,WAAgB,GAAG,UAAU;IAiBzE,OAAO,CAAC,OAAO,GAAE,iBAAsB,GAAG,gBAAgB;IAW1D,uDAAuD;IACvD,WAAW,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc;IAKjD,QAAQ,IAAI,cAAc;IAW1B,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B,GAAG,oBAAoB;IAYxF,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,IAAI;IAKtD,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,kBAAkB;IAalD,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,WAAW,EAAE,GAAG,YAAY;CAerE"}
|
package/dist/points.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IndicatorValue } from '@tradecanvas/commons';
|
|
2
|
+
import { ScriptOutput } from './outputs.js';
|
|
3
|
+
export declare const plotKey: (i: number) => string;
|
|
4
|
+
export declare const shapeKey: (i: number) => string;
|
|
5
|
+
export declare const backgroundKey: (i: number) => string;
|
|
6
|
+
export declare const barColorKey: (i: number) => string;
|
|
7
|
+
/** The field that holds a bar's colour, by its place in the output's palette. */
|
|
8
|
+
export declare const colorKey: (key: string) => string;
|
|
9
|
+
export declare const fillColorKey: (i: number) => string;
|
|
10
|
+
export declare const conditionKey: (i: number) => string;
|
|
11
|
+
/** Bar `i`'s values under their keys, or null when it has none. */
|
|
12
|
+
export declare function pointAt(output: ScriptOutput, i: number): IndicatorValue | null;
|
|
13
|
+
//# sourceMappingURL=points.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"points.d.ts","sourceRoot":"","sources":["../src/points.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAa,YAAY,EAAE,MAAM,cAAc,CAAC;AAO5D,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,WAAY,CAAC;AAC9C,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,WAAY,CAAC;AAC/C,eAAO,MAAM,aAAa,GAAI,GAAG,MAAM,WAAa,CAAC;AACrD,eAAO,MAAM,WAAW,GAAI,GAAG,MAAM,WAAa,CAAC;AACnD,iFAAiF;AACjF,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,WAAc,CAAC;AACnD,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,WAAa,CAAC;AACpD,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,WAAY,CAAC;AAQnD,mEAAmE;AACnE,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CA4B9E"}
|
package/dist/scope.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ScriptLimitError, ScriptLimits } from './limits.js';
|
|
2
|
+
/** A piece of a script's state the run keeps and puts back. */
|
|
3
|
+
export interface Unit {
|
|
4
|
+
/** Keep the state as it is now: the live bar will start again from here. */
|
|
5
|
+
commit(): void;
|
|
6
|
+
/** Put back the state kept last. */
|
|
7
|
+
rollback(): void;
|
|
8
|
+
}
|
|
9
|
+
export interface Scope {
|
|
10
|
+
readonly units: Unit[];
|
|
11
|
+
/**
|
|
12
|
+
* Whether the bar being run is the live one, run again on each tick. Only
|
|
13
|
+
* then a list records how to undo what it does.
|
|
14
|
+
*/
|
|
15
|
+
live: boolean;
|
|
16
|
+
/** The bar being run, by its index. */
|
|
17
|
+
bar: number;
|
|
18
|
+
/** What empties a value a bar the script writes, before a bar is run (again). */
|
|
19
|
+
readonly clearers: ((bar: number) => void)[];
|
|
20
|
+
/** How far the run may go. */
|
|
21
|
+
readonly limits: Readonly<Required<ScriptLimits>>;
|
|
22
|
+
/** The loop steps the bar being run has taken. */
|
|
23
|
+
steps: number;
|
|
24
|
+
/** The limit the bar being run went past, caught by the script or not; null: none. */
|
|
25
|
+
breach: ScriptLimitError | null;
|
|
26
|
+
}
|
|
27
|
+
/** Run `fn` with `scope` taking the state made meanwhile. */
|
|
28
|
+
export declare function inScope<T>(scope: Scope, fn: () => T): T;
|
|
29
|
+
/** The scope a script's setup is running in. */
|
|
30
|
+
export declare function currentScope(what?: string): Scope;
|
|
31
|
+
/** A set of numbers the run keeps and puts back as one. */
|
|
32
|
+
export declare function cell<T extends Record<string, number>>(init: T): T;
|
|
33
|
+
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAElE,+DAA+D;AAC/D,MAAM,WAAW,IAAI;IACnB,4EAA4E;IAC5E,MAAM,IAAI,IAAI,CAAC;IACf,oCAAoC;IACpC,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;IACvB;;;OAGG;IACH,IAAI,EAAE,OAAO,CAAC;IACd,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,EAAE,CAAC;IAC7C,8BAA8B;IAC9B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;IAClD,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,sFAAsF;IACtF,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACjC;AAID,6DAA6D;AAC7D,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAQvD;AAED,gDAAgD;AAChD,wBAAgB,YAAY,CAAC,IAAI,SAAiB,GAAG,KAAK,CAGzD;AAED,2DAA2D;AAC3D,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAQjE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IndicatorConfig, IndicatorDescriptor, IndicatorPlugin } from '@tradecanvas/commons';
|
|
2
|
+
import { Script, ScriptInputs } from './defineScript.js';
|
|
3
|
+
import { ScriptLimits } from './limits.js';
|
|
4
|
+
import { ScriptRunOptions } from './ScriptRun.js';
|
|
5
|
+
/** A run's options for an instance: its limits, and the exchange's clock its days are counted on. */
|
|
6
|
+
export declare function runOptionsOf(config: IndicatorConfig, limits?: ScriptLimits): ScriptRunOptions;
|
|
7
|
+
/** The inputs a run was made with, to tell whether a config asks for others. */
|
|
8
|
+
export declare function paramsKey(params: Readonly<Record<string, unknown>>): string;
|
|
9
|
+
/** The indicator a script is to the chart: its id, inputs, plots, fills and levels, known from its setup. */
|
|
10
|
+
export declare function describeScript(script: Script<ScriptInputs>): IndicatorDescriptor;
|
|
11
|
+
/** How a script is run as an indicator. */
|
|
12
|
+
export interface ScriptIndicatorOptions {
|
|
13
|
+
/** How far each run may go: loop steps a bar, numbers a list, ms a run. */
|
|
14
|
+
limits?: ScriptLimits;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A script as an indicator the chart draws: register it
|
|
18
|
+
* (`chart.registerIndicator(scriptIndicator(script))`) and add it by its id.
|
|
19
|
+
* Its plots are its lines under the keys `p0`, `p1`…, its marks `s0`, `s1`…,
|
|
20
|
+
* its backgrounds `bg0`…, its levels the pane's. A colour a bar is an index
|
|
21
|
+
* into the output's `palette` (`p0c`, `bg0c`, `f0c` for a fill). A tick
|
|
22
|
+
* runs only the live bar again.
|
|
23
|
+
*/
|
|
24
|
+
export declare function scriptIndicator(script: Script<ScriptInputs>, options?: ScriptIndicatorOptions): IndicatorPlugin;
|
|
25
|
+
//# sourceMappingURL=scriptIndicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scriptIndicator.d.ts","sourceRoot":"","sources":["../src/scriptIndicator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,eAAe,EACf,mBAAmB,EAMnB,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAiB,MAAM,mBAAmB,CAAC;AAE7E,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAmBlE,qGAAqG;AACrG,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,gBAAgB,CAM7F;AAED,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAE3E;AAyDD,6GAA6G;AAC7G,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,GAAG,mBAAmB,CAuBhF;AAgED,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC,2EAA2E;IAC3E,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,EAAE,OAAO,GAAE,sBAA2B,GAAG,eAAe,CAInH"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { TimeFrame } from '@tradecanvas/commons';
|
|
2
|
+
import { ScriptBar, ScriptPrices } from './defineScript.js';
|
|
3
|
+
import { ScriptLimitError, ScriptLimits } from './limits.js';
|
|
4
|
+
import { ScriptArray, ScriptSeries, Var } from './state.js';
|
|
5
|
+
/** What a higher interval's setup is given: its own bars' prices and state. */
|
|
6
|
+
export interface SecuritySetupApi {
|
|
7
|
+
/** The higher interval's bars, read back from the one being run. Their time is their first chart bar's. */
|
|
8
|
+
readonly prices: ScriptPrices;
|
|
9
|
+
readonly state: {
|
|
10
|
+
var<T>(init: T): Var<T>;
|
|
11
|
+
array(): ScriptArray;
|
|
12
|
+
series(): ScriptSeries;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** Run once, before the first bar of the higher interval: makes its sums, returns its value a bar. */
|
|
16
|
+
export type SecuritySetup = (api: SecuritySetupApi) => (bar: ScriptBar) => number;
|
|
17
|
+
export interface SecurityOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Also the bar of the higher interval still forming, as it was at each
|
|
20
|
+
* bar: its bars so far. It changes on the chart's bars as they come, as
|
|
21
|
+
* the forming bar does (it repaints). Unset: only bars that closed.
|
|
22
|
+
*/
|
|
23
|
+
live?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** Where the chart's bars are read and the higher interval is cut. */
|
|
26
|
+
export interface SecurityContext {
|
|
27
|
+
/** The bars loaded, for the keyer to read their clock (seconds or ms, daily) and their spacing. */
|
|
28
|
+
timeline(): readonly {
|
|
29
|
+
time: number;
|
|
30
|
+
}[];
|
|
31
|
+
/** The chart's bar `index` as it now is (the bar before, closed, when a new one comes). */
|
|
32
|
+
barAt(index: number): ScriptBar;
|
|
33
|
+
/** The exchange's zone and the trading day's start, for days and longer. */
|
|
34
|
+
exchangeTimeZone?: string;
|
|
35
|
+
sessionStart?: number;
|
|
36
|
+
/** The script's limits, which the higher interval's run keeps to as well (its loops and lists; the time is the script's). */
|
|
37
|
+
limits?: ScriptLimits;
|
|
38
|
+
/** Told of a limit the higher interval went past, so the script stops even if it catches the error. */
|
|
39
|
+
onLimit?(error: ScriptLimitError): void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A value of a higher interval of the same symbol, a chart bar at a time:
|
|
43
|
+
* the higher interval's bars are made of the chart's own (as a resample
|
|
44
|
+
* cuts them), and `setup`'s sums run over them in a run of their own, the
|
|
45
|
+
* forming bar run again as a tick is. Each chart bar reads, by default, the
|
|
46
|
+
* value of the last bar of the higher interval that closed before its own
|
|
47
|
+
* (it never changes after); with `live`, the forming bar's as it was then.
|
|
48
|
+
* Neither reads a bar after the chart's own. Called on every bar, as a `ta`
|
|
49
|
+
* sum is.
|
|
50
|
+
*/
|
|
51
|
+
export declare function securityOf(context: SecurityContext, interval: TimeFrame, setup: SecuritySetup, options?: SecurityOptions): (bar: ScriptBar) => number;
|
|
52
|
+
//# sourceMappingURL=security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../src/security.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAG/D,OAAO,EAAgB,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjE,+EAA+E;AAC/E,MAAM,WAAW,gBAAgB;IAC/B,2GAA2G;IAC3G,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE;QACd,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACxB,KAAK,IAAI,WAAW,CAAC;QACrB,MAAM,IAAI,YAAY,CAAC;KACxB,CAAC;CACH;AAED,sGAAsG;AACtG,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,gBAAgB,KAAK,CAAC,GAAG,EAAE,SAAS,KAAK,MAAM,CAAC;AAElF,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,sEAAsE;AACtE,MAAM,WAAW,eAAe;IAC9B,mGAAmG;IACnG,QAAQ,IAAI,SAAS;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxC,2FAA2F;IAC3F,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6HAA6H;IAC7H,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,uGAAuG;IACvG,OAAO,CAAC,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACzC;AA6BD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,SAAS,EACnB,KAAK,EAAE,aAAa,EACpB,OAAO,GAAE,eAAoB,GAC5B,CAAC,GAAG,EAAE,SAAS,KAAK,MAAM,CA8F5B"}
|
package/dist/state.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Scope } from './scope.js';
|
|
2
|
+
/** A value kept from bar to bar: what a bar leaves in it, the next bar finds. */
|
|
3
|
+
export interface Var<T> {
|
|
4
|
+
value: T;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A value kept from bar to bar, put back to the bar before's when the live
|
|
8
|
+
* bar runs again. An object is put back as the same object: keep a handle
|
|
9
|
+
* in one (a line drawn), and change a list through `state.array`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function keep<T>(init: T): Var<T>;
|
|
12
|
+
/** A value a bar the script sets and reads back (`at(1)`: the bar before's). */
|
|
13
|
+
export interface ScriptSeries {
|
|
14
|
+
/** Set this bar's value; returns it. */
|
|
15
|
+
set(value: number): number;
|
|
16
|
+
/** The value `back` bars ago (0: this bar's); NaN where none was set. */
|
|
17
|
+
at(back?: number): number;
|
|
18
|
+
}
|
|
19
|
+
export declare function seriesOf(): ScriptSeries;
|
|
20
|
+
/**
|
|
21
|
+
* A list kept from bar to bar. On the live bar it records how to undo each
|
|
22
|
+
* change, so a tick that runs the bar again starts from the list as the bar
|
|
23
|
+
* before left it; on the closed bars it records nothing.
|
|
24
|
+
*/
|
|
25
|
+
export declare class ScriptArray {
|
|
26
|
+
private readonly scope;
|
|
27
|
+
private items;
|
|
28
|
+
private undo;
|
|
29
|
+
constructor(scope: Scope);
|
|
30
|
+
private record;
|
|
31
|
+
/** Room for one more number, or the bar stops. */
|
|
32
|
+
private grow;
|
|
33
|
+
size(): number;
|
|
34
|
+
/** The value at `index` (negative: from the end); NaN outside the list. */
|
|
35
|
+
get(index: number): number;
|
|
36
|
+
set(index: number, value: number): void;
|
|
37
|
+
push(value: number): void;
|
|
38
|
+
pop(): number;
|
|
39
|
+
shift(): number;
|
|
40
|
+
unshift(value: number): void;
|
|
41
|
+
clear(): void;
|
|
42
|
+
/** A copy of the values. */
|
|
43
|
+
toArray(): number[];
|
|
44
|
+
sum(): number;
|
|
45
|
+
avg(): number;
|
|
46
|
+
min(): number;
|
|
47
|
+
max(): number;
|
|
48
|
+
/** The middle value, or the mean of the two middle ones. */
|
|
49
|
+
median(): number;
|
|
50
|
+
}
|
|
51
|
+
export declare function arrayOf(): ScriptArray;
|
|
52
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":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B,OAAO,IAAI,WAAW,CAErC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Ring } from '../Ring.js';
|
|
2
|
+
import { Step } from './common.js';
|
|
3
|
+
/** Simple moving average of the last `period` values; a gap starts it again. */
|
|
4
|
+
export declare function sma(period: number): Step;
|
|
5
|
+
/** Exponential moving average, started as the simple average of its first `period` values. */
|
|
6
|
+
export declare function ema(period: number): Step;
|
|
7
|
+
/** Wilder's smoothing (RMA, SMMA): an EMA moving 1 / period of the way. */
|
|
8
|
+
export declare function rma(period: number): Step;
|
|
9
|
+
/** The last `period` values, oldest first, or null when one of them is missing. */
|
|
10
|
+
export declare function windowOf(ring: Ring, p: number): number[] | null;
|
|
11
|
+
/** Linearly weighted moving average: the newest of `period` values weighs `period`, the oldest 1. */
|
|
12
|
+
export declare function wma(period: number): Step;
|
|
13
|
+
/** Standard deviation of the whole population of the last `period` values. */
|
|
14
|
+
export declare function stdev(period: number): Step;
|
|
15
|
+
/** Hull moving average: a weighted average of twice the half-period one less the full one, over the root of the period (each at least 2), as the built-in HMA. */
|
|
16
|
+
export declare function hma(period: number): Step;
|
|
17
|
+
/** Volume-weighted moving average of the last `period` bars, as the built-in VWMA: none while their volume is nothing. */
|
|
18
|
+
export declare function vwma(period: number): (value: number, volume: number) => number;
|
|
19
|
+
//# sourceMappingURL=averages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"averages.d.ts","sourceRoot":"","sources":["../../src/ta/averages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAwB,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAS9D,gFAAgF;AAChF,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAexC;AAqBD,8FAA8F;AAC9F,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAExC;AAED,2EAA2E;AAC3E,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAExC;AAED,mFAAmF;AACnF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAS/D;AAED,qGAAqG;AACrG,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAYxC;AAED,8EAA8E;AAC9E,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAgB1C;AAED,kKAAkK;AAClK,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAExC;AAcD,0HAA0H;AAC1H,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAuB9E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** A value a sum takes: a number, or none (NaN) for anything that is not a finite number. */
|
|
2
|
+
export declare function num(value: number): number;
|
|
3
|
+
/** A period of at least one, as the built-in indicators take one: its whole part. */
|
|
4
|
+
export declare function whole(period: number): number;
|
|
5
|
+
/** A sum a bar at a time: given this bar's value, it gives this bar's result. */
|
|
6
|
+
export type Step = (value: number) => number;
|
|
7
|
+
/** The prices of a bar a sum of ranges reads. */
|
|
8
|
+
export interface BarPrices {
|
|
9
|
+
readonly high: number;
|
|
10
|
+
readonly low: number;
|
|
11
|
+
readonly close: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A sum over a value a bar as `@tradecanvas/core`'s `ta` runs a built-in
|
|
15
|
+
* indicator over one: from its first number on, a missing value is computed
|
|
16
|
+
* over as the last number (no change on that bar) and gives none itself.
|
|
17
|
+
*/
|
|
18
|
+
export declare function holdGaps<T>(step: (value: number) => T, none: T): (value: number) => T;
|
|
19
|
+
/**
|
|
20
|
+
* A bar's prices as the built-in indicators are given them: a close that is
|
|
21
|
+
* no number is the close before, another price that is none is its close.
|
|
22
|
+
*/
|
|
23
|
+
export declare function cleanPrices(): (bar: BarPrices) => BarPrices;
|
|
24
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/ta/common.ts"],"names":[],"mappings":"AAEA,6FAA6F;AAC7F,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzC;AAED,qFAAqF;AACrF,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,iFAAiF;AACjF,MAAM,MAAM,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;AAE7C,iDAAiD;AACjD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,CAWrF;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,CAAC,GAAG,EAAE,SAAS,KAAK,SAAS,CAQ3D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Step } from './common.js';
|
|
2
|
+
/** True on the bar where `a` goes over `b`: at or under it the bar before, over it now. */
|
|
3
|
+
export declare function crossover(): (a: number, b: number) => boolean;
|
|
4
|
+
/** True on the bar where `a` goes under `b`: at or over it the bar before, under it now. */
|
|
5
|
+
export declare function crossunder(): (a: number, b: number) => boolean;
|
|
6
|
+
/** True on the bar where `a` goes over or under `b`. */
|
|
7
|
+
export declare function cross(): (a: number, b: number) => boolean;
|
|
8
|
+
/** The high of a pivot `right` bars back: higher than the `left` before it and the `right` after it. NaN on other bars. */
|
|
9
|
+
export declare function pivothigh(left: number, right: number): Step;
|
|
10
|
+
/** The low of a pivot `right` bars back: lower than the `left` before it and the `right` after it. NaN on other bars. */
|
|
11
|
+
export declare function pivotlow(left: number, right: number): Step;
|
|
12
|
+
/** How many bars since the condition was last true (0 on a bar it is); NaN before it ever was. */
|
|
13
|
+
export declare function barssince(): (condition: boolean) => number;
|
|
14
|
+
/** The value on the bar of the condition's `occurrence`-th last true (0: the last); NaN until there is one. */
|
|
15
|
+
export declare function valuewhen(occurrence?: number): (condition: boolean, value: number) => number;
|
|
16
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/ta/events.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAiBpD,2FAA2F;AAC3F,wBAAgB,SAAS,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAE7D;AAED,4FAA4F;AAC5F,wBAAgB,UAAU,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAE9D;AAED,wDAAwD;AACxD,wBAAgB,KAAK,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAQzD;AAqBD,2HAA2H;AAC3H,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAE3D;AAED,yHAAyH;AACzH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAE1D;AAED,kGAAkG;AAClG,wBAAgB,SAAS,IAAI,CAAC,SAAS,EAAE,OAAO,KAAK,MAAM,CAM1D;AAED,+GAA+G;AAC/G,wBAAgB,SAAS,CAAC,UAAU,SAAI,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAOvF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ema, hma, rma, sma, stdev, vwma, wma } from './averages.js';
|
|
2
|
+
import { barssince, cross, crossover, crossunder, pivothigh, pivotlow, valuewhen } from './events.js';
|
|
3
|
+
import { bb, change, macd, mom, roc, rsi } from './oscillators.js';
|
|
4
|
+
import { atr, highest, lowest, supertrend, tr } from './ranges.js';
|
|
5
|
+
import { falling, highestbars, lowestbars, mfi, obv, rising, sar, stoch } from './moves.js';
|
|
6
|
+
import { alma, correlation, cum, dev, linreg, median, percentileLinearInterpolation, percentileNearestRank, percentrank, sum, swma, variance } from './statistics.js';
|
|
7
|
+
export type { BandsValue, MacdValue } from './oscillators.js';
|
|
8
|
+
export type { SupertrendValue } from './ranges.js';
|
|
9
|
+
export type { BarPrices, Step } from './common.js';
|
|
10
|
+
/**
|
|
11
|
+
* The sums a script is made of, each run a bar at a time. Make one in the
|
|
12
|
+
* script's setup (`const fast = ta.ema(9)`), then give it a value on each
|
|
13
|
+
* bar (`fast(bar.close)`): it keeps its own state, so two calls of
|
|
14
|
+
* `ta.ema(9)` are two averages. Their values are the chart's own built-in
|
|
15
|
+
* indicators' (`@tradecanvas/core`), a missing value (NaN) handled as there.
|
|
16
|
+
*/
|
|
17
|
+
export declare const ta: {
|
|
18
|
+
sma: typeof sma;
|
|
19
|
+
ema: typeof ema;
|
|
20
|
+
rma: typeof rma;
|
|
21
|
+
wma: typeof wma;
|
|
22
|
+
vwma: typeof vwma;
|
|
23
|
+
hma: typeof hma;
|
|
24
|
+
stdev: typeof stdev;
|
|
25
|
+
bb: typeof bb;
|
|
26
|
+
rsi: typeof rsi;
|
|
27
|
+
macd: typeof macd;
|
|
28
|
+
change: typeof change;
|
|
29
|
+
mom: typeof mom;
|
|
30
|
+
roc: typeof roc;
|
|
31
|
+
tr: typeof tr;
|
|
32
|
+
atr: typeof atr;
|
|
33
|
+
supertrend: typeof supertrend;
|
|
34
|
+
highest: typeof highest;
|
|
35
|
+
lowest: typeof lowest;
|
|
36
|
+
crossover: typeof crossover;
|
|
37
|
+
crossunder: typeof crossunder;
|
|
38
|
+
cross: typeof cross;
|
|
39
|
+
pivothigh: typeof pivothigh;
|
|
40
|
+
pivotlow: typeof pivotlow;
|
|
41
|
+
barssince: typeof barssince;
|
|
42
|
+
valuewhen: typeof valuewhen;
|
|
43
|
+
sum: typeof sum;
|
|
44
|
+
cum: typeof cum;
|
|
45
|
+
median: typeof median;
|
|
46
|
+
percentileNearestRank: typeof percentileNearestRank;
|
|
47
|
+
percentileLinearInterpolation: typeof percentileLinearInterpolation;
|
|
48
|
+
percentrank: typeof percentrank;
|
|
49
|
+
dev: typeof dev;
|
|
50
|
+
variance: typeof variance;
|
|
51
|
+
correlation: typeof correlation;
|
|
52
|
+
linreg: typeof linreg;
|
|
53
|
+
alma: typeof alma;
|
|
54
|
+
swma: typeof swma;
|
|
55
|
+
stoch: typeof stoch;
|
|
56
|
+
mfi: typeof mfi;
|
|
57
|
+
obv: typeof obv;
|
|
58
|
+
sar: typeof sar;
|
|
59
|
+
highestbars: typeof highestbars;
|
|
60
|
+
lowestbars: typeof lowestbars;
|
|
61
|
+
rising: typeof rising;
|
|
62
|
+
falling: typeof falling;
|
|
63
|
+
};
|
|
64
|
+
export type ScriptTa = typeof ta;
|
|
65
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ta/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACtG,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC5F,OAAO,EACL,IAAI,EACJ,WAAW,EACX,GAAG,EACH,GAAG,EACH,MAAM,EACN,MAAM,EACN,6BAA6B,EAC7B,qBAAqB,EACrB,WAAW,EACX,GAAG,EACH,IAAI,EACJ,QAAQ,EACT,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Cd,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BarPrices, Step } from './common.js';
|
|
2
|
+
/** The raw stochastic %K: where `value` stands between the lowest low and the highest high of the last `period` bars, 0 to 100; 50 when they are one. */
|
|
3
|
+
export declare function stoch(period: number): (value: number, high: number, low: number) => number;
|
|
4
|
+
/**
|
|
5
|
+
* The Money Flow Index of `value` (the typical price, as the built-in MFI
|
|
6
|
+
* reads) and the volume: the share of the last `period` bars' money that
|
|
7
|
+
* came on bars where it rose, 0 to 100; 100 when it never fell.
|
|
8
|
+
*/
|
|
9
|
+
export declare function mfi(period: number): (value: number, volume: number) => number;
|
|
10
|
+
/** On-balance volume: each bar's volume added when the close rose, taken away when it fell; 0 on the first bar. */
|
|
11
|
+
export declare function obv(): (close: number, volume: number) => number;
|
|
12
|
+
/**
|
|
13
|
+
* Parabolic SAR, as the built-in: from the second bar, its trend first read
|
|
14
|
+
* from the first two closes. The step starts at `start`, grows by
|
|
15
|
+
* `increment` with each new extreme, up to `max`, and starts again at a turn.
|
|
16
|
+
*/
|
|
17
|
+
export declare function sar(start?: number, increment?: number, max?: number): (bar: BarPrices) => number;
|
|
18
|
+
/** How many bars back the highest of the last `period` values is, as an offset at or under 0. */
|
|
19
|
+
export declare function highestbars(period: number): Step;
|
|
20
|
+
/** How many bars back the lowest of the last `period` values is, as an offset at or under 0. */
|
|
21
|
+
export declare function lowestbars(period: number): Step;
|
|
22
|
+
/** Whether the value is over every one of the `period` before it. */
|
|
23
|
+
export declare function rising(period: number): (value: number) => boolean;
|
|
24
|
+
/** Whether the value is under every one of the `period` before it. */
|
|
25
|
+
export declare function falling(period: number): (value: number) => boolean;
|
|
26
|
+
//# sourceMappingURL=moves.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moves.d.ts","sourceRoot":"","sources":["../../src/ta/moves.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2B,KAAK,SAAS,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAQjF,yJAAyJ;AACzJ,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,CAe1F;AAED;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAkB7E;AAED,mHAAmH;AACnH,wBAAgB,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAc/D;AAED;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,KAAK,SAAO,EAAE,SAAS,SAAO,EAAE,GAAG,SAAM,GAAG,CAAC,GAAG,EAAE,SAAS,KAAK,MAAM,CAmDzF;AAgBD,iGAAiG;AACjG,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE/C;AAeD,qEAAqE;AACrE,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAEjE;AAED,sEAAsE;AACtE,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAElE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Step } from './common.js';
|
|
2
|
+
/** Relative Strength Index, 0 to 100, as the built-in RSI: Wilder's smoothing of the gains and losses, started as their simple average. */
|
|
3
|
+
export declare function rsi(period?: number): Step;
|
|
4
|
+
export interface MacdValue {
|
|
5
|
+
readonly macd: number;
|
|
6
|
+
readonly signal: number;
|
|
7
|
+
readonly histogram: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* MACD: the fast average less the slow one, its signal line and the one less
|
|
11
|
+
* the other. Its averages start as simple ones, as every EMA here does (the
|
|
12
|
+
* built-in MACD indicator starts its own at the first close, so its first
|
|
13
|
+
* hundred bars or so differ by a hair).
|
|
14
|
+
*/
|
|
15
|
+
export declare function macd(fast?: number, slow?: number, signal?: number): (value: number) => MacdValue;
|
|
16
|
+
export interface BandsValue {
|
|
17
|
+
readonly basis: number;
|
|
18
|
+
readonly upper: number;
|
|
19
|
+
readonly lower: number;
|
|
20
|
+
}
|
|
21
|
+
/** Bollinger Bands: a simple average and the lines `mult` standard deviations either side of it. */
|
|
22
|
+
export declare function bb(period?: number, mult?: number): (value: number) => BandsValue;
|
|
23
|
+
/** How far a value is from the one `bars` before it. */
|
|
24
|
+
export declare function change(bars?: number): Step;
|
|
25
|
+
/** Momentum: how far a value is from the one `period` bars before it. */
|
|
26
|
+
export declare function mom(period?: number): Step;
|
|
27
|
+
/** Rate of change in per cent from the value `period` bars before, as the built-in ROC: 0 from a value of 0. */
|
|
28
|
+
export declare function roc(period?: number): Step;
|
|
29
|
+
//# sourceMappingURL=oscillators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oscillators.d.ts","sourceRoot":"","sources":["../../src/ta/oscillators.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwB,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAE9D,2IAA2I;AAC3I,wBAAgB,GAAG,CAAC,MAAM,SAAK,GAAG,IAAI,CAErC;AAgCD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,IAAI,SAAK,EAAE,IAAI,SAAK,EAAE,MAAM,SAAI,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,CAEnF;AAeD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,oGAAoG;AACpG,wBAAgB,EAAE,CAAC,MAAM,SAAK,EAAE,IAAI,SAAI,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,UAAU,CAEvE;AAYD,wDAAwD;AACxD,wBAAgB,MAAM,CAAC,IAAI,SAAI,GAAG,IAAI,CAOrC;AAED,yEAAyE;AACzE,wBAAgB,GAAG,CAAC,MAAM,SAAK,GAAG,IAAI,CAErC;AAED,gHAAgH;AAChH,wBAAgB,GAAG,CAAC,MAAM,SAAK,GAAG,IAAI,CAErC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BarPrices, Step } from './common.js';
|
|
2
|
+
/** A bar's true range: its range, stretched to the close before it; the first bar's is its own range. */
|
|
3
|
+
export declare function tr(): (bar: BarPrices) => number;
|
|
4
|
+
/** Average True Range, as the built-in ATR: the simple average of the first `period` true ranges, then Wilder's smoothing. */
|
|
5
|
+
export declare function atr(period?: number): (bar: BarPrices) => number;
|
|
6
|
+
export interface SupertrendValue {
|
|
7
|
+
/** The line: under the bars while the trend is up, over them while it is down. */
|
|
8
|
+
readonly value: number;
|
|
9
|
+
/** 1 while the trend is up, -1 while it is down. */
|
|
10
|
+
readonly trend: number;
|
|
11
|
+
}
|
|
12
|
+
/** Supertrend, as the built-in: bands `factor` ATRs from the bar's middle, each held until the close crosses it. */
|
|
13
|
+
export declare function supertrend(factor?: number, period?: number): (bar: BarPrices) => SupertrendValue;
|
|
14
|
+
/** The highest of the last `period` values. */
|
|
15
|
+
export declare function highest(period: number): Step;
|
|
16
|
+
/** The lowest of the last `period` values. */
|
|
17
|
+
export declare function lowest(period: number): Step;
|
|
18
|
+
//# sourceMappingURL=ranges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ranges.d.ts","sourceRoot":"","sources":["../../src/ta/ranges.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,SAAS,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAEjF,yGAAyG;AACzG,wBAAgB,EAAE,IAAI,CAAC,GAAG,EAAE,SAAS,KAAK,MAAM,CAY/C;AAED,8HAA8H;AAC9H,wBAAgB,GAAG,CAAC,MAAM,SAAK,GAAG,CAAC,GAAG,EAAE,SAAS,KAAK,MAAM,CAiB3D;AAED,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,oHAAoH;AACpH,wBAAgB,UAAU,CAAC,MAAM,SAAI,EAAE,MAAM,SAAK,GAAG,CAAC,GAAG,EAAE,SAAS,KAAK,eAAe,CAwBvF;AAmBD,+CAA+C;AAC/C,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE5C;AAED,8CAA8C;AAC9C,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE3C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Step } from './common.js';
|
|
2
|
+
/** The sum of the last `period` values. */
|
|
3
|
+
export declare function sum(period: number): Step;
|
|
4
|
+
/** The running total of every value so far; a missing one is passed over. None before the first number. */
|
|
5
|
+
export declare function cum(): Step;
|
|
6
|
+
/** The middle of the last `period` values; of an even count, the mean of the two in the middle. */
|
|
7
|
+
export declare function median(period: number): Step;
|
|
8
|
+
/** The value `percentage` of the way up the last `period` values, by the nearest rank: one of the values itself. */
|
|
9
|
+
export declare function percentileNearestRank(period: number, percentage: number): Step;
|
|
10
|
+
/** The value `percentage` of the way up the last `period` values, between the two values either side of it. */
|
|
11
|
+
export declare function percentileLinearInterpolation(period: number, percentage: number): Step;
|
|
12
|
+
/** How many of the `period` values before this one are at or under it, as a percentage. */
|
|
13
|
+
export declare function percentrank(period: number): Step;
|
|
14
|
+
/** The mean distance of the last `period` values from their mean. */
|
|
15
|
+
export declare function dev(period: number): Step;
|
|
16
|
+
/** The variance of the whole population of the last `period` values: `ta.stdev` squared, worked out the same way. */
|
|
17
|
+
export declare function variance(period: number): Step;
|
|
18
|
+
/** How closely two values move together over the last `period` bars, from -1 to 1; none while either stays flat. */
|
|
19
|
+
export declare function correlation(period: number): (a: number, b: number) => number;
|
|
20
|
+
/** The least-squares line through the last `period` values (2 to 5000), read at the newest (or `offset` bars before it), as the built-in LSMA. */
|
|
21
|
+
export declare function linreg(period: number, offset?: number): Step;
|
|
22
|
+
/** The Arnaud Legoux moving average, as the built-in ALMA: weights in a bell `offset` of the way along the window, `sigma` setting its width. */
|
|
23
|
+
export declare function alma(period: number, offset?: number, sigma?: number): Step;
|
|
24
|
+
/** The symmetrically weighted average of the last four values: weights 1, 2, 2, 1. */
|
|
25
|
+
export declare function swma(): Step;
|
|
26
|
+
//# sourceMappingURL=statistics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../../src/ta/statistics.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AA0BpD,2CAA2C;AAC3C,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAExC;AAED,2GAA2G;AAC3G,wBAAgB,GAAG,IAAI,IAAI,CAU1B;AAED,mGAAmG;AACnG,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAM3C;AAOD,oHAAoH;AACpH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAQ9E;AAED,+GAA+G;AAC/G,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAStF;AAED,2FAA2F;AAC3F,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAYhD;AAED,qEAAqE;AACrE,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAKxC;AAED,qHAAqH;AACrH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAW7C;AAED,oHAAoH;AACpH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,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