oakscriptjs 0.9.6 → 0.10.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/README.md +1 -1
- package/dist/cjs/array/index.d.ts +9 -23
- package/dist/cjs/array/index.d.ts.map +1 -1
- package/dist/cjs/array/index.js +4 -0
- package/dist/cjs/array/index.js.map +2 -2
- package/dist/cjs/drawing/bar-time.d.ts +24 -0
- package/dist/cjs/drawing/bar-time.d.ts.map +1 -0
- package/dist/cjs/drawing/bar-time.js +47 -0
- package/dist/cjs/drawing/bar-time.js.map +7 -0
- package/dist/cjs/drawing/output.d.ts +32 -0
- package/dist/cjs/drawing/output.d.ts.map +1 -0
- package/dist/cjs/drawing/output.js +184 -0
- package/dist/cjs/drawing/output.js.map +7 -0
- package/dist/cjs/drawing/registry.d.ts +5 -4
- package/dist/cjs/drawing/registry.d.ts.map +1 -1
- package/dist/cjs/drawing/registry.js +11 -2
- package/dist/cjs/drawing/registry.js.map +2 -2
- package/dist/cjs/index.d.ts +7 -3
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +11 -2
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/polyline/index.d.ts +3 -5
- package/dist/cjs/polyline/index.d.ts.map +1 -1
- package/dist/cjs/polyline/index.js +0 -5
- package/dist/cjs/polyline/index.js.map +2 -2
- package/dist/cjs/runtime/index.d.ts +2 -1
- package/dist/cjs/runtime/index.d.ts.map +1 -1
- package/dist/cjs/runtime/index.js +2 -0
- package/dist/cjs/runtime/index.js.map +2 -2
- package/dist/cjs/runtime/input-active.d.ts +27 -0
- package/dist/cjs/runtime/input-active.d.ts.map +1 -0
- package/dist/cjs/runtime/input-active.js +44 -0
- package/dist/cjs/runtime/input-active.js.map +7 -0
- package/dist/cjs/runtime/types.d.ts +51 -2
- package/dist/cjs/runtime/types.d.ts.map +1 -1
- package/dist/cjs/runtime/types.js.map +1 -1
- package/dist/cjs/script/index.d.ts +104 -8
- package/dist/cjs/script/index.d.ts.map +1 -1
- package/dist/cjs/script/index.js +163 -28
- package/dist/cjs/script/index.js.map +3 -3
- package/dist/cjs/str/index.d.ts +9 -3
- package/dist/cjs/str/index.d.ts.map +1 -1
- package/dist/cjs/str/index.js +11 -6
- package/dist/cjs/str/index.js.map +2 -2
- package/dist/cjs/str/numberformat.d.ts +6 -0
- package/dist/cjs/str/numberformat.d.ts.map +1 -1
- package/dist/cjs/str/numberformat.js +9 -1
- package/dist/cjs/str/numberformat.js.map +2 -2
- package/dist/cjs/table/index.d.ts +87 -0
- package/dist/cjs/table/index.d.ts.map +1 -0
- package/dist/cjs/table/index.js +150 -0
- package/dist/cjs/table/index.js.map +7 -0
- package/dist/cjs/text/index.d.ts +17 -2
- package/dist/cjs/text/index.d.ts.map +1 -1
- package/dist/cjs/text/index.js +15 -1
- package/dist/cjs/text/index.js.map +2 -2
- package/dist/cjs/types/index.d.ts +30 -1
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/cjs/types/index.js +12 -0
- package/dist/cjs/types/index.js.map +2 -2
- package/dist/cjs/types/metadata.d.ts +258 -26
- package/dist/cjs/types/metadata.d.ts.map +1 -1
- package/dist/cjs/types/metadata.js.map +1 -1
- package/dist/esm/array/index.d.ts +9 -23
- package/dist/esm/array/index.d.ts.map +1 -1
- package/dist/esm/array/index.js +10 -22
- package/dist/esm/array/index.js.map +1 -1
- package/dist/esm/drawing/bar-time.d.ts +24 -0
- package/dist/esm/drawing/bar-time.d.ts.map +1 -0
- package/dist/esm/drawing/bar-time.js +44 -0
- package/dist/esm/drawing/bar-time.js.map +1 -0
- package/dist/esm/drawing/output.d.ts +32 -0
- package/dist/esm/drawing/output.d.ts.map +1 -0
- package/dist/esm/drawing/output.js +190 -0
- package/dist/esm/drawing/output.js.map +1 -0
- package/dist/esm/drawing/registry.d.ts +5 -4
- package/dist/esm/drawing/registry.d.ts.map +1 -1
- package/dist/esm/drawing/registry.js +12 -2
- package/dist/esm/drawing/registry.js.map +1 -1
- package/dist/esm/index.d.ts +7 -3
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +8 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/polyline/index.d.ts +3 -5
- package/dist/esm/polyline/index.d.ts.map +1 -1
- package/dist/esm/polyline/index.js +3 -9
- package/dist/esm/polyline/index.js.map +1 -1
- package/dist/esm/runtime/index.d.ts +2 -1
- package/dist/esm/runtime/index.d.ts.map +1 -1
- package/dist/esm/runtime/index.js +1 -0
- package/dist/esm/runtime/index.js.map +1 -1
- package/dist/esm/runtime/input-active.d.ts +27 -0
- package/dist/esm/runtime/input-active.d.ts.map +1 -0
- package/dist/esm/runtime/input-active.js +54 -0
- package/dist/esm/runtime/input-active.js.map +1 -0
- package/dist/esm/runtime/types.d.ts +51 -2
- package/dist/esm/runtime/types.d.ts.map +1 -1
- package/dist/esm/script/index.d.ts +104 -8
- package/dist/esm/script/index.d.ts.map +1 -1
- package/dist/esm/script/index.js +194 -24
- package/dist/esm/script/index.js.map +1 -1
- package/dist/esm/str/index.d.ts +9 -3
- package/dist/esm/str/index.d.ts.map +1 -1
- package/dist/esm/str/index.js +25 -10
- package/dist/esm/str/index.js.map +1 -1
- package/dist/esm/str/numberformat.d.ts +6 -0
- package/dist/esm/str/numberformat.d.ts.map +1 -1
- package/dist/esm/str/numberformat.js +12 -0
- package/dist/esm/str/numberformat.js.map +1 -1
- package/dist/esm/table/index.d.ts +87 -0
- package/dist/esm/table/index.d.ts.map +1 -0
- package/dist/esm/table/index.js +169 -0
- package/dist/esm/table/index.js.map +1 -0
- package/dist/esm/text/index.d.ts +17 -2
- package/dist/esm/text/index.d.ts.map +1 -1
- package/dist/esm/text/index.js +17 -2
- package/dist/esm/text/index.js.map +1 -1
- package/dist/esm/types/index.d.ts +30 -1
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/esm/types/index.js +14 -0
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/metadata.d.ts +258 -26
- package/dist/esm/types/metadata.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/array/index.ts +12 -23
- package/src/drawing/bar-time.ts +42 -0
- package/src/drawing/output.ts +214 -0
- package/src/drawing/registry.ts +16 -6
- package/src/index.ts +11 -3
- package/src/polyline/index.ts +3 -12
- package/src/runtime/index.ts +3 -0
- package/src/runtime/input-active.ts +50 -0
- package/src/runtime/types.ts +48 -2
- package/src/script/index.ts +301 -30
- package/src/str/index.ts +23 -10
- package/src/str/numberformat.ts +13 -0
- package/src/table/index.ts +221 -0
- package/src/text/index.ts +18 -2
- package/src/types/index.ts +32 -1
- package/src/types/metadata.ts +325 -26
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/table/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Table namespace\n * Functions for creating and filling table drawing objects.\n *\n * @remarks\n * A table is drawn at a fixed position of the pane (`position.*`), not at a bar. Tables have no getters in\n * PineScript; the script API returns the live tables in `result.tables`.\n *\n * PineScript rules:\n * - `table.cell` defines a cell: the arguments it does not give get their default, a previous definition of the\n * cell is replaced\n * - `table.cell_set_*` changes one property of a cell (a cell that was not defined is created)\n * - a column or row outside the table is a runtime error\n * - a deleted table is `na`: its functions do nothing\n *\n * @version 6\n */\n\nimport { all as allDrawings, isDeleted, register, remove } from '../drawing/registry.js';\nimport type { Table, TableCell, color } from '../types/index.js';\n\ntype TablePosition = Table['position'];\ntype HAlign = 'left' | 'center' | 'right';\ntype VAlign = 'top' | 'center' | 'bottom';\ntype FontFamily = 'default' | 'monospace';\n\n/**\n * Creates a new table (PineScript `table.new`).\n *\n * @example\n * ```typescript\n * const t = table.new(position.top_right, 2, 3, '#131722', '#787B86', 1);\n * table.cell(t, 0, 0, 'RSI', 0, 0, '#FFFFFF');\n * ```\n */\nexport function new_table(\n position: TablePosition,\n columns: number,\n rows: number,\n bgcolor?: color,\n frame_color?: color,\n frame_width?: number,\n border_color?: color,\n border_width?: number,\n force_overlay?: boolean\n): Table {\n return register('table', {\n position,\n columns,\n rows,\n bgcolor,\n frame_color,\n frame_width,\n border_color,\n border_width,\n force_overlay: force_overlay ?? false,\n cells: new Map(),\n merges: [],\n });\n}\n\nfunction checkCell(caller: string, id: Table, column: number, row: number): void {\n if (!(column >= 0 && column < id.columns && row >= 0 && row < id.rows)) {\n throw new RangeError(\n `${caller}: column ${column}, row ${row} is outside the table (${id.columns} columns, ${id.rows} rows).`\n );\n }\n}\n\nconst key = (column: number, row: number): string => `${column},${row}`;\n\n/** The cell at column / row, created when it was not defined. */\nfunction cellOf(caller: string, id: Table, column: number, row: number): TableCell {\n checkCell(caller, id, column, row);\n const cells = (id.cells ??= new Map());\n let cell = cells.get(key(column, row));\n if (!cell) cells.set(key(column, row), (cell = { text: '' }));\n return cell;\n}\n\n/**\n * Defines a cell (PineScript `table.cell`): its text and properties. Omitted properties get their default.\n */\nexport function cell(\n table_id: Table,\n column: number,\n row: number,\n text?: string,\n width?: number,\n height?: number,\n text_color?: color,\n text_halign?: HAlign,\n text_valign?: VAlign,\n text_size?: string | number,\n bgcolor?: color,\n tooltip?: string,\n text_font_family?: FontFamily,\n text_formatting?: number\n): void {\n if (isDeleted(table_id)) return;\n checkCell('table.cell()', table_id, column, row);\n (table_id.cells ??= new Map()).set(key(column, row), {\n text: text ?? '',\n width,\n height,\n text_color,\n text_halign,\n text_valign,\n text_size,\n bgcolor,\n tooltip,\n text_font_family,\n text_formatting,\n });\n}\n\nfunction setCell<K extends keyof TableCell>(name: string, field: K) {\n return (table_id: Table, column: number, row: number, value: TableCell[K]): void => {\n if (isDeleted(table_id)) return;\n cellOf(`table.${name}()`, table_id, column, row)[field] = value;\n };\n}\n\n/** Sets the text of a cell. */\nexport const cell_set_text = setCell('cell_set_text', 'text');\n/** Sets the width of a cell (% of the chart width; 0 fits the text). */\nexport const cell_set_width = setCell('cell_set_width', 'width');\n/** Sets the height of a cell (% of the chart height; 0 fits the text). */\nexport const cell_set_height = setCell('cell_set_height', 'height');\n/** Sets the text colour of a cell. */\nexport const cell_set_text_color = setCell('cell_set_text_color', 'text_color');\n/** Sets the horizontal text alignment of a cell. */\nexport const cell_set_text_halign = setCell('cell_set_text_halign', 'text_halign');\n/** Sets the vertical text alignment of a cell. */\nexport const cell_set_text_valign = setCell('cell_set_text_valign', 'text_valign');\n/** Sets the text size of a cell. */\nexport const cell_set_text_size = setCell('cell_set_text_size', 'text_size');\n/** Sets the background colour of a cell. */\nexport const cell_set_bgcolor = setCell('cell_set_bgcolor', 'bgcolor');\n/** Sets the tooltip of a cell. */\nexport const cell_set_tooltip = setCell('cell_set_tooltip', 'tooltip');\n/** Sets the font family of a cell. */\nexport const cell_set_text_font_family = setCell('cell_set_text_font_family', 'text_font_family');\n/** Sets the text formatting of a cell (`text.format_*` flags). */\nexport const cell_set_text_formatting = setCell('cell_set_text_formatting', 'text_formatting');\n\n/**\n * Merges the cells from start_column / start_row to end_column / end_row (PineScript `table.merge_cells`). The\n * merged cell shows the content of the start cell.\n */\nexport function merge_cells(\n table_id: Table,\n start_column: number,\n start_row: number,\n end_column: number,\n end_row: number\n): void {\n if (isDeleted(table_id)) return;\n checkCell('table.merge_cells()', table_id, start_column, start_row);\n checkCell('table.merge_cells()', table_id, end_column, end_row);\n if (end_column < start_column || end_row < start_row) {\n throw new RangeError('table.merge_cells(): the end cell is before the start cell.');\n }\n (table_id.merges ??= []).push({ start_column, start_row, end_column, end_row });\n}\n\n/**\n * Removes the cells from start_column / start_row to end_column / end_row (PineScript `table.clear`; default end:\n * the start cell), and the merges that start in that range.\n */\nexport function clear(\n table_id: Table,\n start_column: number,\n start_row: number,\n end_column: number = start_column,\n end_row: number = start_row\n): void {\n if (isDeleted(table_id)) return;\n checkCell('table.clear()', table_id, start_column, start_row);\n checkCell('table.clear()', table_id, end_column, end_row);\n const inside = (column: number, row: number): boolean =>\n column >= start_column && column <= end_column && row >= start_row && row <= end_row;\n for (let column = start_column; column <= end_column; column++) {\n for (let row = start_row; row <= end_row; row++) table_id.cells?.delete(key(column, row));\n }\n if (table_id.merges) table_id.merges = table_id.merges.filter((m) => !inside(m.start_column, m.start_row));\n}\n\nfunction setTable<K extends keyof Table>(field: K) {\n return (table_id: Table, value: Table[K]): void => {\n if (isDeleted(table_id)) return;\n table_id[field] = value;\n };\n}\n\n/** Moves the table to another position (`position.*`). */\nexport const set_position = setTable('position');\n/** Sets the background colour of the table. */\nexport const set_bgcolor = setTable('bgcolor');\n/** Sets the colour of the outer frame. */\nexport const set_frame_color = setTable('frame_color');\n/** Sets the width of the outer frame. */\nexport const set_frame_width = setTable('frame_width');\n/** Sets the colour of the cell borders. */\nexport const set_border_color = setTable('border_color');\n/** Sets the width of the cell borders. */\nexport const set_border_width = setTable('border_width');\n\n/** Deletes the table (PineScript `table.delete`). */\nexport function delete_table(table_id: Table): void {\n remove('table', table_id);\n}\n\n/** All live tables, in creation order (PineScript `table.all`). A new array. */\nexport function all(): Table[] {\n return allDrawings('table');\n}\n\n// Alias to match PineScript API\nexport { new_table as new };\nexport { delete_table as delete };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBA,sBAAgE;AAiBzD,SAAS,UACd,UACA,SACA,MACA,SACA,aACA,aACA,cACA,cACA,eACO;AACP,aAAO,0BAAS,SAAS;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe,iBAAiB;AAAA,IAChC,OAAO,oBAAI,IAAI;AAAA,IACf,QAAQ,CAAC;AAAA,EACX,CAAC;AACH;AAEA,SAAS,UAAU,QAAgB,IAAW,QAAgB,KAAmB;AAC/E,MAAI,EAA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AAU;AACjD,SAAO,CAAC,UAAiB,UAA0B;AACjD,YAAI,2BAAU,QAAQ,EAAG;AACzB,aAAS,KAAK,IAAI;AAAA,EACpB;AACF;AAGO,MAAM,eAAe,SAAS,UAAU;AAExC,MAAM,cAAc,SAAS,SAAS;AAEtC,MAAM,kBAAkB,SAAS,aAAa;AAE9C,MAAM,kBAAkB,SAAS,aAAa;AAE9C,MAAM,mBAAmB,SAAS,cAAc;AAEhD,MAAM,mBAAmB,SAAS,cAAc;AAGhD,SAAS,aAAa,UAAuB;AAClD,8BAAO,SAAS,QAAQ;AAC1B;AAGO,SAAS,MAAe;AAC7B,aAAO,gBAAAC,KAAY,OAAO;AAC5B;",
|
|
6
|
+
"names": ["cell", "allDrawings"]
|
|
7
|
+
}
|
package/dist/cjs/text/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Text namespace
|
|
3
|
-
* PineScript `text.format_*` constants for `label.set_text_formatting` and `box.set_text_formatting
|
|
3
|
+
* PineScript `text.format_*` constants for `label.set_text_formatting` and `box.set_text_formatting`, and the
|
|
4
|
+
* `text.align_*` / `text.wrap_*` constants.
|
|
4
5
|
*
|
|
5
|
-
* The values are flags that add up, as in PineScript (`text.format_bold + text.format_italic`).
|
|
6
|
+
* The format values are flags that add up, as in PineScript (`text.format_bold + text.format_italic`).
|
|
6
7
|
* They are the values PineScript uses for drawn labels and boxes.
|
|
7
8
|
*/
|
|
8
9
|
/** No formatting. */
|
|
@@ -11,4 +12,18 @@ export declare const format_none = 0;
|
|
|
11
12
|
export declare const format_bold = 1;
|
|
12
13
|
/** Italic text. */
|
|
13
14
|
export declare const format_italic = 2;
|
|
15
|
+
/** Text aligned to the left (`table.cell`, `box.new`, `label.new` textalign). */
|
|
16
|
+
export declare const align_left: "left";
|
|
17
|
+
/** Text centred horizontally or vertically. */
|
|
18
|
+
export declare const align_center: "center";
|
|
19
|
+
/** Text aligned to the right. */
|
|
20
|
+
export declare const align_right: "right";
|
|
21
|
+
/** Text aligned to the top (`table.cell`, `box.new` text_valign). */
|
|
22
|
+
export declare const align_top: "top";
|
|
23
|
+
/** Text aligned to the bottom. */
|
|
24
|
+
export declare const align_bottom: "bottom";
|
|
25
|
+
/** Text wrapped to the box width (`box.new` text_wrap). */
|
|
26
|
+
export declare const wrap_auto: "auto";
|
|
27
|
+
/** Text not wrapped. */
|
|
28
|
+
export declare const wrap_none: "none";
|
|
14
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/text/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/text/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,qBAAqB;AACrB,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,iBAAiB;AACjB,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,mBAAmB;AACnB,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,iFAAiF;AACjF,eAAO,MAAM,UAAU,EAAG,MAAe,CAAC;AAC1C,+CAA+C;AAC/C,eAAO,MAAM,YAAY,EAAG,QAAiB,CAAC;AAC9C,iCAAiC;AACjC,eAAO,MAAM,WAAW,EAAG,OAAgB,CAAC;AAC5C,qEAAqE;AACrE,eAAO,MAAM,SAAS,EAAG,KAAc,CAAC;AACxC,kCAAkC;AAClC,eAAO,MAAM,YAAY,EAAG,QAAiB,CAAC;AAC9C,2DAA2D;AAC3D,eAAO,MAAM,SAAS,EAAG,MAAe,CAAC;AACzC,wBAAwB;AACxB,eAAO,MAAM,SAAS,EAAG,MAAe,CAAC"}
|
package/dist/cjs/text/index.js
CHANGED
|
@@ -18,12 +18,26 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var text_exports = {};
|
|
20
20
|
__export(text_exports, {
|
|
21
|
+
align_bottom: () => align_bottom,
|
|
22
|
+
align_center: () => align_center,
|
|
23
|
+
align_left: () => align_left,
|
|
24
|
+
align_right: () => align_right,
|
|
25
|
+
align_top: () => align_top,
|
|
21
26
|
format_bold: () => format_bold,
|
|
22
27
|
format_italic: () => format_italic,
|
|
23
|
-
format_none: () => format_none
|
|
28
|
+
format_none: () => format_none,
|
|
29
|
+
wrap_auto: () => wrap_auto,
|
|
30
|
+
wrap_none: () => wrap_none
|
|
24
31
|
});
|
|
25
32
|
module.exports = __toCommonJS(text_exports);
|
|
26
33
|
const format_none = 0;
|
|
27
34
|
const format_bold = 1;
|
|
28
35
|
const format_italic = 2;
|
|
36
|
+
const align_left = "left";
|
|
37
|
+
const align_center = "center";
|
|
38
|
+
const align_right = "right";
|
|
39
|
+
const align_top = "top";
|
|
40
|
+
const align_bottom = "bottom";
|
|
41
|
+
const wrap_auto = "auto";
|
|
42
|
+
const wrap_none = "none";
|
|
29
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/text/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Text namespace\n * PineScript `text.format_*` constants for `label.set_text_formatting` and `box.set_text_formatting
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * Text namespace\n * PineScript `text.format_*` constants for `label.set_text_formatting` and `box.set_text_formatting`, and the\n * `text.align_*` / `text.wrap_*` constants.\n *\n * The format values are flags that add up, as in PineScript (`text.format_bold + text.format_italic`).\n * They are the values PineScript uses for drawn labels and boxes.\n */\n\n/** No formatting. */\nexport const format_none = 0;\n/** Bold text. */\nexport const format_bold = 1;\n/** Italic text. */\nexport const format_italic = 2;\n\n/** Text aligned to the left (`table.cell`, `box.new`, `label.new` textalign). */\nexport const align_left = 'left' as const;\n/** Text centred horizontally or vertically. */\nexport const align_center = 'center' as const;\n/** Text aligned to the right. */\nexport const align_right = 'right' as const;\n/** Text aligned to the top (`table.cell`, `box.new` text_valign). */\nexport const align_top = 'top' as const;\n/** Text aligned to the bottom. */\nexport const align_bottom = 'bottom' as const;\n/** Text wrapped to the box width (`box.new` text_wrap). */\nexport const wrap_auto = 'auto' as const;\n/** Text not wrapped. */\nexport const wrap_none = 'none' as const;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,MAAM,cAAc;AAEpB,MAAM,cAAc;AAEpB,MAAM,gBAAgB;AAGtB,MAAM,aAAa;AAEnB,MAAM,eAAe;AAErB,MAAM,cAAc;AAEpB,MAAM,YAAY;AAElB,MAAM,eAAe;AAErB,MAAM,YAAY;AAElB,MAAM,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -181,8 +181,21 @@ export interface Table {
|
|
|
181
181
|
border_width?: number;
|
|
182
182
|
/** Table background color */
|
|
183
183
|
bgcolor?: color;
|
|
184
|
-
/**
|
|
184
|
+
/** Display on the main chart pane (PineScript force_overlay) */
|
|
185
|
+
force_overlay?: boolean;
|
|
186
|
+
/** Cells by "column,row" */
|
|
185
187
|
cells?: Map<string, TableCell>;
|
|
188
|
+
/** Merged cell ranges (PineScript table.merge_cells) */
|
|
189
|
+
merges?: TableMerge[];
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Merged cell range of a table
|
|
193
|
+
*/
|
|
194
|
+
export interface TableMerge {
|
|
195
|
+
start_column: number;
|
|
196
|
+
start_row: number;
|
|
197
|
+
end_column: number;
|
|
198
|
+
end_row: number;
|
|
186
199
|
}
|
|
187
200
|
/**
|
|
188
201
|
* Table cell data
|
|
@@ -208,6 +221,8 @@ export interface TableCell {
|
|
|
208
221
|
tooltip?: string;
|
|
209
222
|
/** Text font family */
|
|
210
223
|
text_font_family?: 'default' | 'monospace';
|
|
224
|
+
/** Text formatting flags: 0 none, 1 bold, 2 italic, 3 bold + italic (PineScript text.format_*) */
|
|
225
|
+
text_formatting?: number;
|
|
211
226
|
}
|
|
212
227
|
export type series_line = series<Line>;
|
|
213
228
|
export type series_box = series<Box>;
|
|
@@ -296,6 +311,20 @@ export declare const xloc: {
|
|
|
296
311
|
/** X-coordinates are UNIX timestamps in milliseconds */
|
|
297
312
|
bar_time: "bar_time";
|
|
298
313
|
};
|
|
314
|
+
/**
|
|
315
|
+
* Table position constants (PineScript `position.*`), for `table.new` and `table.set_position`
|
|
316
|
+
*/
|
|
317
|
+
export declare const position: {
|
|
318
|
+
top_left: "top_left";
|
|
319
|
+
top_center: "top_center";
|
|
320
|
+
top_right: "top_right";
|
|
321
|
+
middle_left: "middle_left";
|
|
322
|
+
middle_center: "middle_center";
|
|
323
|
+
middle_right: "middle_right";
|
|
324
|
+
bottom_left: "bottom_left";
|
|
325
|
+
bottom_center: "bottom_center";
|
|
326
|
+
bottom_right: "bottom_right";
|
|
327
|
+
};
|
|
299
328
|
/**
|
|
300
329
|
* ChartPoint interface - Represents a point on the chart
|
|
301
330
|
* @remarks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC;AACzB,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAC3B,MAAM,MAAM,IAAI,GAAG,OAAO,CAAC;AAE3B,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAGpC,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAC5B,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AACrC,MAAM,MAAM,YAAY,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,QAAQ;IACvB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,kFAAkF;IAClF,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC;IACxC,6BAA6B;IAC7B,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,UAAU,EAAE,KAAK,GAAG,IAAI,CAAC;IAClC,iBAAiB;IACjB,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACnD,2BAA2B;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,iCAAiC;IACjC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAGD,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AACnD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/cjs/types/index.js
CHANGED
|
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var types_exports = {};
|
|
20
20
|
__export(types_exports, {
|
|
21
21
|
na: () => na,
|
|
22
|
+
position: () => position,
|
|
22
23
|
xloc: () => xloc
|
|
23
24
|
});
|
|
24
25
|
module.exports = __toCommonJS(types_exports);
|
|
@@ -29,4 +30,15 @@ const xloc = {
|
|
|
29
30
|
/** X-coordinates are UNIX timestamps in milliseconds */
|
|
30
31
|
bar_time: "bar_time"
|
|
31
32
|
};
|
|
33
|
+
const position = {
|
|
34
|
+
top_left: "top_left",
|
|
35
|
+
top_center: "top_center",
|
|
36
|
+
top_right: "top_right",
|
|
37
|
+
middle_left: "middle_left",
|
|
38
|
+
middle_center: "middle_center",
|
|
39
|
+
middle_right: "middle_right",
|
|
40
|
+
bottom_left: "bottom_left",
|
|
41
|
+
bottom_center: "bottom_center",
|
|
42
|
+
bottom_right: "bottom_right"
|
|
43
|
+
};
|
|
32
44
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/types/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Core types for OakScriptJS\n * These types mirror the PineScript type system\n */\n\n// Basic types\nexport type int = number;\nexport type float = number;\nexport type bool = boolean;\n//export type string = string;\nexport type color = string | number;\n\n// Series types - In PineScript, series are time-series arrays\nexport type series<T> = T[];\nexport type series_int = series<int>;\nexport type series_float = series<float>;\nexport type series_bool = series<bool>;\nexport type series_string = series<string>;\nexport type series_color = series<color>;\n\n// Simple types (non-series)\nexport type simple_int = int;\nexport type simple_float = float;\nexport type simple_bool = bool;\nexport type simple_string = string;\nexport type simple_color = color;\n\n// Input types\nexport type input_int = int;\nexport type input_float = float;\nexport type input_bool = bool;\nexport type input_string = string;\nexport type input_color = color;\n\n// Const types (compile-time constants)\nexport type const_int = int;\nexport type const_float = float;\nexport type const_bool = bool;\nexport type const_string = string;\nexport type const_color = color;\n\n// Source types for indicators\nexport type Source = series_float;\n\n// Array types\n// PineScript arrays are JS arrays; aliased for API parity and future extension.\nexport type PineArray<T> = Array<T>;\n\n// Map types\n// PineScript maps are JS Maps: keys in insertion order, exact key equality.\nexport type PineMapKey = number | string | boolean;\nexport type PineMap<K extends PineMapKey, V> = Map<K, V>;\n\n// Matrix types\nexport interface PineMatrix<T> {\n rows: int;\n columns: int;\n data: T[][];\n}\n\n// Drawing object types - Now implemented for computational use!\n// While primarily used for visualization in PineScript, these objects have computational value:\n// - line.get_price() for trend analysis\n// - box getters for gap detection and range breakouts\n\n/**\n * Line object - Represents a line on the chart\n * @remarks\n * While lines are visual in PineScript, line.get_price() provides computational value\n * for detecting trend line breakouts, calculating support/resistance levels, etc.\n */\nexport interface Line {\n /** First point's x coordinate (bar index or UNIX timestamp) */\n x1: number;\n /** First point's y coordinate (price level) */\n y1: number;\n /** Second point's x coordinate (bar index or UNIX timestamp) */\n x2: number;\n /** Second point's y coordinate (price level) */\n y2: number;\n /** X-axis coordinate system */\n xloc: 'bar_index' | 'bar_time';\n /** Extension mode */\n extend: 'none' | 'left' | 'right' | 'both';\n /** Line color (stored but not used for calculations) */\n color?: color;\n /** Line style (stored but not used for calculations) */\n style?: 'solid' | 'dotted' | 'dashed' | 'arrow_left' | 'arrow_right' | 'arrow_both';\n /** Line width in pixels (stored but not used for calculations) */\n width?: number;\n /** Display on the main chart pane (PineScript force_overlay) */\n force_overlay?: boolean;\n}\n\n/**\n * Box object - Represents a rectangular area on the chart\n * @remarks\n * Box getters (get_top, get_bottom, get_left, get_right) enable gap detection,\n * range breakout analysis, and consolidation zone identification.\n */\nexport interface Box {\n /** Left border x coordinate (bar index or UNIX timestamp) */\n left: number;\n /** Top border y coordinate (price level) */\n top: number;\n /** Right border x coordinate (bar index or UNIX timestamp) */\n right: number;\n /** Bottom border y coordinate (price level) */\n bottom: number;\n /** X-axis coordinate system */\n xloc: 'bar_index' | 'bar_time';\n /** Horizontal extension mode */\n extend: 'none' | 'left' | 'right' | 'both';\n /** Border color (stored but not used for calculations) */\n border_color?: color;\n /** Border width in pixels (stored but not used for calculations) */\n border_width?: number;\n /** Border style (stored but not used for calculations) */\n border_style?: 'solid' | 'dotted' | 'dashed';\n /** Background fill color (stored but not used for calculations) */\n bgcolor?: color;\n /** Text content displayed in the box */\n text?: string;\n /** Text size */\n text_size?: string | number;\n /** Text color */\n text_color?: color;\n /** Horizontal text alignment */\n text_halign?: 'left' | 'center' | 'right';\n /** Vertical text alignment */\n text_valign?: 'top' | 'center' | 'bottom';\n /** Text wrapping mode */\n text_wrap?: 'none' | 'auto';\n /** Text font family */\n text_font_family?: 'default' | 'monospace';\n /** Text formatting flags: 0 none, 1 bold, 2 italic, 3 bold + italic (PineScript text.format_*) */\n text_formatting?: number;\n /** Display on the main chart pane (PineScript force_overlay) */\n force_overlay?: boolean;\n}\n\n/**\n * Label object - Represents a label/annotation on the chart\n * @remarks\n * Labels have limited computational value. Primarily used for marking points and displaying text.\n */\nexport interface Label {\n /** X coordinate (bar index or UNIX timestamp) */\n x: number;\n /** Y coordinate (price level when yloc = 'price') */\n y: number;\n /** X-axis coordinate system */\n xloc: 'bar_index' | 'bar_time';\n /** Y-axis positioning mode */\n yloc: 'price' | 'abovebar' | 'belowbar';\n /** Label text content */\n text?: string;\n /** Tooltip text shown on hover */\n tooltip?: string;\n /** Border and arrow color */\n color?: color;\n /** Label style */\n style?: 'none' | 'xcross' | 'cross' | 'triangleup' | 'triangledown' | 'flag' | 'circle' |\n 'arrowup' | 'arrowdown' | 'label_up' | 'label_down' | 'label_left' | 'label_right' |\n 'label_lower_left' | 'label_lower_right' | 'label_upper_left' | 'label_upper_right' |\n 'label_center' | 'square' | 'diamond' | 'text_outline';\n /** Text color */\n textcolor?: color;\n /** Label size */\n size?: string | number;\n /** Text alignment */\n textalign?: 'left' | 'center' | 'right';\n /** Text font family */\n text_font_family?: 'default' | 'monospace';\n /** Text formatting flags: 0 none, 1 bold, 2 italic, 3 bold + italic (PineScript text.format_*) */\n text_formatting?: number;\n /** Display on the main chart pane (PineScript force_overlay) */\n force_overlay?: boolean;\n}\n\n/**\n * Linefill object - Represents a filled area between two lines\n * @remarks\n * Minimal computational value. Used to fill channel areas visually.\n */\nexport interface Linefill {\n /** First line reference */\n line1: Line;\n /** Second line reference */\n line2: Line;\n /** Fill color */\n color?: color;\n}\n\n/**\n * Table object - Represents a table for displaying data\n * @remarks\n * Tables have NO computational value (no getter functions in PineScript).\n * Purely for display/visualization purposes.\n */\nexport interface Table {\n /** Table position on chart */\n position: 'top_left' | 'top_center' | 'top_right' |\n 'middle_left' | 'middle_center' | 'middle_right' |\n 'bottom_left' | 'bottom_center' | 'bottom_right';\n /** Number of columns */\n columns: number;\n /** Number of rows */\n rows: number;\n /** Outer frame color */\n frame_color?: color;\n /** Outer frame width */\n frame_width?: number;\n /** Cell border color */\n border_color?: color;\n /** Cell border width */\n border_width?: number;\n /** Table background color */\n bgcolor?: color;\n /** Cell data (internal storage) */\n cells?: Map<string, TableCell>;\n}\n\n/**\n * Table cell data\n */\nexport interface TableCell {\n /** Cell text content */\n text?: string;\n /** Cell width as percentage */\n width?: number;\n /** Cell height as percentage */\n height?: number;\n /** Text color */\n text_color?: color;\n /** Horizontal text alignment */\n text_halign?: 'left' | 'center' | 'right';\n /** Vertical text alignment */\n text_valign?: 'top' | 'center' | 'bottom';\n /** Text size */\n text_size?: string | number;\n /** Cell background color */\n bgcolor?: color;\n /** Cell tooltip */\n tooltip?: string;\n /** Text font family */\n text_font_family?: 'default' | 'monospace';\n}\n\n// Series types for drawing objects\nexport type series_line = series<Line>;\nexport type series_box = series<Box>;\nexport type series_label = series<Label>;\nexport type series_linefill = series<Linefill>;\nexport type series_table = series<Table>;\n\n/**\n * Plot object - Represents a plot instance created by plot() function\n * @remarks\n * In PineScript, plot() returns a reference to a plot instance that can be used with fill().\n * This ID is used to reference the plot for filling between plots.\n */\nexport interface Plot {\n /** Unique identifier for this plot */\n id: string;\n /** Series being plotted */\n series: any;\n /** Plot title */\n title?: string;\n /** Plot color */\n color?: any;\n /** Line width */\n linewidth?: number;\n /** Plot style */\n style?: 'line' | 'stepline' | 'histogram' | 'area' | 'circles' | 'columns';\n /** Track price on y-axis */\n trackprice?: boolean;\n /** Histogram base level */\n histbase?: number;\n /** Offset in bars */\n offset?: number;\n /** Join gaps */\n join?: boolean;\n /** Editable in chart */\n editable?: boolean;\n /** Display mode */\n display?: 'all' | 'none';\n}\n\n/**\n * HLine object - Represents a horizontal line instance created by hline() function\n * @remarks\n * In PineScript, hline() returns a reference to an hline instance that can be used with fill().\n * This ID is used to reference the horizontal line for filling between levels.\n */\nexport interface HLine {\n /** Unique identifier for this hline */\n id: string;\n /** Price level for the horizontal line */\n price: number;\n /** Line title */\n title?: string;\n /** Line color */\n color?: any;\n /** Line style */\n linestyle?: 'solid' | 'dashed' | 'dotted';\n /** Line width */\n linewidth?: number;\n /** Editable in chart */\n editable?: boolean;\n}\n\n// Series types for plot and hline (always series qualifier in PineScript)\nexport type series_plot = Plot;\nexport type series_hline = HLine;\n\n// Excluded types (StrategyEntry, StrategyExit) - not used in calculation-only library\n\n// Bar data\nexport interface Bar {\n time: int;\n open: float;\n high: float;\n low: float;\n close: float;\n volume?: float;\n}\n\n// OHLC data type\nexport interface OHLC {\n open: series_float;\n high: series_float;\n low: series_float;\n close: series_float;\n}\n\n// Constants\nexport const na = null;\nexport type na = null;\n\n/**\n * X-axis location constants\n * Used to specify whether x-coordinates are bar indices or timestamps\n */\nexport const xloc = {\n /** X-coordinates are bar indices */\n bar_index: 'bar_index' as const,\n /** X-coordinates are UNIX timestamps in milliseconds */\n bar_time: 'bar_time' as const,\n};\n\n/**\n * ChartPoint interface - Represents a point on the chart\n * @remarks\n * A chart point can have time, index, and price coordinates.\n * At least one of time or index should be provided for x-coordinate positioning.\n */\nexport interface ChartPoint {\n /** UNIX timestamp in milliseconds (null if using bar index) */\n readonly time: number | null;\n /** Bar index (null if using time) */\n readonly index: number | null;\n /** Y-axis price value */\n readonly price: number;\n}\n\n/**\n * Polyline interface - Represents a polyline on the chart\n * @remarks\n * A polyline connects multiple chart points with line segments.\n * When closed, it forms a polygon that can be filled with color.\n */\nexport interface Polyline {\n /** Unique identifier for this polyline */\n readonly id: string;\n /** Array of chart points that define the polyline */\n readonly points: readonly ChartPoint[];\n /** If true, use curved line segments (not yet supported - uses straight lines) */\n readonly curved: boolean;\n /** If true, connect the first point to the last point */\n readonly closed: boolean;\n /** X-coordinate mode: 'bar_index' or 'bar_time' */\n readonly xloc: 'bar_index' | 'bar_time';\n /** Color of line segments */\n readonly line_color: color;\n /** Fill color for closed polylines (null for no fill) */\n readonly fill_color: color | null;\n /** Line style */\n readonly line_style: 'solid' | 'dotted' | 'dashed';\n /** Line width in pixels */\n readonly line_width: number;\n /** Force display on main pane */\n readonly force_overlay: boolean;\n}\n\n// Series types for chart point and polyline\nexport type series_chartpoint = series<ChartPoint>;\nexport type series_polyline = series<Polyline>;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * Core types for OakScriptJS\n * These types mirror the PineScript type system\n */\n\n// Basic types\nexport type int = number;\nexport type float = number;\nexport type bool = boolean;\n//export type string = string;\nexport type color = string | number;\n\n// Series types - In PineScript, series are time-series arrays\nexport type series<T> = T[];\nexport type series_int = series<int>;\nexport type series_float = series<float>;\nexport type series_bool = series<bool>;\nexport type series_string = series<string>;\nexport type series_color = series<color>;\n\n// Simple types (non-series)\nexport type simple_int = int;\nexport type simple_float = float;\nexport type simple_bool = bool;\nexport type simple_string = string;\nexport type simple_color = color;\n\n// Input types\nexport type input_int = int;\nexport type input_float = float;\nexport type input_bool = bool;\nexport type input_string = string;\nexport type input_color = color;\n\n// Const types (compile-time constants)\nexport type const_int = int;\nexport type const_float = float;\nexport type const_bool = bool;\nexport type const_string = string;\nexport type const_color = color;\n\n// Source types for indicators\nexport type Source = series_float;\n\n// Array types\n// PineScript arrays are JS arrays; aliased for API parity and future extension.\nexport type PineArray<T> = Array<T>;\n\n// Map types\n// PineScript maps are JS Maps: keys in insertion order, exact key equality.\nexport type PineMapKey = number | string | boolean;\nexport type PineMap<K extends PineMapKey, V> = Map<K, V>;\n\n// Matrix types\nexport interface PineMatrix<T> {\n rows: int;\n columns: int;\n data: T[][];\n}\n\n// Drawing object types - Now implemented for computational use!\n// While primarily used for visualization in PineScript, these objects have computational value:\n// - line.get_price() for trend analysis\n// - box getters for gap detection and range breakouts\n\n/**\n * Line object - Represents a line on the chart\n * @remarks\n * While lines are visual in PineScript, line.get_price() provides computational value\n * for detecting trend line breakouts, calculating support/resistance levels, etc.\n */\nexport interface Line {\n /** First point's x coordinate (bar index or UNIX timestamp) */\n x1: number;\n /** First point's y coordinate (price level) */\n y1: number;\n /** Second point's x coordinate (bar index or UNIX timestamp) */\n x2: number;\n /** Second point's y coordinate (price level) */\n y2: number;\n /** X-axis coordinate system */\n xloc: 'bar_index' | 'bar_time';\n /** Extension mode */\n extend: 'none' | 'left' | 'right' | 'both';\n /** Line color (stored but not used for calculations) */\n color?: color;\n /** Line style (stored but not used for calculations) */\n style?: 'solid' | 'dotted' | 'dashed' | 'arrow_left' | 'arrow_right' | 'arrow_both';\n /** Line width in pixels (stored but not used for calculations) */\n width?: number;\n /** Display on the main chart pane (PineScript force_overlay) */\n force_overlay?: boolean;\n}\n\n/**\n * Box object - Represents a rectangular area on the chart\n * @remarks\n * Box getters (get_top, get_bottom, get_left, get_right) enable gap detection,\n * range breakout analysis, and consolidation zone identification.\n */\nexport interface Box {\n /** Left border x coordinate (bar index or UNIX timestamp) */\n left: number;\n /** Top border y coordinate (price level) */\n top: number;\n /** Right border x coordinate (bar index or UNIX timestamp) */\n right: number;\n /** Bottom border y coordinate (price level) */\n bottom: number;\n /** X-axis coordinate system */\n xloc: 'bar_index' | 'bar_time';\n /** Horizontal extension mode */\n extend: 'none' | 'left' | 'right' | 'both';\n /** Border color (stored but not used for calculations) */\n border_color?: color;\n /** Border width in pixels (stored but not used for calculations) */\n border_width?: number;\n /** Border style (stored but not used for calculations) */\n border_style?: 'solid' | 'dotted' | 'dashed';\n /** Background fill color (stored but not used for calculations) */\n bgcolor?: color;\n /** Text content displayed in the box */\n text?: string;\n /** Text size */\n text_size?: string | number;\n /** Text color */\n text_color?: color;\n /** Horizontal text alignment */\n text_halign?: 'left' | 'center' | 'right';\n /** Vertical text alignment */\n text_valign?: 'top' | 'center' | 'bottom';\n /** Text wrapping mode */\n text_wrap?: 'none' | 'auto';\n /** Text font family */\n text_font_family?: 'default' | 'monospace';\n /** Text formatting flags: 0 none, 1 bold, 2 italic, 3 bold + italic (PineScript text.format_*) */\n text_formatting?: number;\n /** Display on the main chart pane (PineScript force_overlay) */\n force_overlay?: boolean;\n}\n\n/**\n * Label object - Represents a label/annotation on the chart\n * @remarks\n * Labels have limited computational value. Primarily used for marking points and displaying text.\n */\nexport interface Label {\n /** X coordinate (bar index or UNIX timestamp) */\n x: number;\n /** Y coordinate (price level when yloc = 'price') */\n y: number;\n /** X-axis coordinate system */\n xloc: 'bar_index' | 'bar_time';\n /** Y-axis positioning mode */\n yloc: 'price' | 'abovebar' | 'belowbar';\n /** Label text content */\n text?: string;\n /** Tooltip text shown on hover */\n tooltip?: string;\n /** Border and arrow color */\n color?: color;\n /** Label style */\n style?: 'none' | 'xcross' | 'cross' | 'triangleup' | 'triangledown' | 'flag' | 'circle' |\n 'arrowup' | 'arrowdown' | 'label_up' | 'label_down' | 'label_left' | 'label_right' |\n 'label_lower_left' | 'label_lower_right' | 'label_upper_left' | 'label_upper_right' |\n 'label_center' | 'square' | 'diamond' | 'text_outline';\n /** Text color */\n textcolor?: color;\n /** Label size */\n size?: string | number;\n /** Text alignment */\n textalign?: 'left' | 'center' | 'right';\n /** Text font family */\n text_font_family?: 'default' | 'monospace';\n /** Text formatting flags: 0 none, 1 bold, 2 italic, 3 bold + italic (PineScript text.format_*) */\n text_formatting?: number;\n /** Display on the main chart pane (PineScript force_overlay) */\n force_overlay?: boolean;\n}\n\n/**\n * Linefill object - Represents a filled area between two lines\n * @remarks\n * Minimal computational value. Used to fill channel areas visually.\n */\nexport interface Linefill {\n /** First line reference */\n line1: Line;\n /** Second line reference */\n line2: Line;\n /** Fill color */\n color?: color;\n}\n\n/**\n * Table object - Represents a table for displaying data\n * @remarks\n * Tables have NO computational value (no getter functions in PineScript).\n * Purely for display/visualization purposes.\n */\nexport interface Table {\n /** Table position on chart */\n position: 'top_left' | 'top_center' | 'top_right' |\n 'middle_left' | 'middle_center' | 'middle_right' |\n 'bottom_left' | 'bottom_center' | 'bottom_right';\n /** Number of columns */\n columns: number;\n /** Number of rows */\n rows: number;\n /** Outer frame color */\n frame_color?: color;\n /** Outer frame width */\n frame_width?: number;\n /** Cell border color */\n border_color?: color;\n /** Cell border width */\n border_width?: number;\n /** Table background color */\n bgcolor?: color;\n /** Display on the main chart pane (PineScript force_overlay) */\n force_overlay?: boolean;\n /** Cells by \"column,row\" */\n cells?: Map<string, TableCell>;\n /** Merged cell ranges (PineScript table.merge_cells) */\n merges?: TableMerge[];\n}\n\n/**\n * Merged cell range of a table\n */\nexport interface TableMerge {\n start_column: number;\n start_row: number;\n end_column: number;\n end_row: number;\n}\n\n/**\n * Table cell data\n */\nexport interface TableCell {\n /** Cell text content */\n text?: string;\n /** Cell width as percentage */\n width?: number;\n /** Cell height as percentage */\n height?: number;\n /** Text color */\n text_color?: color;\n /** Horizontal text alignment */\n text_halign?: 'left' | 'center' | 'right';\n /** Vertical text alignment */\n text_valign?: 'top' | 'center' | 'bottom';\n /** Text size */\n text_size?: string | number;\n /** Cell background color */\n bgcolor?: color;\n /** Cell tooltip */\n tooltip?: string;\n /** Text font family */\n text_font_family?: 'default' | 'monospace';\n /** Text formatting flags: 0 none, 1 bold, 2 italic, 3 bold + italic (PineScript text.format_*) */\n text_formatting?: number;\n}\n\n// Series types for drawing objects\nexport type series_line = series<Line>;\nexport type series_box = series<Box>;\nexport type series_label = series<Label>;\nexport type series_linefill = series<Linefill>;\nexport type series_table = series<Table>;\n\n/**\n * Plot object - Represents a plot instance created by plot() function\n * @remarks\n * In PineScript, plot() returns a reference to a plot instance that can be used with fill().\n * This ID is used to reference the plot for filling between plots.\n */\nexport interface Plot {\n /** Unique identifier for this plot */\n id: string;\n /** Series being plotted */\n series: any;\n /** Plot title */\n title?: string;\n /** Plot color */\n color?: any;\n /** Line width */\n linewidth?: number;\n /** Plot style */\n style?: 'line' | 'stepline' | 'histogram' | 'area' | 'circles' | 'columns';\n /** Track price on y-axis */\n trackprice?: boolean;\n /** Histogram base level */\n histbase?: number;\n /** Offset in bars */\n offset?: number;\n /** Join gaps */\n join?: boolean;\n /** Editable in chart */\n editable?: boolean;\n /** Display mode */\n display?: 'all' | 'none';\n}\n\n/**\n * HLine object - Represents a horizontal line instance created by hline() function\n * @remarks\n * In PineScript, hline() returns a reference to an hline instance that can be used with fill().\n * This ID is used to reference the horizontal line for filling between levels.\n */\nexport interface HLine {\n /** Unique identifier for this hline */\n id: string;\n /** Price level for the horizontal line */\n price: number;\n /** Line title */\n title?: string;\n /** Line color */\n color?: any;\n /** Line style */\n linestyle?: 'solid' | 'dashed' | 'dotted';\n /** Line width */\n linewidth?: number;\n /** Editable in chart */\n editable?: boolean;\n}\n\n// Series types for plot and hline (always series qualifier in PineScript)\nexport type series_plot = Plot;\nexport type series_hline = HLine;\n\n// Excluded types (StrategyEntry, StrategyExit) - not used in calculation-only library\n\n// Bar data\nexport interface Bar {\n time: int;\n open: float;\n high: float;\n low: float;\n close: float;\n volume?: float;\n}\n\n// OHLC data type\nexport interface OHLC {\n open: series_float;\n high: series_float;\n low: series_float;\n close: series_float;\n}\n\n// Constants\nexport const na = null;\nexport type na = null;\n\n/**\n * X-axis location constants\n * Used to specify whether x-coordinates are bar indices or timestamps\n */\nexport const xloc = {\n /** X-coordinates are bar indices */\n bar_index: 'bar_index' as const,\n /** X-coordinates are UNIX timestamps in milliseconds */\n bar_time: 'bar_time' as const,\n};\n\n/**\n * Table position constants (PineScript `position.*`), for `table.new` and `table.set_position`\n */\nexport const position = {\n top_left: 'top_left' as const,\n top_center: 'top_center' as const,\n top_right: 'top_right' as const,\n middle_left: 'middle_left' as const,\n middle_center: 'middle_center' as const,\n middle_right: 'middle_right' as const,\n bottom_left: 'bottom_left' as const,\n bottom_center: 'bottom_center' as const,\n bottom_right: 'bottom_right' as const,\n};\n\n/**\n * ChartPoint interface - Represents a point on the chart\n * @remarks\n * A chart point can have time, index, and price coordinates.\n * At least one of time or index should be provided for x-coordinate positioning.\n */\nexport interface ChartPoint {\n /** UNIX timestamp in milliseconds (null if using bar index) */\n readonly time: number | null;\n /** Bar index (null if using time) */\n readonly index: number | null;\n /** Y-axis price value */\n readonly price: number;\n}\n\n/**\n * Polyline interface - Represents a polyline on the chart\n * @remarks\n * A polyline connects multiple chart points with line segments.\n * When closed, it forms a polygon that can be filled with color.\n */\nexport interface Polyline {\n /** Unique identifier for this polyline */\n readonly id: string;\n /** Array of chart points that define the polyline */\n readonly points: readonly ChartPoint[];\n /** If true, use curved line segments (not yet supported - uses straight lines) */\n readonly curved: boolean;\n /** If true, connect the first point to the last point */\n readonly closed: boolean;\n /** X-coordinate mode: 'bar_index' or 'bar_time' */\n readonly xloc: 'bar_index' | 'bar_time';\n /** Color of line segments */\n readonly line_color: color;\n /** Fill color for closed polylines (null for no fill) */\n readonly fill_color: color | null;\n /** Line style */\n readonly line_style: 'solid' | 'dotted' | 'dashed';\n /** Line width in pixels */\n readonly line_width: number;\n /** Force display on main pane */\n readonly force_overlay: boolean;\n}\n\n// Series types for chart point and polyline\nexport type series_chartpoint = series<ChartPoint>;\nexport type series_polyline = series<Polyline>;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiWO,MAAM,KAAK;AAOX,MAAM,OAAO;AAAA;AAAA,EAElB,WAAW;AAAA;AAAA,EAEX,UAAU;AACZ;AAKO,MAAM,WAAW;AAAA,EACtB,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,aAAa;AAAA,EACb,eAAe;AAAA,EACf,cAAc;AAAA,EACd,aAAa;AAAA,EACb,eAAe;AAAA,EACf,cAAc;AAChB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -207,43 +207,70 @@ export interface FillGradient {
|
|
|
207
207
|
bottomColor: Array<string | null>;
|
|
208
208
|
}
|
|
209
209
|
/**
|
|
210
|
-
* Marker location on the chart (PineScript plotshape/plotchar
|
|
210
|
+
* Marker location on the chart (PineScript plotshape/plotchar `location.*`)
|
|
211
211
|
*/
|
|
212
212
|
export type MarkerLocation = 'abovebar' | 'belowbar' | 'top' | 'bottom' | 'absolute';
|
|
213
|
+
/**
|
|
214
|
+
* PineScript size constant (`size.auto`, `size.tiny`, ...)
|
|
215
|
+
*/
|
|
216
|
+
export type PineSize = 'auto' | 'tiny' | 'small' | 'normal' | 'large' | 'huge';
|
|
213
217
|
/**
|
|
214
218
|
* Marker size (PineScript size.* constants)
|
|
215
219
|
*/
|
|
216
|
-
export type MarkerSize =
|
|
220
|
+
export type MarkerSize = PineSize;
|
|
217
221
|
/**
|
|
218
222
|
* Shape style (PineScript shape.* constants)
|
|
219
223
|
*/
|
|
220
224
|
export type ShapeStyle = 'xcross' | 'cross' | 'triangleup' | 'triangledown' | 'flag' | 'circle' | 'arrowup' | 'arrowdown' | 'labelup' | 'labeldown' | 'square' | 'diamond';
|
|
221
225
|
/**
|
|
222
|
-
*
|
|
226
|
+
* Position of a marker:
|
|
227
|
+
* - aboveBar / belowBar / inBar: next to the bar (PineScript location.abovebar / location.belowbar)
|
|
228
|
+
* - atPriceTop / atPriceBottom / atPriceMiddle: at `price` (PineScript location.absolute), with the meaning of the
|
|
229
|
+
* lightweight-charts price positions: atPriceTop has the shape above the price, its bottom (the tip of a label) on
|
|
230
|
+
* the price (shape.labeldown); atPriceBottom has the shape below the price, its top on the price (shape.labelup);
|
|
231
|
+
* atPriceMiddle centres the shape on the price (other shapes)
|
|
232
|
+
* - top / bottom: at the top / bottom edge of the pane of the indicator (PineScript location.top / location.bottom),
|
|
233
|
+
* the price pane for an overlay indicator or with forceOverlay
|
|
234
|
+
*/
|
|
235
|
+
export type MarkerPosition = 'aboveBar' | 'belowBar' | 'inBar' | 'atPriceTop' | 'atPriceBottom' | 'atPriceMiddle' | 'top' | 'bottom';
|
|
236
|
+
/**
|
|
237
|
+
* Marker shape (PineScript shape.* in the lightweight-charts spelling)
|
|
238
|
+
*/
|
|
239
|
+
export type MarkerShape = 'arrowUp' | 'arrowDown' | 'circle' | 'square' | 'labelUp' | 'labelDown' | 'triangleUp' | 'triangleDown' | 'cross' | 'xcross' | 'diamond' | 'flag';
|
|
240
|
+
/**
|
|
241
|
+
* One marker: a plotshape()/plotchar() marker on a bar where the condition held, or a marker of a built-in indicator
|
|
223
242
|
*/
|
|
224
243
|
export interface MarkerData {
|
|
225
244
|
/** Time of the bar the marker is displayed on (offset already applied) */
|
|
226
|
-
time:
|
|
227
|
-
/**
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
|
|
231
|
-
/** Shape
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
245
|
+
time: number;
|
|
246
|
+
/** Where the marker is drawn */
|
|
247
|
+
position: MarkerPosition;
|
|
248
|
+
/** Price of the atPrice* positions (required with them) */
|
|
249
|
+
price?: number;
|
|
250
|
+
/** Shape. A plotchar marker also has `char`: the character is drawn in place of the shape */
|
|
251
|
+
shape: MarkerShape;
|
|
252
|
+
/**
|
|
253
|
+
* Shape colour (the character colour of a plotchar marker). A fully transparent colour ('transparent',
|
|
254
|
+
* '#rrggbb00', 'rgba(r, g, b, 0)') draws no shape, as PineScript `color = na`; the text is still drawn
|
|
255
|
+
*/
|
|
256
|
+
color: string;
|
|
257
|
+
/** Text; a line feed starts a new line */
|
|
238
258
|
text?: string;
|
|
239
|
-
/**
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
259
|
+
/**
|
|
260
|
+
* Text colour (PineScript textcolor). When omitted: white inside label shapes (labelUp / labelDown), the shape
|
|
261
|
+
* colour for the other shapes
|
|
262
|
+
*/
|
|
263
|
+
textColor?: string;
|
|
264
|
+
/** Size multiplier (1 = default size) or a PineScript size */
|
|
265
|
+
size?: number | PineSize;
|
|
266
|
+
/** PineScript force_overlay = true: the marker of a non-overlay indicator is drawn on the price pane */
|
|
267
|
+
forceOverlay?: boolean;
|
|
268
|
+
/** Id of the plotshape/plotchar declaration that produced it (script markers) */
|
|
269
|
+
id?: string;
|
|
270
|
+
/** plotchar character, drawn in place of the shape */
|
|
271
|
+
char?: string;
|
|
272
|
+
/** Hover tooltip */
|
|
244
273
|
tooltip?: string;
|
|
245
|
-
/** Price for location 'absolute' (the series value on that bar) */
|
|
246
|
-
price?: number;
|
|
247
274
|
}
|
|
248
275
|
/**
|
|
249
276
|
* Per-bar arrow from plotarrow(): up arrow for a positive value, down arrow for a negative value
|
|
@@ -259,14 +286,203 @@ export interface ArrowData {
|
|
|
259
286
|
color: string;
|
|
260
287
|
}
|
|
261
288
|
/**
|
|
262
|
-
* Per-bar color
|
|
289
|
+
* Per-bar candle color (barcolor() output)
|
|
263
290
|
*/
|
|
264
291
|
export interface BarColorData {
|
|
265
292
|
/** Time of the colored bar (offset already applied) */
|
|
266
|
-
time:
|
|
293
|
+
time: number;
|
|
267
294
|
/** Color */
|
|
268
295
|
color: string;
|
|
269
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Per-bar background color (bgcolor() output)
|
|
299
|
+
*/
|
|
300
|
+
export interface BgColorData {
|
|
301
|
+
/** Time of the colored bar (offset already applied) */
|
|
302
|
+
time: number;
|
|
303
|
+
/** Color (with its transparency) */
|
|
304
|
+
color: string;
|
|
305
|
+
/** PineScript bgcolor(..., force_overlay = true): drawn on the price pane even for a non-overlay indicator */
|
|
306
|
+
forceOverlay?: boolean;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* One candle of plotcandle() (or of a built-in indicator that draws candles)
|
|
310
|
+
*/
|
|
311
|
+
export interface PlotCandleData {
|
|
312
|
+
time: number;
|
|
313
|
+
open: number;
|
|
314
|
+
high: number;
|
|
315
|
+
low: number;
|
|
316
|
+
close: number;
|
|
317
|
+
/** Body colour */
|
|
318
|
+
color?: string;
|
|
319
|
+
borderColor?: string;
|
|
320
|
+
wickColor?: string;
|
|
321
|
+
/** PineScript force_overlay = true: the candles of a non-overlay indicator are drawn on the price pane */
|
|
322
|
+
forceOverlay?: boolean;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* One bar of plotbar(): an OHLC bar (a vertical line from low to high, the open tick on the left, the close tick on
|
|
326
|
+
* the right)
|
|
327
|
+
*/
|
|
328
|
+
export interface PlotBarData {
|
|
329
|
+
time: number;
|
|
330
|
+
open: number;
|
|
331
|
+
high: number;
|
|
332
|
+
low: number;
|
|
333
|
+
close: number;
|
|
334
|
+
color?: string;
|
|
335
|
+
/** PineScript force_overlay = true: the bars of a non-overlay indicator are drawn on the price pane */
|
|
336
|
+
forceOverlay?: boolean;
|
|
337
|
+
}
|
|
338
|
+
/** PineScript label style (`label.style_*` without the prefix) */
|
|
339
|
+
export type LabelStyle = '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';
|
|
340
|
+
/**
|
|
341
|
+
* A label (PineScript label.new)
|
|
342
|
+
*/
|
|
343
|
+
export interface LabelData {
|
|
344
|
+
time: number;
|
|
345
|
+
/** Price; not used with yloc 'abovebar' / 'belowbar' */
|
|
346
|
+
price: number;
|
|
347
|
+
text: string;
|
|
348
|
+
/** Background, border and arrow colour */
|
|
349
|
+
color?: string;
|
|
350
|
+
textColor?: string;
|
|
351
|
+
/** 'none': text only, no background (PineScript label.style_none) */
|
|
352
|
+
style?: LabelStyle;
|
|
353
|
+
size?: PineSize | number;
|
|
354
|
+
/**
|
|
355
|
+
* PineScript yloc: 'price' (default) places the label at `price`; 'abovebar' / 'belowbar' place it above the bar
|
|
356
|
+
* high / below the bar low and ignore `price` (the renderer reads the bar at `time`).
|
|
357
|
+
*/
|
|
358
|
+
yloc?: 'price' | 'abovebar' | 'belowbar';
|
|
359
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
360
|
+
tooltip?: string;
|
|
361
|
+
fontFamily?: 'default' | 'monospace';
|
|
362
|
+
/** PineScript text.format_* flags: 0 none, 1 bold, 2 italic, 3 bold + italic */
|
|
363
|
+
textFormatting?: number;
|
|
364
|
+
/** PineScript force_overlay = true: the label of a non-overlay indicator is drawn on the price pane */
|
|
365
|
+
forceOverlay?: boolean;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* A line (PineScript line.new)
|
|
369
|
+
*/
|
|
370
|
+
export interface LineDrawingData {
|
|
371
|
+
time1: number;
|
|
372
|
+
price1: number;
|
|
373
|
+
time2: number;
|
|
374
|
+
price2: number;
|
|
375
|
+
color?: string;
|
|
376
|
+
width?: number;
|
|
377
|
+
style?: 'solid' | 'dashed' | 'dotted' | 'arrow_left' | 'arrow_right' | 'arrow_both';
|
|
378
|
+
extend?: 'none' | 'left' | 'right' | 'both';
|
|
379
|
+
/** PineScript force_overlay = true: the line of a non-overlay indicator is drawn on the price pane */
|
|
380
|
+
forceOverlay?: boolean;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* A rectangle (PineScript box.new): time1 / price1 are the left / top, time2 / price2 the right / bottom
|
|
384
|
+
*/
|
|
385
|
+
export interface BoxData {
|
|
386
|
+
time1: number;
|
|
387
|
+
price1: number;
|
|
388
|
+
time2: number;
|
|
389
|
+
price2: number;
|
|
390
|
+
bgColor?: string;
|
|
391
|
+
borderColor?: string;
|
|
392
|
+
borderWidth?: number;
|
|
393
|
+
borderStyle?: 'solid' | 'dashed' | 'dotted';
|
|
394
|
+
text?: string;
|
|
395
|
+
textColor?: string;
|
|
396
|
+
textSize?: PineSize | number;
|
|
397
|
+
textHAlign?: 'left' | 'center' | 'right';
|
|
398
|
+
textVAlign?: 'top' | 'center' | 'bottom';
|
|
399
|
+
textWrap?: 'none' | 'auto';
|
|
400
|
+
fontFamily?: 'default' | 'monospace';
|
|
401
|
+
/** PineScript text.format_* flags: 0 none, 1 bold, 2 italic, 3 bold + italic */
|
|
402
|
+
textFormatting?: number;
|
|
403
|
+
/** PineScript box extend: the box continues to the left / right edge of the chart */
|
|
404
|
+
extend?: 'none' | 'left' | 'right' | 'both';
|
|
405
|
+
/** PineScript force_overlay = true: the box of a non-overlay indicator is drawn on the price pane */
|
|
406
|
+
forceOverlay?: boolean;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* The area between two lines (PineScript linefill.new), with the two lines as drawn (their extend included)
|
|
410
|
+
*/
|
|
411
|
+
export interface LinefillData {
|
|
412
|
+
line1: LineDrawingData;
|
|
413
|
+
line2: LineDrawingData;
|
|
414
|
+
color?: string;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* A polyline (PineScript polyline.new)
|
|
418
|
+
*/
|
|
419
|
+
export interface PolylineData {
|
|
420
|
+
points: Array<{
|
|
421
|
+
time: number;
|
|
422
|
+
price: number;
|
|
423
|
+
}>;
|
|
424
|
+
/** Curved segments between the points */
|
|
425
|
+
curved?: boolean;
|
|
426
|
+
/** The last point is connected to the first */
|
|
427
|
+
closed?: boolean;
|
|
428
|
+
lineColor?: string;
|
|
429
|
+
/** Fill of the area inside the polyline */
|
|
430
|
+
fillColor?: string;
|
|
431
|
+
lineStyle?: 'solid' | 'dotted' | 'dashed' | 'arrow_left' | 'arrow_right' | 'arrow_both';
|
|
432
|
+
lineWidth?: number;
|
|
433
|
+
/** PineScript force_overlay = true: the polyline of a non-overlay indicator is drawn on the price pane */
|
|
434
|
+
forceOverlay?: boolean;
|
|
435
|
+
}
|
|
436
|
+
/** Table position (PineScript position.*) */
|
|
437
|
+
export type TablePosition = 'top_left' | 'top_center' | 'top_right' | 'middle_left' | 'middle_center' | 'middle_right' | 'bottom_left' | 'bottom_center' | 'bottom_right';
|
|
438
|
+
/**
|
|
439
|
+
* A table cell (PineScript table.cell)
|
|
440
|
+
*/
|
|
441
|
+
export interface TableCellData {
|
|
442
|
+
row: number;
|
|
443
|
+
column: number;
|
|
444
|
+
text: string;
|
|
445
|
+
bgColor?: string;
|
|
446
|
+
textColor?: string;
|
|
447
|
+
textSize?: PineSize | number;
|
|
448
|
+
/** Width in % of the chart width; 0 fits the text */
|
|
449
|
+
width?: number;
|
|
450
|
+
/** Height in % of the chart height; 0 fits the text */
|
|
451
|
+
height?: number;
|
|
452
|
+
textHAlign?: 'left' | 'center' | 'right';
|
|
453
|
+
textVAlign?: 'top' | 'center' | 'bottom';
|
|
454
|
+
tooltip?: string;
|
|
455
|
+
fontFamily?: 'default' | 'monospace';
|
|
456
|
+
/** PineScript text.format_* flags: 0 none, 1 bold, 2 italic, 3 bold + italic */
|
|
457
|
+
textFormatting?: number;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Merged cells of a table (PineScript table.merge_cells): the cell at the start column / row covers the range and
|
|
461
|
+
* gives its content
|
|
462
|
+
*/
|
|
463
|
+
export interface TableMergeData {
|
|
464
|
+
startColumn: number;
|
|
465
|
+
startRow: number;
|
|
466
|
+
endColumn: number;
|
|
467
|
+
endRow: number;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* A table (PineScript table.new)
|
|
471
|
+
*/
|
|
472
|
+
export interface TableData {
|
|
473
|
+
position: TablePosition;
|
|
474
|
+
columns: number;
|
|
475
|
+
rows: number;
|
|
476
|
+
cells: TableCellData[];
|
|
477
|
+
merges?: TableMergeData[];
|
|
478
|
+
bgColor?: string;
|
|
479
|
+
frameColor?: string;
|
|
480
|
+
frameWidth?: number;
|
|
481
|
+
borderColor?: string;
|
|
482
|
+
borderWidth?: number;
|
|
483
|
+
/** PineScript force_overlay = true: the table of a non-overlay indicator is drawn on the price pane */
|
|
484
|
+
forceOverlay?: boolean;
|
|
485
|
+
}
|
|
270
486
|
/**
|
|
271
487
|
* Complete indicator calculation result
|
|
272
488
|
*/
|
|
@@ -284,9 +500,25 @@ export interface IndicatorResult {
|
|
|
284
500
|
/** Arrows from plotarrow() */
|
|
285
501
|
arrows?: ArrowData[];
|
|
286
502
|
/** Background colors from bgcolor() */
|
|
287
|
-
|
|
503
|
+
bgColors?: BgColorData[];
|
|
288
504
|
/** Bar colors from barcolor() */
|
|
289
|
-
|
|
505
|
+
barColors?: BarColorData[];
|
|
506
|
+
/** Candles from plotcandle(), keyed by plotcandle id */
|
|
507
|
+
plotCandles?: Record<string, PlotCandleData[]>;
|
|
508
|
+
/** OHLC bars from plotbar(), keyed by plotbar id */
|
|
509
|
+
plotBars?: Record<string, PlotBarData[]>;
|
|
510
|
+
/** Labels alive after the last bar */
|
|
511
|
+
labels?: LabelData[];
|
|
512
|
+
/** Lines alive after the last bar */
|
|
513
|
+
lines?: LineDrawingData[];
|
|
514
|
+
/** Boxes alive after the last bar */
|
|
515
|
+
boxes?: BoxData[];
|
|
516
|
+
/** Linefills alive after the last bar */
|
|
517
|
+
linefills?: LinefillData[];
|
|
518
|
+
/** Polylines alive after the last bar */
|
|
519
|
+
polylines?: PolylineData[];
|
|
520
|
+
/** Tables alive after the last bar */
|
|
521
|
+
tables?: TableData[];
|
|
290
522
|
}
|
|
291
523
|
/**
|
|
292
524
|
* Indicator factory function type
|