oakscriptjs 0.13.2 → 0.14.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/AGENTS.md +6 -1
- package/README.md +1 -1
- package/bin/oakscript.mjs +5 -0
- package/dist/cjs/check/checks.d.ts +78 -0
- package/dist/cjs/check/checks.d.ts.map +1 -0
- package/dist/cjs/check/checks.js +109 -0
- package/dist/cjs/check/checks.js.map +7 -0
- package/dist/cjs/check/format.d.ts +26 -0
- package/dist/cjs/check/format.d.ts.map +1 -0
- package/dist/cjs/check/format.js +106 -0
- package/dist/cjs/check/format.js.map +7 -0
- package/dist/cjs/check/harness.d.ts +94 -0
- package/dist/cjs/check/harness.d.ts.map +1 -0
- package/dist/cjs/check/harness.js +302 -0
- package/dist/cjs/check/harness.js.map +7 -0
- package/dist/cjs/check/index.d.ts +253 -0
- package/dist/cjs/check/index.d.ts.map +1 -0
- package/dist/cjs/check/index.js +466 -0
- package/dist/cjs/check/index.js.map +7 -0
- package/dist/cjs/check/node.d.ts +53 -0
- package/dist/cjs/check/node.d.ts.map +1 -0
- package/dist/cjs/check/node.js +318 -0
- package/dist/cjs/check/node.js.map +7 -0
- package/dist/cjs/check/spec.d.ts +44 -0
- package/dist/cjs/check/spec.d.ts.map +1 -0
- package/dist/cjs/check/spec.js +199 -0
- package/dist/cjs/check/spec.js.map +7 -0
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/runtime/series.d.ts +6 -0
- package/dist/cjs/runtime/series.d.ts.map +1 -1
- package/dist/cjs/runtime/series.js +15 -0
- package/dist/cjs/runtime/series.js.map +2 -2
- package/dist/cjs/script/constants.d.ts +200 -0
- package/dist/cjs/script/constants.d.ts.map +1 -0
- package/dist/cjs/script/constants.js +217 -0
- package/dist/cjs/script/constants.js.map +7 -0
- package/dist/cjs/script/drawing-args.d.ts +25 -0
- package/dist/cjs/script/drawing-args.d.ts.map +1 -0
- package/dist/cjs/script/drawing-args.js +203 -0
- package/dist/cjs/script/drawing-args.js.map +7 -0
- package/dist/cjs/script/globals.d.ts +127 -0
- package/dist/cjs/script/globals.d.ts.map +1 -0
- package/dist/cjs/script/globals.js +17 -0
- package/dist/cjs/script/globals.js.map +7 -0
- package/dist/cjs/script/index.d.ts +504 -166
- package/dist/cjs/script/index.d.ts.map +1 -1
- package/dist/cjs/script/index.js +236 -96
- package/dist/cjs/script/index.js.map +3 -3
- package/dist/esm/check/checks.d.ts +78 -0
- package/dist/esm/check/checks.d.ts.map +1 -0
- package/dist/esm/check/checks.js +95 -0
- package/dist/esm/check/checks.js.map +1 -0
- package/dist/esm/check/format.d.ts +26 -0
- package/dist/esm/check/format.d.ts.map +1 -0
- package/dist/esm/check/format.js +105 -0
- package/dist/esm/check/format.js.map +1 -0
- package/dist/esm/check/harness.d.ts +94 -0
- package/dist/esm/check/harness.d.ts.map +1 -0
- package/dist/esm/check/harness.js +317 -0
- package/dist/esm/check/harness.js.map +1 -0
- package/dist/esm/check/index.d.ts +253 -0
- package/dist/esm/check/index.d.ts.map +1 -0
- package/dist/esm/check/index.js +470 -0
- package/dist/esm/check/index.js.map +1 -0
- package/dist/esm/check/node.d.ts +53 -0
- package/dist/esm/check/node.d.ts.map +1 -0
- package/dist/esm/check/node.js +347 -0
- package/dist/esm/check/node.js.map +1 -0
- package/dist/esm/check/spec.d.ts +44 -0
- package/dist/esm/check/spec.d.ts.map +1 -0
- package/dist/esm/check/spec.js +198 -0
- package/dist/esm/check/spec.js.map +1 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/runtime/series.d.ts +6 -0
- package/dist/esm/runtime/series.d.ts.map +1 -1
- package/dist/esm/runtime/series.js +14 -0
- package/dist/esm/runtime/series.js.map +1 -1
- package/dist/esm/script/constants.d.ts +200 -0
- package/dist/esm/script/constants.d.ts.map +1 -0
- package/dist/esm/script/constants.js +151 -0
- package/dist/esm/script/constants.js.map +1 -0
- package/dist/esm/script/drawing-args.d.ts +25 -0
- package/dist/esm/script/drawing-args.d.ts.map +1 -0
- package/dist/esm/script/drawing-args.js +171 -0
- package/dist/esm/script/drawing-args.js.map +1 -0
- package/dist/esm/script/globals.d.ts +127 -0
- package/dist/esm/script/globals.d.ts.map +1 -0
- package/dist/esm/script/globals.js +28 -0
- package/dist/esm/script/globals.js.map +1 -0
- package/dist/esm/script/index.d.ts +504 -166
- package/dist/esm/script/index.d.ts.map +1 -1
- package/dist/esm/script/index.js +256 -83
- package/dist/esm/script/index.js.map +1 -1
- package/package.json +31 -1
- package/skills/oakscript/SKILL.md +62 -26
- package/skills/oakscript/examples/ma-cross.js +2 -2
- package/skills/oakscript/examples/mtf-trend-filter.js +3 -3
- package/skills/oakscript/reference/check.md +150 -0
- package/skills/oakscript/reference/errors.md +31 -7
- package/skills/oakscript/reference/pine-differences.md +17 -16
- package/skills/oakscript/reference/plotting.md +25 -19
- package/skills/oakscript/reference/script-structure.md +34 -17
- package/skills/oakscript/reference/timeframes-symbols.md +5 -1
- package/skills/oakscript/spec.schema.json +199 -0
- package/src/check/checks.ts +175 -0
- package/src/check/format.ts +117 -0
- package/src/check/harness.ts +372 -0
- package/src/check/index.ts +708 -0
- package/src/check/node.ts +368 -0
- package/src/check/spec.ts +200 -0
- package/src/index.ts +1 -1
- package/src/runtime/series.ts +19 -0
- package/src/script/constants.ts +169 -0
- package/src/script/drawing-args.ts +179 -0
- package/src/script/globals.ts +129 -0
- package/src/script/index.ts +462 -81
|
@@ -53,7 +53,7 @@ import * as timeframeCore from '../timeframe/index.js';
|
|
|
53
53
|
import * as strCore from '../str/index.js';
|
|
54
54
|
import { type SessionSpec } from '../session/calendar.js';
|
|
55
55
|
import { position } from '../types/index.js';
|
|
56
|
-
import type { ChartPoint } from '../types/index.js';
|
|
56
|
+
import type { Box, ChartPoint, Label, Line, Linefill, Polyline, Table } from '../types/index.js';
|
|
57
57
|
import { STRATEGY_CONSTANTS, type StrategyCloseAllOptions, type StrategyCloseOptions, type StrategyDirection, type StrategyEngine, type StrategyEntryOptions, type StrategyExitOptions, type StrategyNumberVariable, type StrategyOptions, type StrategyProperties, type StrategyRiskDirection, type StrategyRiskValueType, type StrategyTextVariable, type StrategyTrade } from '../strategy/index.js';
|
|
58
58
|
/** Everything one run of a script produced. */
|
|
59
59
|
export interface ScriptRunResult {
|
|
@@ -63,6 +63,7 @@ export interface ScriptRunResult {
|
|
|
63
63
|
overlay: boolean;
|
|
64
64
|
precision?: number;
|
|
65
65
|
format?: string;
|
|
66
|
+
scale?: 'right' | 'left' | 'none';
|
|
66
67
|
};
|
|
67
68
|
inputConfig: InputConfig[];
|
|
68
69
|
plotConfig: PlotConfig[];
|
|
@@ -208,9 +209,12 @@ export interface VaripVariable<T> {
|
|
|
208
209
|
export declare function varip<T>(initial: T): VaripVariable<T>;
|
|
209
210
|
export interface IndicatorOptions {
|
|
210
211
|
shorttitle?: string;
|
|
212
|
+
/** true: drawn on the price pane; false (default, as PineScript): in its own pane. */
|
|
211
213
|
overlay?: boolean;
|
|
212
214
|
precision?: number;
|
|
213
215
|
format?: string;
|
|
216
|
+
/** The price scale: `scale.right`, `scale.left` or `scale.none` (recorded in `metadata.scale` for the host). */
|
|
217
|
+
scale?: 'right' | 'left' | 'none';
|
|
214
218
|
/** Lines kept before the oldest are deleted (default 50; PineScript keeps up to 5 more). */
|
|
215
219
|
max_lines_count?: number;
|
|
216
220
|
/** Labels kept before the oldest are deleted (default 50). */
|
|
@@ -224,10 +228,15 @@ export interface IndicatorOptions {
|
|
|
224
228
|
export declare function indicator(title: string, options?: IndicatorOptions): void;
|
|
225
229
|
/** Options of every `input.*` kind (PineScript `group`, `inline`, `tooltip`, `confirm`, `display`, `active`). */
|
|
226
230
|
export interface InputOptions {
|
|
231
|
+
/** Group title: every input with the same `group` is listed under it, at the place of the group's first input. */
|
|
227
232
|
group?: string;
|
|
233
|
+
/** Inputs with the same `inline` id share one row of their group (ungrouped inputs share rows among themselves). */
|
|
228
234
|
inline?: string;
|
|
235
|
+
/** Help text shown next to the input. */
|
|
229
236
|
tooltip?: string;
|
|
237
|
+
/** The host asks for the value when the script is added. */
|
|
230
238
|
confirm?: boolean;
|
|
239
|
+
/** Where the value is shown besides the settings: 'all', 'none', 'status_line', 'data_window'. */
|
|
231
240
|
display?: InputConfig['display'];
|
|
232
241
|
/**
|
|
233
242
|
* PineScript `active`: false greys the input out in the settings (it keeps its value). A boolean as in
|
|
@@ -244,30 +253,38 @@ export interface NumericInputOptions extends InputOptions {
|
|
|
244
253
|
export interface StringInputOptions extends InputOptions {
|
|
245
254
|
options?: string[];
|
|
246
255
|
}
|
|
247
|
-
/**
|
|
256
|
+
/** Named arguments of an input: its options, with `title` (and `defval` when every argument is named). */
|
|
257
|
+
type InputArgs<O, D> = O & {
|
|
258
|
+
title?: string;
|
|
259
|
+
defval?: D;
|
|
260
|
+
};
|
|
261
|
+
/** PineScript `input.*` — declares an input AND returns its current value. The arguments after the default can be
|
|
262
|
+
* named, as in PineScript: `input.int(14, "Length", { minval: 1 })`, `input.int(14, { title: "Length", minval: 1 })`,
|
|
263
|
+
* `input.int({ defval: 14, title: "Length" })`. */
|
|
248
264
|
export declare const input: {
|
|
249
|
-
int(defval: number, title?: string, opts?: NumericInputOptions): number;
|
|
250
|
-
float(defval: number, title?: string, opts?: NumericInputOptions): number;
|
|
251
|
-
bool(defval: boolean, title?: string, opts?: InputOptions): boolean;
|
|
252
|
-
string(defval: string, title?: string, opts?: StringInputOptions): string;
|
|
253
|
-
/** Multi-line text (
|
|
254
|
-
|
|
255
|
-
text_area(defval: string, title?: string, opts?: InputOptions): string;
|
|
265
|
+
int(defval: number | InputArgs<NumericInputOptions, number>, title?: string | InputArgs<NumericInputOptions, number>, opts?: NumericInputOptions): number;
|
|
266
|
+
float(defval: number | InputArgs<NumericInputOptions, number>, title?: string | InputArgs<NumericInputOptions, number>, opts?: NumericInputOptions): number;
|
|
267
|
+
bool(defval: boolean | InputArgs<InputOptions, boolean>, title?: string | InputArgs<InputOptions, boolean>, opts?: InputOptions): boolean;
|
|
268
|
+
string(defval: string | InputArgs<StringInputOptions, string>, title?: string | InputArgs<StringInputOptions, string>, opts?: StringInputOptions): string;
|
|
269
|
+
/** Multi-line text (lines separated by a newline), e.g. a list a script parses (#184). */
|
|
270
|
+
text_area(defval: string | InputArgs<InputOptions, string>, title?: string | InputArgs<InputOptions, string>, opts?: InputOptions): string;
|
|
256
271
|
/**
|
|
257
272
|
* Declares a colour input. As in PineScript, the default keeps an alpha of 2 decimals: an input default
|
|
258
273
|
* `color.new(c, 90)` has the alpha byte 26 (25 in the script). A value given by the host is not changed.
|
|
259
274
|
*/
|
|
260
|
-
color(defval: string, title?: string, opts?: InputOptions): string;
|
|
275
|
+
color(defval: string | InputArgs<InputOptions, string>, title?: string | InputArgs<InputOptions, string>, opts?: InputOptions): string;
|
|
261
276
|
/** Declares a source input and returns it as a Series. */
|
|
262
|
-
source(defval?: string, title?: string, opts?: InputOptions): Series;
|
|
277
|
+
source(defval?: string | Series, title?: string | InputArgs<InputOptions, string | Series>, opts?: InputOptions): Series;
|
|
263
278
|
/** Timeframe string ("60", "1D", "W"). As in PineScript, "" means the chart timeframe. */
|
|
264
|
-
timeframe(defval: string, title?: string, opts?: StringInputOptions): string;
|
|
279
|
+
timeframe(defval: string | InputArgs<StringInputOptions, string>, title?: string | InputArgs<StringInputOptions, string>, opts?: StringInputOptions): string;
|
|
265
280
|
/** Session string ("0930-1600", "0930-1600:23456"). */
|
|
266
|
-
session(defval: string, title?: string, opts?: StringInputOptions): string;
|
|
281
|
+
session(defval: string | InputArgs<StringInputOptions, string>, title?: string | InputArgs<StringInputOptions, string>, opts?: StringInputOptions): string;
|
|
267
282
|
/** Ticker id ("NASDAQ:MSFT"), for `request.security` of another symbol (#180). */
|
|
268
|
-
symbol(defval: string, title?: string, opts?: StringInputOptions): string;
|
|
283
|
+
symbol(defval: string | InputArgs<StringInputOptions, string>, title?: string | InputArgs<StringInputOptions, string>, opts?: StringInputOptions): string;
|
|
284
|
+
/** PineScript `input.price`: a price level, a float input (the host shows it as a number). */
|
|
285
|
+
price(defval: number | InputArgs<InputOptions, number>, title?: string | InputArgs<InputOptions, number>, opts?: InputOptions): number;
|
|
269
286
|
/** Date and time as a UNIX time in milliseconds, e.g. `input.time(timestamp('2024-01-01'), 'Start')`. */
|
|
270
|
-
time(defval: number, title?: string, opts?: InputOptions): number;
|
|
287
|
+
time(defval: number | InputArgs<InputOptions, number>, title?: string | InputArgs<InputOptions, number>, opts?: InputOptions): number;
|
|
271
288
|
};
|
|
272
289
|
export declare const open: Series;
|
|
273
290
|
export declare const high: Series;
|
|
@@ -278,6 +295,10 @@ export declare const hl2: Series;
|
|
|
278
295
|
export declare const hlc3: Series;
|
|
279
296
|
export declare const ohlc4: Series;
|
|
280
297
|
export declare const hlcc4: Series;
|
|
298
|
+
/** PineScript `bar_index`: the index of each bar (0 on the first). In a bar loop, `c.i` is the same number. */
|
|
299
|
+
export declare const bar_index: Series;
|
|
300
|
+
/** PineScript `last_bar_index`: the index of the last bar, on every bar. In a bar loop, `c.n - 1`. */
|
|
301
|
+
export declare const last_bar_index: Series;
|
|
281
302
|
/** ta.* with the chart-implicit (bars-first) functions bound to the context,
|
|
282
303
|
* so scripts call them like PineScript: `ta.tr(true)`, `ta.atr(14)`. */
|
|
283
304
|
export declare const ta: {
|
|
@@ -306,6 +327,8 @@ export declare const ta: {
|
|
|
306
327
|
(source: Series, anchor?: Series): Series;
|
|
307
328
|
(source: Series, anchor: Series | undefined, stdev_mult: number): [Series, Series, Series];
|
|
308
329
|
};
|
|
330
|
+
/** `ta.vwma(source, length)` with the chart volume, as PineScript; a third argument gives another volume. */
|
|
331
|
+
vwma: (source: Series, length: number, vol?: Series) => Series;
|
|
309
332
|
/** `ta.mfi(source, length)` with the chart volume (PineScript takes 2 arguments). */
|
|
310
333
|
mfi: (source: Series, length: number) => Series;
|
|
311
334
|
/** `ta.pivothigh(source, leftbars, rightbars)` or `ta.pivothigh(leftbars, rightbars)` (source = high).
|
|
@@ -340,7 +363,6 @@ export declare const ta: {
|
|
|
340
363
|
falling(source: Series, length: number): Series;
|
|
341
364
|
cum(source: Series): Series;
|
|
342
365
|
vwapBands(source: Series, volume: Series, anchor: Series | undefined, stdev_mult: number): [Series, Series, Series];
|
|
343
|
-
vwma(source: Series, length: number, volume: Series): Series;
|
|
344
366
|
linreg(source: Series, length: number, offset?: number): Series;
|
|
345
367
|
alma(source: Series, length?: number, offset?: number, sigma?: number, floor?: boolean): Series;
|
|
346
368
|
zigzag(bars: Bar[], deviation?: number, depth?: number, backstep?: number): [Series, Series, Series];
|
|
@@ -477,6 +499,8 @@ export declare const color: {
|
|
|
477
499
|
yellow: "#FDD835";
|
|
478
500
|
};
|
|
479
501
|
export interface ScriptPlotOptions {
|
|
502
|
+
/** Shift in bars (PineScript `offset`): the value of bar i is drawn on bar i + offset (negative: to the left). */
|
|
503
|
+
offset?: number;
|
|
480
504
|
/** Static color, or a per-bar color array from color.when(). */
|
|
481
505
|
color?: string | string[];
|
|
482
506
|
linewidth?: number;
|
|
@@ -902,7 +926,16 @@ export declare const weekofyear: CalendarFunction;
|
|
|
902
926
|
/** PineScript `dayofmonth(time, timezone?)`; the default time zone is the exchange time zone. */
|
|
903
927
|
export declare const dayofmonth: CalendarFunction;
|
|
904
928
|
/** PineScript `dayofweek(time, timezone?)`; the default time zone is the exchange time zone. */
|
|
905
|
-
|
|
929
|
+
/** `dayofweek(time, timezone?)`, with the PineScript constants `dayofweek.sunday` (1) ... `dayofweek.saturday` (7). */
|
|
930
|
+
export declare const dayofweek: CalendarFunction & {
|
|
931
|
+
readonly sunday: 1;
|
|
932
|
+
readonly monday: 2;
|
|
933
|
+
readonly tuesday: 3;
|
|
934
|
+
readonly wednesday: 4;
|
|
935
|
+
readonly thursday: 5;
|
|
936
|
+
readonly friday: 6;
|
|
937
|
+
readonly saturday: 7;
|
|
938
|
+
};
|
|
906
939
|
/** PineScript `hour(time, timezone?)`; the default time zone is the exchange time zone. */
|
|
907
940
|
export declare const hour: CalendarFunction;
|
|
908
941
|
/** PineScript `minute(time, timezone?)`; the default time zone is the exchange time zone. */
|
|
@@ -1000,178 +1033,358 @@ export declare const ticker: {
|
|
|
1000
1033
|
};
|
|
1001
1034
|
/** What an expression of `request.security` may return. */
|
|
1002
1035
|
export type SecurityValue = Series | number | boolean | Array<Series | number | boolean>;
|
|
1003
|
-
/**
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1036
|
+
/** Named arguments of `request.security` (PineScript names). */
|
|
1037
|
+
export interface SecurityArgs<T extends SecurityValue = SecurityValue> {
|
|
1038
|
+
symbol?: string;
|
|
1039
|
+
timeframe?: string;
|
|
1040
|
+
expression?: () => T;
|
|
1041
|
+
gaps?: string;
|
|
1042
|
+
lookahead?: string;
|
|
1043
|
+
ignore_invalid_symbol?: boolean;
|
|
1044
|
+
currency?: string;
|
|
1045
|
+
calc_bars_count?: number;
|
|
1046
|
+
}
|
|
1047
|
+
/** Named arguments of `request.security_lower_tf` (PineScript names). */
|
|
1048
|
+
export interface SecurityLowerTfArgs<T extends SecurityValue = SecurityValue> {
|
|
1049
|
+
symbol?: string;
|
|
1050
|
+
timeframe?: string;
|
|
1051
|
+
expression?: () => T;
|
|
1052
|
+
ignore_invalid_symbol?: boolean;
|
|
1053
|
+
currency?: string;
|
|
1054
|
+
ignore_invalid_timeframe?: boolean;
|
|
1055
|
+
calc_bars_count?: number;
|
|
1056
|
+
}
|
|
1057
|
+
/** `request.security` with PineScript's named arguments: `request.security(sym, "D", () => close, { lookahead: barmerge.lookahead_on })`. */
|
|
1058
|
+
declare function securityCall<T extends SecurityValue>(...args: [symbol: string, timeframe: string, expression: () => T, gaps?: string, lookahead?: string, ignore_invalid_symbol?: boolean] | [symbol: string, timeframe: string, expression: () => T, args: SecurityArgs<T>] | [args: SecurityArgs<T> & {
|
|
1059
|
+
symbol: string;
|
|
1060
|
+
timeframe: string;
|
|
1061
|
+
expression: () => T;
|
|
1062
|
+
}]): T extends unknown[] ? Series[] : Series;
|
|
1063
|
+
/** `request.security_lower_tf` with PineScript's named arguments. */
|
|
1064
|
+
declare function securityLowerTfCall<T extends SecurityValue>(...args: [symbol: string, timeframe: string, expression: () => T, ignore_invalid_symbol?: boolean] | [symbol: string, timeframe: string, expression: () => T, args: SecurityLowerTfArgs<T>] | [args: SecurityLowerTfArgs<T> & {
|
|
1065
|
+
symbol: string;
|
|
1066
|
+
timeframe: string;
|
|
1067
|
+
expression: () => T;
|
|
1068
|
+
}]): T extends unknown[] ? number[][][] : number[][];
|
|
1028
1069
|
export declare const request: {
|
|
1029
|
-
security: typeof
|
|
1030
|
-
security_lower_tf: typeof
|
|
1070
|
+
security: typeof securityCall;
|
|
1071
|
+
security_lower_tf: typeof securityLowerTfCall;
|
|
1031
1072
|
};
|
|
1032
1073
|
/** PineScript `line.*`; `line.all` lists the live lines in creation order. */
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1074
|
+
type Numeric = number | Series;
|
|
1075
|
+
/** A function whose number parameters also take a Series (read on the current bar inside a bar loop). */
|
|
1076
|
+
type WithSeries<F> = F extends (...args: infer A) => infer R ? (...args: {
|
|
1077
|
+
[K in keyof A]: number extends A[K] ? A[K] | Series : A[K];
|
|
1078
|
+
}) => R : never;
|
|
1079
|
+
type ScriptDrawing<T> = {
|
|
1080
|
+
[K in keyof T]: T[K] extends (...args: never[]) => unknown ? T[K] & WithSeries<T[K]> : T[K];
|
|
1081
|
+
};
|
|
1082
|
+
type Colour = string | undefined;
|
|
1083
|
+
/** Named arguments of `label.new` (PineScript parameter names). */
|
|
1084
|
+
export interface LabelNewArgs {
|
|
1085
|
+
x?: Numeric;
|
|
1086
|
+
y?: Numeric;
|
|
1087
|
+
point?: ChartPoint;
|
|
1088
|
+
text?: string;
|
|
1089
|
+
xloc?: 'bar_index' | 'bar_time';
|
|
1090
|
+
yloc?: 'price' | 'abovebar' | 'belowbar';
|
|
1091
|
+
color?: Colour;
|
|
1092
|
+
style?: NonNullable<Label['style']>;
|
|
1093
|
+
textcolor?: Colour;
|
|
1094
|
+
size?: string | number;
|
|
1095
|
+
textalign?: 'left' | 'center' | 'right';
|
|
1096
|
+
tooltip?: string;
|
|
1097
|
+
text_font_family?: 'default' | 'monospace';
|
|
1098
|
+
force_overlay?: boolean;
|
|
1099
|
+
text_formatting?: number;
|
|
1100
|
+
}
|
|
1101
|
+
/** Named arguments of `line.new`. */
|
|
1102
|
+
export interface LineNewArgs {
|
|
1103
|
+
x1?: Numeric;
|
|
1104
|
+
y1?: Numeric;
|
|
1105
|
+
x2?: Numeric;
|
|
1106
|
+
y2?: Numeric;
|
|
1107
|
+
first_point?: ChartPoint;
|
|
1108
|
+
second_point?: ChartPoint;
|
|
1109
|
+
xloc?: 'bar_index' | 'bar_time';
|
|
1110
|
+
extend?: 'none' | 'left' | 'right' | 'both';
|
|
1111
|
+
color?: Colour;
|
|
1112
|
+
style?: 'solid' | 'dotted' | 'dashed' | 'arrow_left' | 'arrow_right' | 'arrow_both';
|
|
1113
|
+
width?: Numeric;
|
|
1114
|
+
force_overlay?: boolean;
|
|
1115
|
+
}
|
|
1116
|
+
/** Named arguments of `box.new`. */
|
|
1117
|
+
export interface BoxNewArgs {
|
|
1118
|
+
left?: Numeric;
|
|
1119
|
+
top?: Numeric;
|
|
1120
|
+
right?: Numeric;
|
|
1121
|
+
bottom?: Numeric;
|
|
1122
|
+
top_left?: ChartPoint;
|
|
1123
|
+
bottom_right?: ChartPoint;
|
|
1124
|
+
border_color?: Colour;
|
|
1125
|
+
border_width?: Numeric;
|
|
1126
|
+
border_style?: 'solid' | 'dotted' | 'dashed';
|
|
1127
|
+
extend?: 'none' | 'left' | 'right' | 'both';
|
|
1128
|
+
xloc?: 'bar_index' | 'bar_time';
|
|
1129
|
+
bgcolor?: Colour;
|
|
1130
|
+
text?: string;
|
|
1131
|
+
text_size?: string | number;
|
|
1132
|
+
text_color?: Colour;
|
|
1133
|
+
text_halign?: 'left' | 'center' | 'right';
|
|
1134
|
+
text_valign?: 'top' | 'center' | 'bottom';
|
|
1135
|
+
text_wrap?: 'none' | 'auto';
|
|
1136
|
+
text_font_family?: 'default' | 'monospace';
|
|
1137
|
+
force_overlay?: boolean;
|
|
1138
|
+
text_formatting?: number;
|
|
1139
|
+
}
|
|
1140
|
+
/** Named arguments of `table.new`. */
|
|
1141
|
+
export interface TableNewArgs {
|
|
1142
|
+
position?: string;
|
|
1143
|
+
columns?: number;
|
|
1144
|
+
rows?: number;
|
|
1145
|
+
bgcolor?: Colour;
|
|
1146
|
+
frame_color?: Colour;
|
|
1147
|
+
frame_width?: number;
|
|
1148
|
+
border_color?: Colour;
|
|
1149
|
+
border_width?: number;
|
|
1150
|
+
force_overlay?: boolean;
|
|
1151
|
+
}
|
|
1152
|
+
/** Named arguments of `table.cell`. */
|
|
1153
|
+
export interface TableCellArgs {
|
|
1154
|
+
table_id?: Table;
|
|
1155
|
+
column?: number;
|
|
1156
|
+
row?: number;
|
|
1157
|
+
text?: string;
|
|
1158
|
+
width?: number;
|
|
1159
|
+
height?: number;
|
|
1160
|
+
text_color?: Colour;
|
|
1161
|
+
text_halign?: 'left' | 'center' | 'right';
|
|
1162
|
+
text_valign?: 'top' | 'center' | 'bottom';
|
|
1163
|
+
text_size?: string | number;
|
|
1164
|
+
bgcolor?: Colour;
|
|
1165
|
+
tooltip?: string;
|
|
1166
|
+
text_font_family?: 'default' | 'monospace';
|
|
1167
|
+
text_formatting?: number;
|
|
1168
|
+
}
|
|
1169
|
+
/** Named arguments of `polyline.new`. */
|
|
1170
|
+
export interface PolylineNewArgs {
|
|
1171
|
+
points?: ChartPoint[];
|
|
1172
|
+
curved?: boolean;
|
|
1173
|
+
closed?: boolean;
|
|
1174
|
+
xloc?: 'bar_index' | 'bar_time';
|
|
1175
|
+
line_color?: Colour;
|
|
1176
|
+
fill_color?: Colour | null;
|
|
1177
|
+
line_style?: 'solid' | 'dotted' | 'dashed';
|
|
1178
|
+
line_width?: number;
|
|
1179
|
+
force_overlay?: boolean;
|
|
1180
|
+
}
|
|
1181
|
+
/** Named arguments of `linefill.new`. */
|
|
1182
|
+
export interface LinefillNewArgs {
|
|
1183
|
+
line1?: Line;
|
|
1184
|
+
line2?: Line;
|
|
1185
|
+
color?: Colour;
|
|
1186
|
+
}
|
|
1187
|
+
declare const lineNs: Omit<ScriptDrawing<{
|
|
1188
|
+
style_solid: "solid";
|
|
1189
|
+
style_dotted: "dotted";
|
|
1190
|
+
style_dashed: "dashed";
|
|
1191
|
+
style_arrow_left: "arrow_left";
|
|
1192
|
+
style_arrow_right: "arrow_right";
|
|
1193
|
+
style_arrow_both: "arrow_both";
|
|
1194
|
+
new_line(first_point: ChartPoint, second_point: ChartPoint, xloc?: "bar_index" | "bar_time", extend?: "none" | "left" | "right" | "both", lineColor?: import("../types/index.js").color, style?: "solid" | "dotted" | "dashed" | "arrow_left" | "arrow_right" | "arrow_both", width?: number, force_overlay?: boolean): Line;
|
|
1195
|
+
new_line(x1: number, y1: number, x2: number, y2: number, xloc?: "bar_index" | "bar_time", extend?: "none" | "left" | "right" | "both", lineColor?: import("../types/index.js").color, style?: "solid" | "dotted" | "dashed" | "arrow_left" | "arrow_right" | "arrow_both", width?: number, force_overlay?: boolean): Line;
|
|
1196
|
+
get_price(id: Line, x: number): number;
|
|
1197
|
+
get_x1(id: Line): number;
|
|
1198
|
+
get_x2(id: Line): number;
|
|
1199
|
+
get_y1(id: Line): number;
|
|
1200
|
+
get_y2(id: Line): number;
|
|
1201
|
+
copy(id: Line): Line;
|
|
1202
|
+
set_x1(id: Line, x: number): Line;
|
|
1203
|
+
set_x2(id: Line, x: number): Line;
|
|
1204
|
+
set_y1(id: Line, y: number): Line;
|
|
1205
|
+
set_y2(id: Line, y: number): Line;
|
|
1206
|
+
set_xy1(id: Line, x: number, y: number): Line;
|
|
1207
|
+
set_xy2(id: Line, x: number, y: number): Line;
|
|
1208
|
+
set_xloc(id: Line, x1: number, x2: number, xloc: "bar_index" | "bar_time"): Line;
|
|
1209
|
+
set_extend(id: Line, extend: "none" | "left" | "right" | "both"): Line;
|
|
1210
|
+
set_color(id: Line, lineColor: import("../types/index.js").color): Line;
|
|
1211
|
+
set_style(id: Line, style: "solid" | "dotted" | "dashed" | "arrow_left" | "arrow_right" | "arrow_both"): Line;
|
|
1212
|
+
set_width(id: Line, width: number): Line;
|
|
1213
|
+
delete_line(id: Line): void;
|
|
1214
|
+
all(): Line[];
|
|
1215
|
+
set_first_point(id: Line, point: ChartPoint): Line;
|
|
1216
|
+
set_second_point(id: Line, point: ChartPoint): Line;
|
|
1057
1217
|
new: typeof lineCore.new_line;
|
|
1058
1218
|
delete: typeof lineCore.delete_line;
|
|
1219
|
+
}>, "all"> & {
|
|
1220
|
+
readonly all: Line[];
|
|
1221
|
+
};
|
|
1222
|
+
/** PineScript `line.*` (with `line.style_*`); `line.all` lists the live lines in creation order. */
|
|
1223
|
+
export declare const line: typeof lineNs & {
|
|
1224
|
+
new: ((args: LineNewArgs) => Line) & ((x1: Numeric, y1: Numeric, x2: Numeric, y2: Numeric, args: LineNewArgs) => Line) & ((first_point: ChartPoint, second_point: ChartPoint, args: LineNewArgs) => Line);
|
|
1059
1225
|
};
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1226
|
+
declare const labelNs: Omit<ScriptDrawing<{
|
|
1227
|
+
style_none: "none";
|
|
1228
|
+
style_xcross: "xcross";
|
|
1229
|
+
style_cross: "cross";
|
|
1230
|
+
style_triangleup: "triangleup";
|
|
1231
|
+
style_triangledown: "triangledown";
|
|
1232
|
+
style_flag: "flag";
|
|
1233
|
+
style_circle: "circle";
|
|
1234
|
+
style_arrowup: "arrowup";
|
|
1235
|
+
style_arrowdown: "arrowdown";
|
|
1236
|
+
style_label_up: "label_up";
|
|
1237
|
+
style_label_down: "label_down";
|
|
1238
|
+
style_label_left: "label_left";
|
|
1239
|
+
style_label_right: "label_right";
|
|
1240
|
+
style_label_lower_left: "label_lower_left";
|
|
1241
|
+
style_label_lower_right: "label_lower_right";
|
|
1242
|
+
style_label_upper_left: "label_upper_left";
|
|
1243
|
+
style_label_upper_right: "label_upper_right";
|
|
1244
|
+
style_label_center: "label_center";
|
|
1245
|
+
style_square: "square";
|
|
1246
|
+
style_diamond: "diamond";
|
|
1247
|
+
style_text_outline: "text_outline";
|
|
1248
|
+
new_label(point: ChartPoint, text?: string, xloc?: "bar_index" | "bar_time", yloc?: "price" | "abovebar" | "belowbar", labelColor?: import("../types/index.js").color, style?: "none" | "xcross" | "cross" | "triangleup" | "triangledown" | "flag" | "circle" | "arrowup" | "arrowdown" | "label_up" | "label_down" | "label_left" | "label_right" | "label_lower_left" | "label_lower_right" | "label_upper_left" | "label_upper_right" | "label_center" | "square" | "diamond" | "text_outline", textcolor?: import("../types/index.js").color, size?: string | number, textalign?: "left" | "center" | "right", tooltip?: string, text_font_family?: "default" | "monospace", force_overlay?: boolean, text_formatting?: number): Label;
|
|
1249
|
+
new_label(x: number, y: number, text?: string, xloc?: "bar_index" | "bar_time", yloc?: "price" | "abovebar" | "belowbar", labelColor?: import("../types/index.js").color, style?: "none" | "xcross" | "cross" | "triangleup" | "triangledown" | "flag" | "circle" | "arrowup" | "arrowdown" | "label_up" | "label_down" | "label_left" | "label_right" | "label_lower_left" | "label_lower_right" | "label_upper_left" | "label_upper_right" | "label_center" | "square" | "diamond" | "text_outline", textcolor?: import("../types/index.js").color, size?: string | number, textalign?: "left" | "center" | "right", tooltip?: string, text_font_family?: "default" | "monospace", force_overlay?: boolean, text_formatting?: number): Label;
|
|
1250
|
+
get_x(id: Label): number;
|
|
1251
|
+
get_y(id: Label): number;
|
|
1252
|
+
get_text(id: Label): string | undefined;
|
|
1253
|
+
copy(id: Label): Label;
|
|
1254
|
+
set_x(id: Label, x: number): Label;
|
|
1255
|
+
set_y(id: Label, y: number): Label;
|
|
1256
|
+
set_xy(id: Label, x: number, y: number): Label;
|
|
1257
|
+
set_xloc(id: Label, x: number, xloc: "bar_index" | "bar_time"): Label;
|
|
1258
|
+
set_yloc(id: Label, yloc: "price" | "abovebar" | "belowbar"): Label;
|
|
1259
|
+
set_text(id: Label, text: string): Label;
|
|
1260
|
+
set_tooltip(id: Label, tooltip: string): Label;
|
|
1261
|
+
set_color(id: Label, labelColor: import("../types/index.js").color): Label;
|
|
1262
|
+
set_textcolor(id: Label, textColor: import("../types/index.js").color): Label;
|
|
1263
|
+
set_style(id: Label, style: "none" | "xcross" | "cross" | "triangleup" | "triangledown" | "flag" | "circle" | "arrowup" | "arrowdown" | "label_up" | "label_down" | "label_left" | "label_right" | "label_lower_left" | "label_lower_right" | "label_upper_left" | "label_upper_right" | "label_center" | "square" | "diamond" | "text_outline"): Label;
|
|
1264
|
+
set_size(id: Label, size: string | number): Label;
|
|
1265
|
+
set_textalign(id: Label, align: "left" | "center" | "right"): Label;
|
|
1266
|
+
set_text_font_family(id: Label, font: "default" | "monospace"): Label;
|
|
1267
|
+
delete_label(id: Label): void;
|
|
1268
|
+
all(): Label[];
|
|
1269
|
+
set_point(id: Label, point: ChartPoint): Label;
|
|
1270
|
+
set_text_formatting(id: Label, formatting: number): Label;
|
|
1085
1271
|
new: typeof labelCore.new_label;
|
|
1086
1272
|
delete: typeof labelCore.delete_label;
|
|
1273
|
+
}>, "all"> & {
|
|
1274
|
+
readonly all: Label[];
|
|
1087
1275
|
};
|
|
1088
|
-
/** PineScript `
|
|
1089
|
-
export declare const
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1276
|
+
/** PineScript `label.*` (with `label.style_*`); `label.all` lists the live labels in creation order. */
|
|
1277
|
+
export declare const label: typeof labelNs & {
|
|
1278
|
+
new: ((args: LabelNewArgs) => Label) & ((x: Numeric, y: Numeric, args: LabelNewArgs) => Label) & ((x: Numeric, y: Numeric, text: string, args: LabelNewArgs) => Label) & ((point: ChartPoint, args: LabelNewArgs) => Label) & ((point: ChartPoint, text: string, args: LabelNewArgs) => Label);
|
|
1279
|
+
};
|
|
1280
|
+
declare const boxNs: Omit<ScriptDrawing<{
|
|
1281
|
+
new_box(top_left: ChartPoint, bottom_right: ChartPoint, border_color?: import("../types/index.js").color, border_width?: number, border_style?: "solid" | "dotted" | "dashed", extend?: "none" | "left" | "right" | "both", xloc?: "bar_index" | "bar_time", bgcolor?: import("../types/index.js").color, text?: string, text_size?: string | number, text_color?: import("../types/index.js").color, text_halign?: "left" | "center" | "right", text_valign?: "top" | "center" | "bottom", text_wrap?: "none" | "auto", text_font_family?: "default" | "monospace", force_overlay?: boolean, text_formatting?: number): Box;
|
|
1282
|
+
new_box(left: number, top: number, right: number, bottom: number, border_color?: import("../types/index.js").color, border_width?: number, border_style?: "solid" | "dotted" | "dashed", extend?: "none" | "left" | "right" | "both", xloc?: "bar_index" | "bar_time", bgcolor?: import("../types/index.js").color, text?: string, text_size?: string | number, text_color?: import("../types/index.js").color, text_halign?: "left" | "center" | "right", text_valign?: "top" | "center" | "bottom", text_wrap?: "none" | "auto", text_font_family?: "default" | "monospace", force_overlay?: boolean, text_formatting?: number): Box;
|
|
1283
|
+
get_left(id: Box): number;
|
|
1284
|
+
get_right(id: Box): number;
|
|
1285
|
+
get_top(id: Box): number;
|
|
1286
|
+
get_bottom(id: Box): number;
|
|
1287
|
+
copy(id: Box): Box;
|
|
1288
|
+
set_left(id: Box, left: number): Box;
|
|
1289
|
+
set_right(id: Box, right: number): Box;
|
|
1290
|
+
set_top(id: Box, top: number): Box;
|
|
1291
|
+
set_bottom(id: Box, bottom: number): Box;
|
|
1292
|
+
set_lefttop(id: Box, left: number, top: number): Box;
|
|
1293
|
+
set_rightbottom(id: Box, right: number, bottom: number): Box;
|
|
1294
|
+
set_xloc(id: Box, left: number, right: number, xloc: "bar_index" | "bar_time"): Box;
|
|
1295
|
+
set_extend(id: Box, extend: "none" | "left" | "right" | "both"): Box;
|
|
1296
|
+
set_border_color(id: Box, borderColor: import("../types/index.js").color): Box;
|
|
1297
|
+
set_border_width(id: Box, width: number): Box;
|
|
1298
|
+
set_border_style(id: Box, style: "solid" | "dotted" | "dashed"): Box;
|
|
1299
|
+
set_bgcolor(id: Box, bgColor: import("../types/index.js").color): Box;
|
|
1300
|
+
set_text(id: Box, text: string): Box;
|
|
1301
|
+
set_text_color(id: Box, textColor: import("../types/index.js").color): Box;
|
|
1302
|
+
set_text_size(id: Box, size: string | number): Box;
|
|
1303
|
+
set_text_halign(id: Box, align: "left" | "center" | "right"): Box;
|
|
1304
|
+
set_text_valign(id: Box, align: "top" | "center" | "bottom"): Box;
|
|
1305
|
+
set_text_wrap(id: Box, wrap: "none" | "auto"): Box;
|
|
1306
|
+
set_text_font_family(id: Box, font: "default" | "monospace"): Box;
|
|
1307
|
+
delete_box(id: Box): void;
|
|
1308
|
+
all(): Box[];
|
|
1309
|
+
set_top_left_point(id: Box, point: ChartPoint): Box;
|
|
1310
|
+
set_bottom_right_point(id: Box, point: ChartPoint): Box;
|
|
1311
|
+
set_text_formatting(id: Box, formatting: number): Box;
|
|
1121
1312
|
new: typeof boxCore.new_box;
|
|
1122
1313
|
delete: typeof boxCore.delete_box;
|
|
1314
|
+
}>, "all"> & {
|
|
1315
|
+
readonly all: Box[];
|
|
1123
1316
|
};
|
|
1124
|
-
/** PineScript `
|
|
1125
|
-
export declare const
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1317
|
+
/** PineScript `box.*`; `box.all` lists the live boxes in creation order. */
|
|
1318
|
+
export declare const box: typeof boxNs & {
|
|
1319
|
+
new: ((args: BoxNewArgs) => Box) & ((left: Numeric, top: Numeric, right: Numeric, bottom: Numeric, args: BoxNewArgs) => Box) & ((top_left: ChartPoint, bottom_right: ChartPoint, args: BoxNewArgs) => Box);
|
|
1320
|
+
};
|
|
1321
|
+
declare const linefillNs: Omit<ScriptDrawing<{
|
|
1322
|
+
new_linefill(line1: Line, line2: Line, fillColor?: import("../types/index.js").color): Linefill;
|
|
1323
|
+
get_line1(id: Linefill): Line;
|
|
1324
|
+
get_line2(id: Linefill): Line;
|
|
1325
|
+
set_color(id: Linefill, fillColor: import("../types/index.js").color): Linefill;
|
|
1326
|
+
delete_linefill(id: Linefill): void;
|
|
1327
|
+
all(): Linefill[];
|
|
1132
1328
|
new: typeof linefillCore.new_linefill;
|
|
1133
1329
|
delete: typeof linefillCore.delete_linefill;
|
|
1330
|
+
}>, "all"> & {
|
|
1331
|
+
readonly all: Linefill[];
|
|
1134
1332
|
};
|
|
1135
|
-
/** PineScript `
|
|
1136
|
-
export declare const
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1333
|
+
/** PineScript `linefill.*`; `linefill.all` lists the live linefills in creation order. */
|
|
1334
|
+
export declare const linefill: typeof linefillNs & {
|
|
1335
|
+
new: ((args: LinefillNewArgs) => Linefill) & ((line1: Line, line2: Line, args: LinefillNewArgs) => Linefill);
|
|
1336
|
+
};
|
|
1337
|
+
declare const polylineNs: Omit<ScriptDrawing<{
|
|
1338
|
+
new_polyline(points: ChartPoint[], curved?: boolean, closed?: boolean, xloc?: "bar_index" | "bar_time", line_color?: import("../types/index.js").color, fill_color?: import("../types/index.js").color | null, line_style?: "solid" | "dotted" | "dashed", line_width?: number, force_overlay?: boolean): Polyline;
|
|
1339
|
+
delete_polyline(id: Polyline): void;
|
|
1340
|
+
get_all(): readonly Polyline[];
|
|
1341
|
+
all(): Polyline[];
|
|
1141
1342
|
clear_all(): void;
|
|
1142
1343
|
reset_id_counter(): void;
|
|
1143
1344
|
new: typeof polylineCore.new_polyline;
|
|
1144
1345
|
delete: typeof polylineCore.delete_polyline;
|
|
1346
|
+
}>, "all"> & {
|
|
1347
|
+
readonly all: polylineCore.Polyline[];
|
|
1348
|
+
};
|
|
1349
|
+
/** PineScript `polyline.*`; `polyline.all` lists the live polylines in creation order. */
|
|
1350
|
+
export declare const polyline: typeof polylineNs & {
|
|
1351
|
+
new: ((args: PolylineNewArgs) => Polyline) & ((points: ChartPoint[], args: PolylineNewArgs) => Polyline);
|
|
1352
|
+
};
|
|
1353
|
+
declare const tableNs: Omit<ScriptDrawing<{
|
|
1354
|
+
new_table(position: "top_left" | "top_center" | "top_right" | "middle_left" | "middle_center" | "middle_right" | "bottom_left" | "bottom_center" | "bottom_right", columns: number, rows: number, bgcolor?: import("../types/index.js").color, frame_color?: import("../types/index.js").color, frame_width?: number, border_color?: import("../types/index.js").color, border_width?: number, force_overlay?: boolean): Table;
|
|
1355
|
+
cell(table_id: Table, column: number, row: number, text?: string, width?: number, height?: number, text_color?: import("../types/index.js").color, text_halign?: "left" | "right" | "center", text_valign?: "center" | "top" | "bottom", text_size?: string | number, bgcolor?: import("../types/index.js").color, tooltip?: string, text_font_family?: "default" | "monospace", text_formatting?: number): void;
|
|
1356
|
+
merge_cells(table_id: Table, start_column: number, start_row: number, end_column: number, end_row: number): void;
|
|
1357
|
+
clear(table_id: Table, start_column: number, start_row: number, end_column?: number, end_row?: number): void;
|
|
1358
|
+
set_position(table_id: Table, position: "top_left" | "top_center" | "top_right" | "middle_left" | "middle_center" | "middle_right" | "bottom_left" | "bottom_center" | "bottom_right"): void;
|
|
1359
|
+
delete_table(table_id: Table): void;
|
|
1360
|
+
all(): Table[];
|
|
1361
|
+
cell_set_text: (table_id: Table, column: number, row: number, value: string | undefined) => void;
|
|
1362
|
+
cell_set_width: (table_id: Table, column: number, row: number, value: number | undefined) => void;
|
|
1363
|
+
cell_set_height: (table_id: Table, column: number, row: number, value: number | undefined) => void;
|
|
1364
|
+
cell_set_text_color: (table_id: Table, column: number, row: number, value: import("../types/index.js").color | undefined) => void;
|
|
1365
|
+
cell_set_text_halign: (table_id: Table, column: number, row: number, value: "left" | "right" | "center" | undefined) => void;
|
|
1366
|
+
cell_set_text_valign: (table_id: Table, column: number, row: number, value: "center" | "top" | "bottom" | undefined) => void;
|
|
1367
|
+
cell_set_text_size: (table_id: Table, column: number, row: number, value: string | number | undefined) => void;
|
|
1368
|
+
cell_set_bgcolor: (table_id: Table, column: number, row: number, value: import("../types/index.js").color | undefined) => void;
|
|
1369
|
+
cell_set_tooltip: (table_id: Table, column: number, row: number, value: string | undefined) => void;
|
|
1370
|
+
cell_set_text_font_family: (table_id: Table, column: number, row: number, value: "default" | "monospace" | undefined) => void;
|
|
1371
|
+
cell_set_text_formatting: (table_id: Table, column: number, row: number, value: number | undefined) => void;
|
|
1372
|
+
set_bgcolor: (table_id: Table, value: import("../types/index.js").color | undefined) => void;
|
|
1373
|
+
set_frame_color: (table_id: Table, value: import("../types/index.js").color | undefined) => void;
|
|
1374
|
+
set_frame_width: (table_id: Table, value: number | undefined) => void;
|
|
1375
|
+
set_border_color: (table_id: Table, value: import("../types/index.js").color | undefined) => void;
|
|
1376
|
+
set_border_width: (table_id: Table, value: number | undefined) => void;
|
|
1377
|
+
new: typeof tableCore.new_table;
|
|
1378
|
+
delete: typeof tableCore.delete_table;
|
|
1379
|
+
}>, "all"> & {
|
|
1380
|
+
readonly all: Table[];
|
|
1145
1381
|
};
|
|
1146
1382
|
/**
|
|
1147
1383
|
* PineScript `table.*`; `table.all` lists the live tables in creation order. The live tables go to `result.tables`.
|
|
1148
1384
|
*/
|
|
1149
|
-
export declare const table: {
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
cell(table_id: import("../index.js").Table, column: number, row: number, text?: string, width?: number, height?: number, text_color?: import("../types/index.js").color, text_halign?: "left" | "right" | "center", text_valign?: "center" | "top" | "bottom", text_size?: string | number, bgcolor?: import("../types/index.js").color, tooltip?: string, text_font_family?: "default" | "monospace", text_formatting?: number): void;
|
|
1153
|
-
merge_cells(table_id: import("../index.js").Table, start_column: number, start_row: number, end_column: number, end_row: number): void;
|
|
1154
|
-
clear(table_id: import("../index.js").Table, start_column: number, start_row: number, end_column?: number, end_row?: number): void;
|
|
1155
|
-
set_position(table_id: import("../index.js").Table, position: "top_left" | "top_center" | "top_right" | "middle_left" | "middle_center" | "middle_right" | "bottom_left" | "bottom_center" | "bottom_right"): void;
|
|
1156
|
-
delete_table(table_id: import("../index.js").Table): void;
|
|
1157
|
-
cell_set_text: (table_id: import("../index.js").Table, column: number, row: number, value: string | undefined) => void;
|
|
1158
|
-
cell_set_width: (table_id: import("../index.js").Table, column: number, row: number, value: number | undefined) => void;
|
|
1159
|
-
cell_set_height: (table_id: import("../index.js").Table, column: number, row: number, value: number | undefined) => void;
|
|
1160
|
-
cell_set_text_color: (table_id: import("../index.js").Table, column: number, row: number, value: import("../types/index.js").color | undefined) => void;
|
|
1161
|
-
cell_set_text_halign: (table_id: import("../index.js").Table, column: number, row: number, value: "left" | "right" | "center" | undefined) => void;
|
|
1162
|
-
cell_set_text_valign: (table_id: import("../index.js").Table, column: number, row: number, value: "center" | "top" | "bottom" | undefined) => void;
|
|
1163
|
-
cell_set_text_size: (table_id: import("../index.js").Table, column: number, row: number, value: string | number | undefined) => void;
|
|
1164
|
-
cell_set_bgcolor: (table_id: import("../index.js").Table, column: number, row: number, value: import("../types/index.js").color | undefined) => void;
|
|
1165
|
-
cell_set_tooltip: (table_id: import("../index.js").Table, column: number, row: number, value: string | undefined) => void;
|
|
1166
|
-
cell_set_text_font_family: (table_id: import("../index.js").Table, column: number, row: number, value: "default" | "monospace" | undefined) => void;
|
|
1167
|
-
cell_set_text_formatting: (table_id: import("../index.js").Table, column: number, row: number, value: number | undefined) => void;
|
|
1168
|
-
set_bgcolor: (table_id: import("../index.js").Table, value: import("../types/index.js").color | undefined) => void;
|
|
1169
|
-
set_frame_color: (table_id: import("../index.js").Table, value: import("../types/index.js").color | undefined) => void;
|
|
1170
|
-
set_frame_width: (table_id: import("../index.js").Table, value: number | undefined) => void;
|
|
1171
|
-
set_border_color: (table_id: import("../index.js").Table, value: import("../types/index.js").color | undefined) => void;
|
|
1172
|
-
set_border_width: (table_id: import("../index.js").Table, value: number | undefined) => void;
|
|
1173
|
-
new: typeof tableCore.new_table;
|
|
1174
|
-
delete: typeof tableCore.delete_table;
|
|
1385
|
+
export declare const table: typeof tableNs & {
|
|
1386
|
+
new: ((args: TableNewArgs) => Table) & ((position: string, columns: number, rows: number, args: TableNewArgs) => Table);
|
|
1387
|
+
cell: ((args: TableCellArgs) => void) & ((table_id: Table, column: number, row: number, args: TableCellArgs) => void) & ((table_id: Table, column: number, row: number, text: string, args: TableCellArgs) => void);
|
|
1175
1388
|
};
|
|
1176
1389
|
/** PineScript `position.*` constants (table positions). */
|
|
1177
1390
|
export { position };
|
|
@@ -1188,6 +1401,131 @@ export declare const text: {
|
|
|
1188
1401
|
wrap_auto: "auto";
|
|
1189
1402
|
wrap_none: "none";
|
|
1190
1403
|
};
|
|
1404
|
+
/** PineScript constant namespaces (`shape.triangleup`, `size.small`, `xloc.bar_time`, `extend.right`...): the strings
|
|
1405
|
+
* the functions take. */
|
|
1406
|
+
export declare const shape: {
|
|
1407
|
+
readonly xcross: "xcross";
|
|
1408
|
+
readonly cross: "cross";
|
|
1409
|
+
readonly triangleup: "triangleup";
|
|
1410
|
+
readonly triangledown: "triangledown";
|
|
1411
|
+
readonly flag: "flag";
|
|
1412
|
+
readonly circle: "circle";
|
|
1413
|
+
readonly arrowup: "arrowup";
|
|
1414
|
+
readonly arrowdown: "arrowdown";
|
|
1415
|
+
readonly labelup: "labelup";
|
|
1416
|
+
readonly labeldown: "labeldown";
|
|
1417
|
+
readonly square: "square";
|
|
1418
|
+
readonly diamond: "diamond";
|
|
1419
|
+
}, location: {
|
|
1420
|
+
readonly abovebar: "abovebar";
|
|
1421
|
+
readonly belowbar: "belowbar";
|
|
1422
|
+
readonly top: "top";
|
|
1423
|
+
readonly bottom: "bottom";
|
|
1424
|
+
readonly absolute: "absolute";
|
|
1425
|
+
}, size: {
|
|
1426
|
+
readonly auto: "auto";
|
|
1427
|
+
readonly tiny: "tiny";
|
|
1428
|
+
readonly small: "small";
|
|
1429
|
+
readonly normal: "normal";
|
|
1430
|
+
readonly large: "large";
|
|
1431
|
+
readonly huge: "huge";
|
|
1432
|
+
}, xloc: {
|
|
1433
|
+
readonly bar_index: "bar_index";
|
|
1434
|
+
readonly bar_time: "bar_time";
|
|
1435
|
+
}, yloc: {
|
|
1436
|
+
readonly price: "price";
|
|
1437
|
+
readonly abovebar: "abovebar";
|
|
1438
|
+
readonly belowbar: "belowbar";
|
|
1439
|
+
}, extend: {
|
|
1440
|
+
readonly none: "none";
|
|
1441
|
+
readonly left: "left";
|
|
1442
|
+
readonly right: "right";
|
|
1443
|
+
readonly both: "both";
|
|
1444
|
+
}, display: {
|
|
1445
|
+
readonly none: "none";
|
|
1446
|
+
readonly all: "all";
|
|
1447
|
+
readonly data_window: "data_window";
|
|
1448
|
+
readonly status_line: "status_line";
|
|
1449
|
+
readonly pane: "pane";
|
|
1450
|
+
}, format: {
|
|
1451
|
+
readonly inherit: "inherit";
|
|
1452
|
+
readonly price: "price";
|
|
1453
|
+
readonly volume: "volume";
|
|
1454
|
+
readonly percent: "percent";
|
|
1455
|
+
readonly mintick: "mintick";
|
|
1456
|
+
}, font: {
|
|
1457
|
+
readonly family_default: "default";
|
|
1458
|
+
readonly family_monospace: "monospace";
|
|
1459
|
+
}, scale: {
|
|
1460
|
+
readonly right: "right";
|
|
1461
|
+
readonly left: "left";
|
|
1462
|
+
readonly none: "none";
|
|
1463
|
+
}, order: {
|
|
1464
|
+
readonly ascending: "ascending";
|
|
1465
|
+
readonly descending: "descending";
|
|
1466
|
+
}, currency: {
|
|
1467
|
+
readonly NONE: "NONE";
|
|
1468
|
+
readonly AED: "AED";
|
|
1469
|
+
readonly ARS: "ARS";
|
|
1470
|
+
readonly AUD: "AUD";
|
|
1471
|
+
readonly BDT: "BDT";
|
|
1472
|
+
readonly BHD: "BHD";
|
|
1473
|
+
readonly BRL: "BRL";
|
|
1474
|
+
readonly BTC: "BTC";
|
|
1475
|
+
readonly CAD: "CAD";
|
|
1476
|
+
readonly CHF: "CHF";
|
|
1477
|
+
readonly CLP: "CLP";
|
|
1478
|
+
readonly CNY: "CNY";
|
|
1479
|
+
readonly COP: "COP";
|
|
1480
|
+
readonly CZK: "CZK";
|
|
1481
|
+
readonly DKK: "DKK";
|
|
1482
|
+
readonly EGP: "EGP";
|
|
1483
|
+
readonly ETH: "ETH";
|
|
1484
|
+
readonly EUR: "EUR";
|
|
1485
|
+
readonly GBP: "GBP";
|
|
1486
|
+
readonly GEL: "GEL";
|
|
1487
|
+
readonly HKD: "HKD";
|
|
1488
|
+
readonly HUF: "HUF";
|
|
1489
|
+
readonly IDR: "IDR";
|
|
1490
|
+
readonly ILS: "ILS";
|
|
1491
|
+
readonly INR: "INR";
|
|
1492
|
+
readonly ISK: "ISK";
|
|
1493
|
+
readonly JPY: "JPY";
|
|
1494
|
+
readonly KES: "KES";
|
|
1495
|
+
readonly KRW: "KRW";
|
|
1496
|
+
readonly KWD: "KWD";
|
|
1497
|
+
readonly LKR: "LKR";
|
|
1498
|
+
readonly MAD: "MAD";
|
|
1499
|
+
readonly MXN: "MXN";
|
|
1500
|
+
readonly MYR: "MYR";
|
|
1501
|
+
readonly NGN: "NGN";
|
|
1502
|
+
readonly NOK: "NOK";
|
|
1503
|
+
readonly NZD: "NZD";
|
|
1504
|
+
readonly PEN: "PEN";
|
|
1505
|
+
readonly PHP: "PHP";
|
|
1506
|
+
readonly PKR: "PKR";
|
|
1507
|
+
readonly PLN: "PLN";
|
|
1508
|
+
readonly QAR: "QAR";
|
|
1509
|
+
readonly RON: "RON";
|
|
1510
|
+
readonly RSD: "RSD";
|
|
1511
|
+
readonly RUB: "RUB";
|
|
1512
|
+
readonly SAR: "SAR";
|
|
1513
|
+
readonly SEK: "SEK";
|
|
1514
|
+
readonly SGD: "SGD";
|
|
1515
|
+
readonly THB: "THB";
|
|
1516
|
+
readonly TND: "TND";
|
|
1517
|
+
readonly TRY: "TRY";
|
|
1518
|
+
readonly TWD: "TWD";
|
|
1519
|
+
readonly USD: "USD";
|
|
1520
|
+
readonly USDT: "USDT";
|
|
1521
|
+
readonly VES: "VES";
|
|
1522
|
+
readonly VND: "VND";
|
|
1523
|
+
readonly ZAR: "ZAR";
|
|
1524
|
+
}, adjustment: {
|
|
1525
|
+
readonly none: "none";
|
|
1526
|
+
readonly splits: "splits";
|
|
1527
|
+
readonly dividends: "dividends";
|
|
1528
|
+
};
|
|
1191
1529
|
/**
|
|
1192
1530
|
* PineScript `chart.point.*`. `chart.point.now(price?)` is the point of the current bar
|
|
1193
1531
|
* (index, time, and `price`, default the close), so it runs inside eachBar().
|