Write Pine Script® with Quant
quant_generate_pine_scriptHas Quant, our coding agent, write a Pine Script® v6 indicator or strategy from a prompt, or change one in place: the script passed as code, or one of the member's saved scripts by its script_id (the result then has a unified diff). Quant works in the background with the Pine Script® reference, checks every attempt with LuxAlgo's linter and fixes what fails, until the script passes or its time runs out. Returns the script, whether it passes the linter and what is still flagged. A script that passes is saved to the member's LuxAlgo account as one of their Quant scripts, where they find it in Vela: a new script, or with script_id a new version of that script; the result says which, with its script_id. One that does not pass yet is saved nowhere: call again with it as code (and the same script_id, if any) and what is left to fix as the prompt. With add_to_chart (off by default), a script that passes is also put on the chart the member has open right now in Vela, the one they used last, where they see it appear and run; a changed script that was on that chart already runs its new version in place. Set it only when the member asked to see it on their chart. To change an indicator that is on their chart, read the chart with vela_read_chart: one that is a saved script of theirs comes with its script_id. It uses the member's Quant usage on their LuxAlgo plan, metered by the LuxAlgo app. To only check a script the member already has, use quant_validate_pine_script, which uses no usage. It writes code; it never runs or backtests it, and it is not trading advice. Requires signing in with a LuxAlgo account (OAuth).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"prompt": "<prompt>",
"context": "<context>"
},
"name": "quant_generate_pine_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | A Pine Script® to change. Quant edits it in place instead of writing a new one. | |
| prompt | Yes | What to build or change, in plain words: the logic, inputs, plots and alerts the member wants. | |
| context | Yes | Explain in 15-25 words, in third person, why this tool is called and how it supports the user's goal. For analytics only. You MUST describe only the abstract purpose of the tool call. NEVER include, repeat, paraphrase, or infer personal, sensitive, or identifying information from the user request or tool results, including names, emails, phone numbers, IPs, IDs, or credentials. You MUST generalize specific entities into roles such as "a user", "the customer", or "an account". Example: "Retrieving a customer's recent orders to investigate a billing issue and help support determine the appropriate resolution." | |
| script_id | No | One of the member's saved scripts to change, by its id from quant_search_user_scripts. Its saved source is what Quant changes unless `code` is passed too, and a result that passes is saved as its new version. | |
| add_to_chart | No | Also put the script on the chart the member has open right now in Vela, the one they used last, once it passes and is saved. False by default: set it only when the member asked to see it on their chart. |