Every method of client.template in the JavaScript SDK.
apply#
Apply a template · tool template_apply
Applies a saved template — or blank, no studies — to a chart or every chart of its workbench, as the templates menu does; what could not be applied is said, one line each. Answers the chart and those lines.
Declaration
client.template
apply(args: { chart: string; all_charts?: boolean; blank?: boolean; name?: string }): Promise<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
chart | string | required | |
all_charts | boolean | optional | Onto every chart of the chart's workbench, as the menu's All switch. |
blank | boolean | optional | |
name | string | optional | The template's name; absent with blank, which takes every study off. |
Returns
Promise<any> — the tool’s answer as a plain object.
What it answers
Answers the chart and those lines.
Example
await client.template.apply({ chart })delete#
Delete a template · tool template_delete
Deletes a saved template, as its row's x and the confirmation do — only with confirm; without it the answer names what would be deleted. Answers the templates.
Declaration
client.template
delete(args: { name: string; confirm?: boolean }): Promise<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
name | string | required | |
confirm | boolean | optional | Without it nothing is deleted and the answer says what would be. |
Returns
Promise<any> — the tool’s answer as a plain object.
What it answers
Answers the templates.
Example
await client.template.delete({ name: "…" })rename#
Rename a template · tool template_rename
Renames a saved template, as its gear's Rename does. Answers the templates.
Declaration
client.template
rename(args: { name: string; to: string }): Promise<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
name | string | required | |
to | string | required |
Returns
Promise<any> — the tool’s answer as a plain object.
What it answers
Answers the templates.
Example
await client.template.rename({ name: "…", to: "…" })save#
Save a template · tool template_save
Saves a chart's studies — and its type and look with with_type — as a named template, as the templates menu's Save does; a name taken or unusable is refused in its words. Answers the templates.
Declaration
client.template
save(args: { chart: string; name: string; with_type?: boolean }): Promise<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
chart | string | required | The chart whose studies (and, with with_type, type and look) become the template. |
name | string | required | |
with_type | boolean | optional | The chart's type and look saved with its studies. |
Returns
Promise<any> — the tool’s answer as a plain object.
What it answers
Answers the templates.
Example
await client.template.save({ chart, name: "…" })setDefault#
Set an interval's default template · tool template_set_default
Makes a template the one a new chart of an interval opens with, or takes the default off an interval or off every interval a template is the default of, as the template gear's choices do. Answers the templates.
Declaration
client.template
setDefault(args: { clear_all?: boolean; interval?: string; name?: string }): Promise<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
clear_all | boolean | optional | Every interval this template is the default of loses it. |
interval | string | optional | The interval it opens with, as the menu writes it (M1, H4, D1); absent with clear_all. |
name | string | optional | The template, or absent to make the interval open with none. |
Returns
Promise<any> — the tool’s answer as a plain object.
What it answers
Answers the templates.
Example
await client.template.setDefault()