pinets 0.9.6 → 0.9.8
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/dist/pinets.min.browser.es.js +17 -34
- package/dist/pinets.min.browser.es.js.map +1 -1
- package/dist/pinets.min.browser.js +19 -36
- package/dist/pinets.min.browser.js.map +1 -1
- package/dist/pinets.min.cjs +19 -36
- package/dist/pinets.min.cjs.map +1 -1
- package/dist/pinets.min.es.js +17 -34
- package/dist/pinets.min.es.js.map +1 -1
- package/dist/types/Context.class.d.ts +25 -1
- package/dist/types/PineTS.class.d.ts +10 -1
- package/dist/types/namespaces/Core.d.ts +40 -2
- package/dist/types/namespaces/box/BoxHelper.d.ts +1 -1
- package/dist/types/namespaces/box/BoxObject.d.ts +1 -0
- package/dist/types/namespaces/label/LabelHelper.d.ts +1 -1
- package/dist/types/namespaces/line/LineHelper.d.ts +1 -1
- package/dist/types/namespaces/linefill/LinefillHelper.d.ts +1 -1
- package/dist/types/namespaces/linefill/LinefillObject.d.ts +1 -0
- package/dist/types/namespaces/matrix/methods/mult.d.ts +1 -1
- package/dist/types/namespaces/polyline/PolylineHelper.d.ts +1 -1
- package/dist/types/namespaces/polyline/PolylineObject.d.ts +1 -0
- package/dist/types/namespaces/table/TableHelper.d.ts +6 -1
- package/dist/types/namespaces/table/TableObject.d.ts +1 -0
- package/dist/types/transpiler/analysis/ScopeManager.d.ts +2 -0
- package/dist/types/transpiler/pineToJS/codegen.d.ts +33 -0
- package/dist/types/transpiler/pineToJS/parser.d.ts +1 -0
- package/dist/types/transpiler/settings.d.ts +1 -0
- package/package.json +1 -1
- package/dist/types/NaProxy.d.ts +0 -19
- package/dist/types/TimeSeries.class.d.ts +0 -49
- package/dist/types/TimeSeries.d.ts +0 -15
- package/dist/types/namespaces/Input.d.ts +0 -24
- package/dist/types/namespaces/PineArray.d.ts +0 -62
- package/dist/types/namespaces/PineColor.d.ts +0 -0
- package/dist/types/namespaces/PineMath.d.ts +0 -28
- package/dist/types/namespaces/PineRequest.d.ts +0 -8
- package/dist/types/namespaces/Plot.helper.d.ts +0 -16
- package/dist/types/namespaces/TechnicalAnalysis.d.ts +0 -30
- package/dist/types/namespaces/request/types/barmerge.type.d.ts +0 -7
- package/dist/types/namespaces/strategy/StrategySimulator.d.ts +0 -84
- package/dist/types/namespaces/strategy/closedtrades/index.d.ts +0 -18
- package/dist/types/namespaces/strategy/methods/any.d.ts +0 -5
- package/dist/types/namespaces/strategy/methods/cancel.d.ts +0 -1
- package/dist/types/namespaces/strategy/methods/cancel_all.d.ts +0 -1
- package/dist/types/namespaces/strategy/methods/cash.d.ts +0 -5
- package/dist/types/namespaces/strategy/methods/close.d.ts +0 -1
- package/dist/types/namespaces/strategy/methods/close_all.d.ts +0 -1
- package/dist/types/namespaces/strategy/methods/closedtrades.d.ts +0 -4
- package/dist/types/namespaces/strategy/methods/entry.d.ts +0 -3
- package/dist/types/namespaces/strategy/methods/equity.d.ts +0 -4
- package/dist/types/namespaces/strategy/methods/exit.d.ts +0 -3
- package/dist/types/namespaces/strategy/methods/fixed.d.ts +0 -5
- package/dist/types/namespaces/strategy/methods/long.d.ts +0 -4
- package/dist/types/namespaces/strategy/methods/netprofit.d.ts +0 -4
- package/dist/types/namespaces/strategy/methods/opentrades.d.ts +0 -4
- package/dist/types/namespaces/strategy/methods/order.d.ts +0 -6
- package/dist/types/namespaces/strategy/methods/param.d.ts +0 -5
- package/dist/types/namespaces/strategy/methods/percent_of_equity.d.ts +0 -5
- package/dist/types/namespaces/strategy/methods/position_avg_price.d.ts +0 -5
- package/dist/types/namespaces/strategy/methods/position_entry.d.ts +0 -5
- package/dist/types/namespaces/strategy/methods/position_entry_name.d.ts +0 -5
- package/dist/types/namespaces/strategy/methods/position_size.d.ts +0 -5
- package/dist/types/namespaces/strategy/methods/short.d.ts +0 -4
- package/dist/types/namespaces/strategy/models/Order.d.ts +0 -31
- package/dist/types/namespaces/strategy/models/Position.d.ts +0 -16
- package/dist/types/namespaces/strategy/models/Trade.d.ts +0 -45
- package/dist/types/namespaces/strategy/opentrades/index.d.ts +0 -10
- package/dist/types/namespaces/strategy/risk/index.d.ts +0 -11
- package/dist/types/namespaces/strategy/strategy.index.d.ts +0 -53
- package/dist/types/namespaces/strategy/types.d.ts +0 -92
- package/dist/types/namespaces/strategy/utils.d.ts +0 -28
- package/dist/types/namespaces/ta/getters/obv.d.ts +0 -12
- package/dist/types/namespaces/ta/getters/tr.d.ts +0 -1
- package/dist/types/transpiler/ScopeManager.class.d.ts +0 -36
|
@@ -16,11 +16,35 @@ export declare class Context {
|
|
|
16
16
|
dataVersion: number;
|
|
17
17
|
__maxLoops: number;
|
|
18
18
|
NA: any;
|
|
19
|
+
/** Runtime warnings (OOB access, etc.) — non-blocking, script continues. */
|
|
20
|
+
warnings: {
|
|
21
|
+
message: string;
|
|
22
|
+
method?: string;
|
|
23
|
+
bar: number;
|
|
24
|
+
}[];
|
|
25
|
+
/** Alert events emitted by alert() and alertcondition() calls. */
|
|
26
|
+
alerts: {
|
|
27
|
+
type: string;
|
|
28
|
+
id: string;
|
|
29
|
+
message: string;
|
|
30
|
+
title?: string;
|
|
31
|
+
freq?: string;
|
|
32
|
+
bar_index: number;
|
|
33
|
+
time: number;
|
|
34
|
+
}[];
|
|
35
|
+
/** Alert mode: 'realtime' = only fire on live bars (TV behavior), 'all' = fire on every bar (backtest). */
|
|
36
|
+
_alertMode: 'realtime' | 'all';
|
|
37
|
+
/** Monotonically increasing counter, incremented each time a bar starts executing.
|
|
38
|
+
* Used by alertcondition/AlertHelper to detect re-execution of the same bar. */
|
|
39
|
+
_execTick: number;
|
|
40
|
+
/** Emit a runtime warning. The script continues execution (returns na/no-op). */
|
|
41
|
+
warn(message: string, method?: string): void;
|
|
19
42
|
lang: any;
|
|
20
43
|
length: number;
|
|
21
|
-
/** References to drawing helpers for streaming rollback */
|
|
44
|
+
/** References to drawing helpers for streaming rollback and plot sync */
|
|
22
45
|
_drawingHelpers: {
|
|
23
46
|
rollbackFromBar(barIdx: number): void;
|
|
47
|
+
syncToPlot?(): void;
|
|
24
48
|
}[];
|
|
25
49
|
pine: {
|
|
26
50
|
[key: string]: any;
|
|
@@ -48,6 +48,15 @@ export declare class PineTS {
|
|
|
48
48
|
* @param maxLoops Maximum iterations per loop (default: 500000)
|
|
49
49
|
*/
|
|
50
50
|
setMaxLoops(maxLoops: number): void;
|
|
51
|
+
private _alertMode;
|
|
52
|
+
/**
|
|
53
|
+
* Set alert mode.
|
|
54
|
+
* - 'realtime' (default): alerts only fire on the last (realtime) bar,
|
|
55
|
+
* matching TradingView behavior.
|
|
56
|
+
* - 'all': alerts fire on every bar, useful for backtesting alert strategies.
|
|
57
|
+
* @param mode Alert firing mode
|
|
58
|
+
*/
|
|
59
|
+
setAlertMode(mode: 'realtime' | 'all'): void;
|
|
51
60
|
constructor(source: IProvider | any[], tickerId?: string, timeframe?: string, limit?: number, sDate?: number, eDate?: number);
|
|
52
61
|
setDebugSettings({ ln, debug }: {
|
|
53
62
|
ln: boolean;
|
|
@@ -82,7 +91,7 @@ export declare class PineTS {
|
|
|
82
91
|
live?: boolean;
|
|
83
92
|
interval?: number;
|
|
84
93
|
}): {
|
|
85
|
-
on: (event: 'data' | 'error', callback: Function) => void;
|
|
94
|
+
on: (event: 'data' | 'error' | 'warning' | 'alert', callback: Function) => void;
|
|
86
95
|
stop: () => void;
|
|
87
96
|
};
|
|
88
97
|
/**
|
|
@@ -11,6 +11,41 @@ export declare class NAHelper {
|
|
|
11
11
|
param(source: any, index?: number): any;
|
|
12
12
|
any(series: any): boolean;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Alert frequency constants (Pine Script alert.freq_* enum values).
|
|
16
|
+
*/
|
|
17
|
+
export declare const ALERT_FREQ: {
|
|
18
|
+
freq_all: string;
|
|
19
|
+
freq_once_per_bar: string;
|
|
20
|
+
freq_once_per_bar_close: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* AlertHelper implements the dual-use `alert` identifier.
|
|
24
|
+
* - `alert(msg, freq)` → `alert.any(msg, freq, {__callsiteId})` — fires an alert event
|
|
25
|
+
* - `alert.freq_once_per_bar` → frequency constant
|
|
26
|
+
*
|
|
27
|
+
* Each `alert()` call site gets a stable ID (`alert_0`, `alert_1`, ...)
|
|
28
|
+
* injected by the transpiler at compile time via `__callsiteId`. This ensures
|
|
29
|
+
* per-callsite frequency gating works correctly even when live bars are
|
|
30
|
+
* re-executed or when alert() calls are inside conditional branches.
|
|
31
|
+
*/
|
|
32
|
+
export declare class AlertHelper {
|
|
33
|
+
private context;
|
|
34
|
+
/**
|
|
35
|
+
* Per-callsite, per-bar frequency gating.
|
|
36
|
+
* Key: `${callsiteId}:${barIdx}`, tracks which (callsite, bar) pairs have fired.
|
|
37
|
+
*/
|
|
38
|
+
private _firedKeys;
|
|
39
|
+
/** Fallback counter for PineTS-syntax (non-transpiled) calls without __callsiteId. */
|
|
40
|
+
private _fallbackCounter;
|
|
41
|
+
private _fallbackLastExecTick;
|
|
42
|
+
constructor(context: any);
|
|
43
|
+
get freq_all(): string;
|
|
44
|
+
get freq_once_per_bar(): string;
|
|
45
|
+
get freq_once_per_bar_close(): string;
|
|
46
|
+
param(source: any, _index?: number, _id?: string): any;
|
|
47
|
+
any(message: any, freq?: any, opts?: any): void;
|
|
48
|
+
}
|
|
14
49
|
export declare class Core {
|
|
15
50
|
private context;
|
|
16
51
|
constructor(context: any);
|
|
@@ -20,8 +55,11 @@ export declare class Core {
|
|
|
20
55
|
na(series: any): boolean;
|
|
21
56
|
nz(series: any, replacement?: number): any;
|
|
22
57
|
fixnan(series: any): any;
|
|
23
|
-
|
|
24
|
-
|
|
58
|
+
private _acCounter;
|
|
59
|
+
private _acLastExecTick;
|
|
60
|
+
/** Per-callsite, per-bar dedup for alertcondition (prevents duplicate fires on live re-execution). */
|
|
61
|
+
private _acFiredKeys;
|
|
62
|
+
alertcondition(condition: any, title?: any, message?: any): void;
|
|
25
63
|
error(...args: any[]): void;
|
|
26
64
|
max_bars_back(series?: any, length?: any): void;
|
|
27
65
|
/**
|
|
@@ -6,7 +6,7 @@ export declare class LabelHelper {
|
|
|
6
6
|
constructor(context: any);
|
|
7
7
|
param(source: any, index?: number, name?: string): any;
|
|
8
8
|
private _ensurePlotsEntry;
|
|
9
|
-
|
|
9
|
+
syncToPlot(): void;
|
|
10
10
|
/**
|
|
11
11
|
* Resolve a value that may be a Series, a bound function, or a plain scalar.
|
|
12
12
|
* Pine Script variables (inputs, chart properties) can be stored as Series
|
|
@@ -6,7 +6,7 @@ export declare class LineHelper {
|
|
|
6
6
|
constructor(context: any);
|
|
7
7
|
param(source: any, index?: number, name?: string): any;
|
|
8
8
|
private _ensurePlotsEntry;
|
|
9
|
-
|
|
9
|
+
syncToPlot(): void;
|
|
10
10
|
private _resolvePoint;
|
|
11
11
|
/**
|
|
12
12
|
* Resolve a value that may be a Series, a bound function, or a plain scalar.
|
|
@@ -6,7 +6,7 @@ export declare class LinefillHelper {
|
|
|
6
6
|
constructor(context: any);
|
|
7
7
|
param(source: any, index?: number, name?: string): any;
|
|
8
8
|
private _ensurePlotsEntry;
|
|
9
|
-
|
|
9
|
+
syncToPlot(): void;
|
|
10
10
|
/**
|
|
11
11
|
* Resolve a value that may be a Series, a bound function, or a plain scalar.
|
|
12
12
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PineMatrixObject } from '../PineMatrixObject';
|
|
2
2
|
import { Context } from '../../../Context.class';
|
|
3
3
|
import { PineArrayObject } from '../../array/PineArrayObject';
|
|
4
|
-
export declare function mult(context: Context): (id: PineMatrixObject, id2: PineMatrixObject | number | PineArrayObject) => PineMatrixObject;
|
|
4
|
+
export declare function mult(context: Context): (id: PineMatrixObject, id2: PineMatrixObject | number | PineArrayObject) => PineArrayObject | PineMatrixObject;
|
|
@@ -5,7 +5,7 @@ export declare class PolylineHelper {
|
|
|
5
5
|
constructor(context: any);
|
|
6
6
|
param(source: any, index?: number, name?: string): any;
|
|
7
7
|
private _ensurePlotsEntry;
|
|
8
|
-
|
|
8
|
+
syncToPlot(): void;
|
|
9
9
|
/**
|
|
10
10
|
* Resolve a value that may be a Series, a bound function, or a plain scalar.
|
|
11
11
|
*/
|
|
@@ -16,4 +16,5 @@ export declare class PolylineObject {
|
|
|
16
16
|
_createdAtBar: number;
|
|
17
17
|
constructor(points: ChartPointObject[], curved?: boolean, closed?: boolean, xloc?: string, line_color?: string, fill_color?: string, line_style?: string, line_width?: number, force_overlay?: boolean);
|
|
18
18
|
delete(): void;
|
|
19
|
+
toPlotData(): any;
|
|
19
20
|
}
|
|
@@ -5,7 +5,7 @@ export declare class TableHelper {
|
|
|
5
5
|
constructor(context: any);
|
|
6
6
|
param(source: any, index?: number, name?: string): any;
|
|
7
7
|
private _ensurePlotsEntry;
|
|
8
|
-
|
|
8
|
+
syncToPlot(): void;
|
|
9
9
|
private _resolve;
|
|
10
10
|
new(...args: any[]): TableObject;
|
|
11
11
|
any(...args: any[]): TableObject;
|
|
@@ -30,6 +30,11 @@ export declare class TableHelper {
|
|
|
30
30
|
set_frame_color(table_id: any, frame_color: any): void;
|
|
31
31
|
set_frame_width(table_id: any, frame_width: any): void;
|
|
32
32
|
get all(): TableObject[];
|
|
33
|
+
/**
|
|
34
|
+
* Remove all tables created at or after the given bar index.
|
|
35
|
+
* Called during streaming rollback.
|
|
36
|
+
*/
|
|
37
|
+
rollbackFromBar(barIdx: number): void;
|
|
33
38
|
private _setCellProp;
|
|
34
39
|
private _resolveText;
|
|
35
40
|
}
|
|
@@ -36,6 +36,7 @@ export declare class TableObject {
|
|
|
36
36
|
private _helper;
|
|
37
37
|
constructor(position?: string, columns?: number, rows?: number, bgcolor?: string, frame_color?: string, frame_width?: number, border_color?: string, border_width?: number, force_overlay?: boolean);
|
|
38
38
|
delete(): void;
|
|
39
|
+
toPlotData(): any;
|
|
39
40
|
setCell(column: number, row: number, props: Partial<TableCell>): void;
|
|
40
41
|
getCell(column: number, row: number): TableCell | null;
|
|
41
42
|
clearCell(column: number, row: number): void;
|
|
@@ -15,6 +15,7 @@ export declare class ScopeManager {
|
|
|
15
15
|
private taCallIdCounter;
|
|
16
16
|
private userCallIdCounter;
|
|
17
17
|
private plotCallIdCounter;
|
|
18
|
+
private alertCallIdCounter;
|
|
18
19
|
private loopGuardCounter;
|
|
19
20
|
private hoistingStack;
|
|
20
21
|
private suppressHoisting;
|
|
@@ -26,6 +27,7 @@ export declare class ScopeManager {
|
|
|
26
27
|
getNextTACallId(): any;
|
|
27
28
|
getNextUserCallId(): any;
|
|
28
29
|
getNextPlotCallId(): any;
|
|
30
|
+
getNextAlertCallId(): any;
|
|
29
31
|
getNextLoopGuardName(): string;
|
|
30
32
|
constructor();
|
|
31
33
|
pushScope(type: string): void;
|
|
@@ -15,6 +15,39 @@ export declare class CodeGenerator {
|
|
|
15
15
|
});
|
|
16
16
|
generate(ast: any): string;
|
|
17
17
|
private preProcessAST;
|
|
18
|
+
/**
|
|
19
|
+
* Scan the program body for variable declarations and assignments whose
|
|
20
|
+
* names collide with Pine namespace/built-in names (e.g., `fill`, `size`,
|
|
21
|
+
* `color`, `line`). Rename them with a `_$N` suffix so they don't shadow
|
|
22
|
+
* the namespace destructured from `$.pine`.
|
|
23
|
+
*
|
|
24
|
+
* Only renames **user variables** — function parameters are handled
|
|
25
|
+
* separately in generateFunctionDeclaration().
|
|
26
|
+
*
|
|
27
|
+
* Renaming rules:
|
|
28
|
+
* - Variable declaration target (let fill = ...) → renamed
|
|
29
|
+
* - Assignment target (fill := ...) → renamed
|
|
30
|
+
* - Bare identifier read (return fill) → renamed
|
|
31
|
+
* - Call callee (fill(...)) → NOT renamed (namespace call)
|
|
32
|
+
* - MemberExpression object (size.tiny) → NOT renamed (namespace access)
|
|
33
|
+
* - MemberExpression property (array.size) → NOT renamed (method name)
|
|
34
|
+
* - Object property key ({size: ...}) → NOT renamed (named arg key)
|
|
35
|
+
*/
|
|
36
|
+
private renameConflictingVariables;
|
|
37
|
+
/**
|
|
38
|
+
* Walk the AST and collect variable declarations / assignment targets
|
|
39
|
+
* whose names conflict with CONFLICTING_NAMES.
|
|
40
|
+
*/
|
|
41
|
+
private collectConflictingVarNames;
|
|
42
|
+
/**
|
|
43
|
+
* Context-aware variable reference renaming.
|
|
44
|
+
* Renames Identifiers that are user-variable references, but skips:
|
|
45
|
+
* - CallExpression callees (namespace function calls)
|
|
46
|
+
* - MemberExpression objects with non-computed property (namespace.member)
|
|
47
|
+
* - MemberExpression non-computed properties (obj.namespace)
|
|
48
|
+
* - Object property keys ({namespace: value})
|
|
49
|
+
*/
|
|
50
|
+
private renameVariableRefsInAST;
|
|
18
51
|
private collectFunctionParams;
|
|
19
52
|
writeSourceComment(startLine: any, endLine?: any): void;
|
|
20
53
|
write(str: any): void;
|
|
@@ -2,6 +2,7 @@ export declare const KNOWN_NAMESPACES: string[];
|
|
|
2
2
|
export declare const NAMESPACES_LIKE: string[];
|
|
3
3
|
export declare const ASYNC_METHODS: string[];
|
|
4
4
|
export declare const FACTORY_METHODS: string[];
|
|
5
|
+
export declare const NAMESPACE_COLLISION_NAMES: Set<string>;
|
|
5
6
|
export declare const CONTEXT_DATA_VARS: string[];
|
|
6
7
|
export declare const CONTEXT_PINE_VARS: string[];
|
|
7
8
|
export declare const CONTEXT_CORE_VARS: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinets",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.8",
|
|
4
4
|
"description": "Run Pine Script anywhere. PineTS is an open-source transpiler and runtime that brings Pine Script logic to Node.js and the browser with 1:1 syntax compatibility. Reliably write, port, and run indicators or strategies on your own infrastructure.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Pine Script",
|
package/dist/types/NaProxy.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NaProxy: A proxy object that represents `na` for UDT (User-Defined Type) values.
|
|
3
|
-
*
|
|
4
|
-
* In Pine Script, accessing a property on `na` returns `na`, and calling a method on
|
|
5
|
-
* `na` returns `na`. In JavaScript, NaN doesn't support property access, so we use
|
|
6
|
-
* this proxy as a stand-in.
|
|
7
|
-
*
|
|
8
|
-
* Behavior:
|
|
9
|
-
* - Any property access returns the proxy itself (chaining: proxy.bx.get_top → proxy)
|
|
10
|
-
* - Called as a function, returns proxy (proxy() → proxy, for chaining: proxy.method().field)
|
|
11
|
-
* - valueOf() returns NaN (arithmetic: proxy + 5 → NaN)
|
|
12
|
-
* - na.any(proxy) → true
|
|
13
|
-
*/
|
|
14
|
-
/** Symbol used to identify NaProxy objects */
|
|
15
|
-
export declare const NA_MARKER: unique symbol;
|
|
16
|
-
/** Singleton NaProxy instance */
|
|
17
|
-
export declare const NA_PROXY: any;
|
|
18
|
-
/** Check if a value is a NaProxy */
|
|
19
|
-
export declare function isNaProxy(val: any): boolean;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import Context from '../Context.class';
|
|
2
|
-
/**
|
|
3
|
-
* A lightweight wrapper around arrays to provide Pine Script-like "series" access behavior.
|
|
4
|
-
* Pine Script series are indexed relative to the current bar:
|
|
5
|
-
* - series[0] is the current value
|
|
6
|
-
* - series[1] is the previous value
|
|
7
|
-
*
|
|
8
|
-
* This class maps this reversed, relative indexing to the underlying chronological array
|
|
9
|
-
* using the Context's current index.
|
|
10
|
-
*/
|
|
11
|
-
export declare class TimeSeries<T = any> {
|
|
12
|
-
private readonly _data;
|
|
13
|
-
private readonly _ctx;
|
|
14
|
-
constructor(_data: T[], _ctx: Context);
|
|
15
|
-
/**
|
|
16
|
-
* Get the value at the specified offset from the current bar.
|
|
17
|
-
* @param offset The lookback offset (0 = current, 1 = previous, etc.)
|
|
18
|
-
*/
|
|
19
|
-
get(offset: number): T;
|
|
20
|
-
/**
|
|
21
|
-
* Set the value at the specified offset from the current bar.
|
|
22
|
-
* Usually used for setting current value (offset 0).
|
|
23
|
-
*/
|
|
24
|
-
set(offset: number, value: T): T;
|
|
25
|
-
/**
|
|
26
|
-
* Get the length of the series *so far* (up to current index)
|
|
27
|
-
* Note: This mimics the behavior where future data isn't "visible" yet
|
|
28
|
-
*/
|
|
29
|
-
get length(): number;
|
|
30
|
-
/**
|
|
31
|
-
* Returns the underlying raw data array.
|
|
32
|
-
* Useful for performance-critical bulk operations that understand the indexing.
|
|
33
|
-
*/
|
|
34
|
-
get data(): T[];
|
|
35
|
-
/**
|
|
36
|
-
* Creates a copy of the visible series as a reversed array (Pine Script standard format for bulk ops).
|
|
37
|
-
* Warning: This is O(N) and should be used sparingly.
|
|
38
|
-
*/
|
|
39
|
-
toArray(): T[];
|
|
40
|
-
/**
|
|
41
|
-
* Push a value to the underlying array.
|
|
42
|
-
* Used when constructing user-defined series dynamically.
|
|
43
|
-
*/
|
|
44
|
-
push(value: T): number;
|
|
45
|
-
/**
|
|
46
|
-
* Update the underlying array reference (e.g. for re-assignment)
|
|
47
|
-
*/
|
|
48
|
-
replaceData(newData: T[]): void;
|
|
49
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface IContext {
|
|
2
|
-
idx: number;
|
|
3
|
-
NA: any;
|
|
4
|
-
}
|
|
5
|
-
export declare class TimeSeries<T = any> {
|
|
6
|
-
private _data;
|
|
7
|
-
private context;
|
|
8
|
-
constructor(context: IContext, data?: T[]);
|
|
9
|
-
get(offset: number): T;
|
|
10
|
-
set(value: T, offset?: number): void;
|
|
11
|
-
push(value: T): void;
|
|
12
|
-
pop(): T | undefined;
|
|
13
|
-
get data(): T[];
|
|
14
|
-
get length(): number;
|
|
15
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
type InputOptions = {
|
|
2
|
-
title?: string;
|
|
3
|
-
group?: string;
|
|
4
|
-
} | any;
|
|
5
|
-
export declare class Input {
|
|
6
|
-
private context;
|
|
7
|
-
constructor(context: any);
|
|
8
|
-
param(source: any, index?: number): any[];
|
|
9
|
-
any(value: any, { title, group }?: InputOptions): any;
|
|
10
|
-
int(value: number, { title, group }?: InputOptions): any;
|
|
11
|
-
float(value: number, { title, group }?: InputOptions): any;
|
|
12
|
-
bool(value: boolean, { title, group }?: InputOptions): any;
|
|
13
|
-
string(value: string, { title, group }?: InputOptions): any;
|
|
14
|
-
timeframe(value: string, { title, group }?: InputOptions): any;
|
|
15
|
-
time(value: number, { title, group }?: InputOptions): any;
|
|
16
|
-
price(value: number, { title, group }?: InputOptions): any;
|
|
17
|
-
session(value: string, { title, group }?: InputOptions): any;
|
|
18
|
-
source(value: any, { title, group }?: InputOptions): any;
|
|
19
|
-
symbol(value: string, { title, group }?: InputOptions): any;
|
|
20
|
-
text_area(value: string, { title, group }?: InputOptions): any;
|
|
21
|
-
enum(value: string, { title, group }?: InputOptions): any;
|
|
22
|
-
color(value: string, { title, group }?: InputOptions): any;
|
|
23
|
-
}
|
|
24
|
-
export default Input;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
declare class PineArrayObject {
|
|
2
|
-
array: any;
|
|
3
|
-
constructor(array: any);
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* This class implements an array port of PineScript's array functions.
|
|
7
|
-
*/
|
|
8
|
-
export declare class PineArray {
|
|
9
|
-
private context;
|
|
10
|
-
private _cache;
|
|
11
|
-
constructor(context: any);
|
|
12
|
-
param(source: any, index?: number): any;
|
|
13
|
-
/**
|
|
14
|
-
* This function simulates PineScript's array.get() function
|
|
15
|
-
* @param id - the array object to get the value from
|
|
16
|
-
* @param index - the index of the value to get
|
|
17
|
-
* @returns the value at the given index
|
|
18
|
-
*/
|
|
19
|
-
get(id: PineArrayObject, index: number): any;
|
|
20
|
-
set(id: PineArrayObject, index: number, value: any): void;
|
|
21
|
-
push(id: PineArrayObject, value: any): void;
|
|
22
|
-
sum(id: PineArrayObject): number;
|
|
23
|
-
avg(id: PineArrayObject): number;
|
|
24
|
-
min(id: PineArrayObject, nth?: number): number;
|
|
25
|
-
max(id: PineArrayObject, nth?: number): number;
|
|
26
|
-
size(id: PineArrayObject): number;
|
|
27
|
-
new_bool(size: number, initial_value?: boolean): PineArrayObject;
|
|
28
|
-
new_float(size: number, initial_value?: number): PineArrayObject;
|
|
29
|
-
new_int(size: number, initial_value?: number): PineArrayObject;
|
|
30
|
-
new_string(size: number, initial_value?: string): PineArrayObject;
|
|
31
|
-
new<T>(size: number, initial_value: T): PineArrayObject;
|
|
32
|
-
slice(id: PineArrayObject, start: number, end?: number): PineArrayObject;
|
|
33
|
-
reverse(id: PineArrayObject): void;
|
|
34
|
-
includes(id: PineArrayObject, value: any): boolean;
|
|
35
|
-
indexof(id: PineArrayObject, value: any): number;
|
|
36
|
-
lastindexof(id: PineArrayObject, value: any): number;
|
|
37
|
-
stdev(id: PineArrayObject, biased?: boolean): number;
|
|
38
|
-
variance(id: PineArrayObject, biased?: boolean): number;
|
|
39
|
-
covariance(arr1: PineArrayObject, arr2: PineArrayObject, biased?: boolean): number;
|
|
40
|
-
first(id: PineArrayObject): any;
|
|
41
|
-
last(id: PineArrayObject): any;
|
|
42
|
-
clear(id: PineArrayObject): void;
|
|
43
|
-
join(id: PineArrayObject, separator?: string): string;
|
|
44
|
-
/** Array Manipulation Functions */
|
|
45
|
-
abs(id: PineArrayObject): PineArrayObject;
|
|
46
|
-
concat(id: PineArrayObject, other: PineArrayObject): PineArrayObject;
|
|
47
|
-
copy(id: PineArrayObject): PineArrayObject;
|
|
48
|
-
every(id: PineArrayObject, callback: (val: any) => boolean): boolean;
|
|
49
|
-
fill(id: PineArrayObject, value: any, start?: number, end?: number): void;
|
|
50
|
-
from(source: any[]): PineArrayObject;
|
|
51
|
-
insert(id: PineArrayObject, index: number, value: any): void;
|
|
52
|
-
pop(id: PineArrayObject): any;
|
|
53
|
-
range(id: PineArrayObject): number;
|
|
54
|
-
remove(id: PineArrayObject, index: number): any;
|
|
55
|
-
shift(id: PineArrayObject): any;
|
|
56
|
-
sort(id: PineArrayObject, order?: 'asc' | 'desc'): void;
|
|
57
|
-
sort_indices(id: PineArrayObject, comparator?: (a: any, b: any) => number): PineArrayObject;
|
|
58
|
-
standardize(id: PineArrayObject): PineArrayObject;
|
|
59
|
-
unshift(id: PineArrayObject, value: any): void;
|
|
60
|
-
some(id: PineArrayObject, callback: (val: any) => boolean): boolean;
|
|
61
|
-
}
|
|
62
|
-
export {};
|
|
File without changes
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export declare class PineMath {
|
|
2
|
-
private context;
|
|
3
|
-
private _cache;
|
|
4
|
-
constructor(context: any);
|
|
5
|
-
param(source: any, index: any, name?: string): any;
|
|
6
|
-
__eq(a: number, b: number): boolean;
|
|
7
|
-
abs(source: number[]): number;
|
|
8
|
-
pow(source: number[], power: number[]): number;
|
|
9
|
-
sqrt(source: number[]): number;
|
|
10
|
-
log(source: number[]): number;
|
|
11
|
-
ln(source: number[]): number;
|
|
12
|
-
exp(source: number[]): number;
|
|
13
|
-
floor(source: number[]): number;
|
|
14
|
-
ceil(source: number[]): number;
|
|
15
|
-
round(source: number[]): number;
|
|
16
|
-
random(): number;
|
|
17
|
-
max(...source: number[]): number;
|
|
18
|
-
min(...source: number[]): number;
|
|
19
|
-
sum(source: number[], length: number): number;
|
|
20
|
-
sin(source: number[]): number;
|
|
21
|
-
cos(source: number[]): number;
|
|
22
|
-
tan(source: number[]): number;
|
|
23
|
-
acos(source: number[]): number;
|
|
24
|
-
asin(source: number[]): number;
|
|
25
|
-
atan(source: number[]): number;
|
|
26
|
-
avg(...sources: number[][]): number;
|
|
27
|
-
}
|
|
28
|
-
export default PineMath;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare class PineRequest {
|
|
2
|
-
private context;
|
|
3
|
-
private _cache;
|
|
4
|
-
constructor(context: any);
|
|
5
|
-
param(source: any, index: any, name?: string): any[];
|
|
6
|
-
security(symbol: any, timeframe: any, expression: any, gaps?: boolean, lookahead?: boolean, ignore_invalid_symbol?: boolean, currency?: any, calc_bars_count?: any): Promise<any>;
|
|
7
|
-
private _findSecContextIdx;
|
|
8
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare class PlotHelper {
|
|
2
|
-
private context;
|
|
3
|
-
constructor(context: any);
|
|
4
|
-
private extractPlotOptions;
|
|
5
|
-
plotchar(series: number[], title: string, options: PlotCharOptions): void;
|
|
6
|
-
plot(...args: any[]): void;
|
|
7
|
-
}
|
|
8
|
-
export declare class HlineHelper {
|
|
9
|
-
private context;
|
|
10
|
-
constructor(context: any);
|
|
11
|
-
get style_dashed(): string;
|
|
12
|
-
get style_solid(): string;
|
|
13
|
-
get style_dotted(): string;
|
|
14
|
-
param(source: any, index?: number, name?: string): any;
|
|
15
|
-
any(price: any, title: any, color: any, linestyle: any, linewidth: any, editable: any, display: any): any;
|
|
16
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export declare class TechnicalAnalysis {
|
|
2
|
-
private context;
|
|
3
|
-
constructor(context: any);
|
|
4
|
-
get tr(): any;
|
|
5
|
-
param(source: any, index: any, name?: string): any;
|
|
6
|
-
ema(source: any, _period: any, _callId?: any): any;
|
|
7
|
-
sma(source: any, _period: any, _callId?: any): any;
|
|
8
|
-
vwma(source: any, _period: any, _callId?: any): any;
|
|
9
|
-
wma(source: any, _period: any, _callId?: any): any;
|
|
10
|
-
hma(source: any, _period: any, _callId?: any): any;
|
|
11
|
-
rma(source: any, _period: any, _callId?: any): any;
|
|
12
|
-
change(source: any, _length?: number, _callId?: any): any;
|
|
13
|
-
rsi(source: any, _period: any, _callId?: any): any;
|
|
14
|
-
atr(_period: any, _callId?: any): any;
|
|
15
|
-
mom(source: any, _length: any, _callId?: any): any;
|
|
16
|
-
roc(source: any, _length: any, _callId?: any): any;
|
|
17
|
-
dev(source: any, _length: any, _callId?: any): any;
|
|
18
|
-
variance(source: any, _length: any, _callId?: any): any;
|
|
19
|
-
highest(source: any, _length: any, _callId?: any): any;
|
|
20
|
-
lowest(source: any, _length: any, _callId?: any): any;
|
|
21
|
-
median(source: any, _length: any, _callId?: any): any;
|
|
22
|
-
stdev(source: any, _length: any, _bias?: boolean, _callId?: any): any;
|
|
23
|
-
linreg(source: any, _length: any, _offset: any, _callId?: any): any;
|
|
24
|
-
supertrend(_factor: any, _atrPeriod: any, _callId?: any): any[][];
|
|
25
|
-
crossover(source1: any, source2: any): boolean;
|
|
26
|
-
crossunder(source1: any, source2: any): boolean;
|
|
27
|
-
pivothigh(source: any, _leftbars: any, _rightbars: any): any;
|
|
28
|
-
pivotlow(source: any, _leftbars: any, _rightbars: any): any;
|
|
29
|
-
}
|
|
30
|
-
export default TechnicalAnalysis;
|