Reference
Write Pine with AI
Give an AI assistant these docs and Tradequix's rules, so the scripts it writes actually run here. Includes a ready prompt and a review checklist.
AI assistants write Pine well, but they write it for TradingView. They assume fundamentals exist, that volume is traded size, and that any timeframe works. Give them these docs first and those mistakes mostly disappear.
Three ways to give an assistant the docs#
- One page. Every page has Copy page, View as Markdown, Open in Claude and Open in ChatGPT. The last two start a chat that is told to read that page.
- Everything. llms-full.txt is the whole documentation as one plain-text file. The Copy all docs for AI button on the docs home puts it on your clipboard; paste it at the start of a chat.
- An index. llms.txt lists every page with a one-line summary and a link to its markdown. Tools that understand the llms.txt convention (editors, coding agents) can read it and fetch only what they need.
Any page's markdown is also at its address plus .md, for example /docs/plotting.md. The whole function reference is one markdown file too.
Install it in your coding assistant#
If you write Pine in an editor with an AI assistant, install the rules once and it follows them every time:
- Claude Code. Save SKILL.md as
.claude/skills/tradequix-pine/SKILL.mdin your project (or in~/.claude/skills/for every project). Claude uses it whenever you ask for a Tradequix indicator or paste a console error. - Cursor. Save tradequix-pine.mdc as
.cursor/rules/tradequix-pine.mdc. It applies to.pinefiles.
Both carry the same rules as the prompt below, plus links to the reference and the error index so the assistant can check before it writes.
A prompt that works#
Paste this, then describe your indicator:
You are writing Pine Script v6 for Tradequix, which runs Pine on PineTS over a live OTC candle feed. Follow these rules: - Start with //@version=6 and indicator(...) or strategy(...). - Use only price data: open, high, low, close, volume, time. Volume is a tick count, not traded size. - Do not use request.financial, request.earnings, request.dividends, request.economic or request.footprint; they return na here. - request.security works on these timeframes: 5S 10S 15S 30S 1 2 3 5 10 15 30 60 240 D. Others are aggregated; nothing below 5 seconds. - plotshape and plotchar only draw where the series is true or a non-zero number. - Do not use import; libraries are not available. - Prefer barstate.isconfirmed for signals that must not repaint. Write the complete script, then list any assumption you made.
Review what comes back#
Before you trust an AI-written script, check:
- It runs. Paste it into the editor and press Add to chart; read the console.
- It draws where you expect. Markers that never appear usually mean a
plotshapeseries that is never true. - It does not look ahead. No
close[-1], nolookahead_onon the current bar's value. - Strategy settings are realistic: commission, slippage, position size.
- Inputs have sensible
minvaland defaults.