---
title: "Write it with AI"
description: "Any AI assistant can write wrun. It is TypeScript syntax, which assistants have read a great deal of, and the editor's compiler checks every draft before…"
order: 4
section: "getting-started"
---

<!-- source: docs/indicators/getting-started/write-with-ai.md; generated by packages/cli/scripts/gen-indicator-docs.ts, do not edit -->

# Write it with AI

**Any AI assistant can write wrun.** It is TypeScript syntax, which
assistants have read a great deal of, and the editor's compiler checks
every draft before anything runs.

## The loop

![The AI loop: you describe your idea to any AI assistant together with Copy for LLM from the editor; you paste the file it writes into the editor and press Run; if the compiler names errors, Copy for LLM sends the code and every error back; when it compiles, it draws on your chart](/wrun/images/diagrams/ai-loop.svg)

1. **Open a tab.** In the editor, press **New indicator**, or open the
   indicator you want to change.
2. **Copy for LLM.** Right-click the editor tab and pick **Copy for LLM**.
   One paste carries the language rules, the kit's API, your numbered code,
   every error and your last run.
3. **Ask.** Paste it into any assistant and say what you want, naming
   everything it should draw (an example is below).
4. **Run.** Put the complete file it returns into the tab and press
   **Run**. The compiler names every mistake with a line and column.
5. **Repeat until it compiles.** Copy for LLM again and paste it back. When
   it compiles, it draws on your chart.

## Better results

A request that names everything it wants drawn:

```text
An RSI(14) in its own pane with bands at 30 and 70, a dot on every cross
back inside the bands, and an alert on each cross.
```

- **Name everything you want drawn.** Assistants keep the lines and tend to
  drop labels, per-bar colors, fills, boxes, tables and alerts. List them in your
  request, then check the legend and the chart against it.
- **Build long scripts in parts.** A few hundred lines can outgrow one
  answer. Ask for the settings and the plotted lines first and press
  **Run**; then ask for the drawings, then the alerts, each time with a
  fresh Copy for LLM.
- **Check the numbers before you publish.** Compare the result with a
  version you trust, on the same market and timeframe.

## Porting from Pine

Paste your Pine script with a **Copy for LLM** and ask for a port; the
loop above takes it from there.
[wrun vs Pine](wrun-vs-pine.md#bring-your-pine-scripts) shows one
indicator in both languages, line for line.
