Script assistant: an AI that writes, runs and fixes your scripts

The Assistant panel of the Scripting page writes indicators and strategies for the Senzoukria sandbox, using your own Claude API key or a local model. With Claude it can run the script in the sandbox, read the real error, apply the corrected code to the editor and search the web for a formula.

Senzoukria · Documentation · Updated September 2026


Where to find it

Where
Scripting page → "Assistant" panel next to the editor
Key
"The assistant uses your own Claude API key, stored in your operating system's keychain — never on our servers." (Groq and local models are the other choices.)
Tool rounds
At most 8 tool round-trips per question; each round is billed to your key
Attachments
4 images maximum per message (PNG, JPEG, GIF, WebP); only engines that read images accept them

What it does

The panel opens with the sentence "Describe what you want to measure or trade — it writes the script, tells you which type fits, and warns you when the indicator already exists." Four suggestions are offered: write an indicator that colours bars where delta goes against the candle, turn a script into an auto strategy with an ATR stop, explain why a script returns nothing, and which indicator already shows absorption. Each code block in an answer carries an "Insert into editor" button.

The system prompt is built from the product itself: the input contract (bars newest first, ctx with tickSize and sessionStartSec, the lib helpers), the sandbox limits, the output shapes derived from the type definitions, the orderflow conventions, an inventory of the existing indicators, worked examples and a guide to the errors the sandbox actually returns. The script open in the editor and its last error are appended at the end, so the assistant answers about your code rather than in the abstract.

Settings and controls

Controls of the Assistant panel
ControlDefaultWhat it changes
Model picker (compact)The model chosen in the AI settingsClaude with your key (reads code and the screenshots you paste, billed per message), Groq on a free key (fast, reads no screenshots, rate-limited per minute) or a local model through Ollama (free, offline, no images)
Attach a screenshotnoneAdds up to 4 images per message by button, paste or drag-and-drop; images are placed before the text
Clear conversationEmpties the thread; the system prompt is rebuilt on the next question
EnterSends; Shift+Enter inserts a newline
Reply budget4000 tokens on Claude, 2048 on a local engineLocal engines also trim the history and the prompt to fit their context window

Tools the assistant can call

Tools declared to the model when the Scripting page provides an executor
ToolWhat it doesShown as
run_scriptRuns the code in the sandbox on synthetic bars (300 by default) and reports the real error and line, logs, timing and per-series statistics such as NaN count and warm-up nullsRunning your script…
read_scriptReads the editor's current contentReading your script…
apply_scriptReplaces the editor content with tested code and a one-line summary; nothing is saved to disk and undo worksWriting to the editor…
web_search / web_fetchSearch and page reading run by the model provider, not in the script sandbox, steered toward primary sourcesSearching the web… / Reading the sources…

How to use it

Describe the measure or the rule in plain words. The assistant is instructed never to hand over code it has not run: it writes, calls run_script, reads the report, fixes and runs again, then closes with a line such as "runs in 12 ms on 300 bars, no NaN, warm-up ends at bar 14". When an indicator already exists in the catalog, it names it instead of writing a duplicate. When an idea cannot be computed from bar data, for example anything needing the live order book, it says what is possible instead.

Screenshots are useful for layout, colours and error text, but the assistant is told not to read exact prices off pixels; type a number when it matters.

Limits and pitfalls

  • The tools are declared only when the Scripting page provides an executor; announced without one, a model would call into the void. Claude, Groq and a local model are all sent the declarations, and a local model that cannot call tools reports it through its own engine error.
  • After 8 tool rounds the assistant stops and says what still fails; it does not claim a fix.
  • Strategies it writes trade the simulated evaluation account only. The prompt states that the platform places no broker orders from scripts.
  • Every message and tool round is billed to your own Anthropic key; the stable prompt prefix is designed to be cacheable to reduce that cost.

This page in other languages

Frequently asked questions

Do I need an API key to use the assistant?
For Claude, yes: your own key, stored in the operating system keychain. Groq needs its own free key. A local Ollama model needs no key and works offline, but reads no screenshots.
Does the assistant change my script without asking?
It can write into the editor through apply_script, only after run_script succeeded, and it must say what changed. Nothing is saved to disk until you save, and the editor's undo still works.
Why does it say my indicator already exists?
The prompt carries the inventory of built-in indicators. When your description matches one, the assistant names it rather than writing a duplicate.

Keep reading