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