pinescript-v6
v1.0.0
Published
Chunked TradingView Pine Script v6 reference for LLM agents, plus a global installer and an MCP server.
Maintainers
Readme
Pine Script v6 Reference for LLMs
Current Version: v6
Source: TradingView Pine Script™ v6 Reference Manual & Welcome to Pine Script® v6
Recent Release Coverage
The repository now explicitly surfaces the additions documented in release_notes.md:
request.footprint()and thefootprint/volume_rowtypessyminfo.isintime()/time_close()support fortimeframe_bars_back- Updated line-wrapping rules for expressions enclosed in parentheses
These updates are reflected in:
- reference/functions/request.md
- reference/functions/general.md
- reference/types.md
- reference/variables.md
- writing_scripts/style_guide.md
🤖 What is this?
This repository contains the official Pine Script v6 documentation, restructured and "chunked" specifically for Large Language Models (LLMs).
The official documentation is massive. Feeding the entire raw documentation into an LLM often confuses it or exceeds context limits, leading to hallucinations or generic v5 code. This repository breaks the documentation into logical, namespaced markdown files to improve Retrieval Augmented Generation (RAG) and Context Window efficiency.
On top of the raw docs, the repo also ships as a Claude Code plugin — a pinescript-v6 skill that auto-routes to the right file, and a pinescript-developer subagent for writing/reviewing Pine Script v6 code.
👨💻 For Humans: How to use this Repo
Option 1: Global install for any agent (recommended)
One command, no clone, works on any machine with Node 18+:
npx pinescript-v6 installThis copies the reference to ~/.pinescript-v6 and wires it into every agent that reads files:
| Agent | What it gets |
|---|---|
| Claude Code | ~/.claude/skills/pinescript-v6/ (skill) + ~/.claude/agents/pinescript-developer (subagent), available in every project |
| Codex | a managed block in ~/.codex/AGENTS.md pointing at the docs |
| Cursor / Windsurf | ~/.cursor/rules/pinescript-v6.md |
| Anything else reading a global AGENTS.md | ~/.config/AGENTS.md |
Existing content in those instruction files is preserved — only the block between
<!-- BEGIN pinescript-v6 --> and <!-- END pinescript-v6 --> is managed, and
re-running the installer updates it in place. npx pinescript-v6 uninstall removes everything.
MCP (for agents that prefer tools over files):
claude mcp add -s user pinescript-v6 -- npx -y pinescript-v6 mcp
codex mcp add pinescript-v6 -- npx -y pinescript-v6 mcpAny other MCP client: {"command": "npx", "args": ["-y", "pinescript-v6", "mcp"]}.
The server exposes three tools — pinescript_manifest (routing table, call first),
pinescript_doc (read one reference file), pinescript_search (grep the reference).
Option 2: Claude Code Plugin
This repo is self-hosting as a plugin marketplace, so no separate marketplace repo is needed.
/plugin marketplace add jabez4jc/pinescriptv6
/plugin install pinescript-v6@pinescriptv6This installs:
pinescript-v6skill — auto-triggers on Pine Script work and routes through LLM_MANIFEST.md to the correct reference file instead of relying on stale v4/v5 training data.pinescript-developeragent — a subagent specialized in writing, refactoring, debugging, and reviewing Pine Script v6 (repainting checks,var/varipcorrectness, drawing-object limits, publishing compliance).
To try it locally before pushing changes, point the marketplace at a local path instead of the GitHub repo:
/plugin marketplace add /path/to/your/local/pinescriptv6Option 3: AI Code Editors, manual setup (Cursor, Windsurf, Copilot)
If you use AI-native editors like Cursor or Windsurf:
- Clone this repository locally.
- In your chat interface, reference specific documentation based on what you are building.
- Building an indicator? Reference @functions/ta.md and @functions/drawing.md.
- Building a strategy? Reference @functions/strategy.md.
- Getting errors? Reference @concepts/common_errors.md.
Option 4: Claude Projects / Custom GPTs
- Download this repository as a ZIP.
- Upload the relevant files to your Claude Project Knowledge (YouTube Help Here) or Custom GPT Knowledge.
- Recommendation: Upload LLM_MANIFEST.md and the specific reference/ folders you use most often.
🧠 For LLMs: Usage Instructions
If you are an LLM or AI Assistant reading this file, follow these instructions:
- Entry Point: Always check LLM_MANIFEST.md first. It acts as the map for this repository.
- Modular Retrieval: Do not attempt to ingest the entire codebase at once.
- If the user asks about Functions (e.g., RSI, EMA), look in reference/functions/ta.md.
- If the user asks about Backtesting, look in reference/functions/strategy.md.
- If the user asks about Arrays or Matrices, look in reference/functions/collections.md.
- Syntax Version: Enforce //@version=6 in all code generation.
- No Hallucinations: If a function is not found in these files, it likely does not exist in v6 or has been renamed. Do not invent syntax.
📂 Repository Structure
- .claude-plugin/:
plugin.json+marketplace.json— makes this repo installable as a Claude Code plugin (Option 2 above). - skills/pinescript-v6/: The Claude Code skill that routes Pine Script requests to the right reference file. Self-contained — bundles its own copy of the docs so it works if copied out on its own.
- agents/pinescript-developer.md + agents/pinescript-developer/: The
pinescript-developersubagent definition and its bundled reference copy — also self-contained; copy both together. - bin/cli.mjs: The
npx pinescript-v6CLI — global installer (install/uninstall) and MCP server (mcp). - LLM_MANIFEST.md: The master index. Start here.
- concepts/: Explanations of how the Pine engine works (Execution model, Timeframes).
- reference/: The strict API dictionary.
- variables.md: Built-ins (
open,close,syminfo). - constants.md: Fixed values (
color.red). - functions/:
- ta.md: Technical Analysis.
- strategy.md: Backtesting.
- request.md: External data.
- drawing.md: Visuals (
plot,line,box).
- variables.md: Built-ins (
- visuals/: Drawing/plotting cookbook — plots, bar coloring, tables, lines/boxes, fills, backgrounds, text/shapes, levels.
- writing_scripts/: Style guide, debugging, profiling/limitations, and publishing guidelines.
📋 Recommended System Prompt
If you are building a Custom GPT or setting up a Project, use this prompt:
You are an expert Pine Script v6 Developer. You have access to a reference library structured into specific folders.
- When I ask for code, ALWAYS consult the LLM_MANIFEST.md to locate the correct reference file.
- Prefer
ta.*namespace functions over manual calculations.- Ensure all scripts start with
//@version=6.- If I ask for a Strategy, strictly check reference/functions/strategy.md for the latest order placement syntax.
- If I ask for complex visuals, check reference/functions/drawing.md for
polylineandboxcapabilities.
🔄 Maintaining the Bundles (contributors)
The root-level concepts/, reference/, visuals/, writing_scripts/,
release_notes.md, pine_script_execution_model.md, and LLM_MANIFEST.md
are the single canonical source. The copies inside skills/pinescript-v6/
and agents/pinescript-developer/ are generated from them — never hand-edit
those copies directly, edits will be overwritten.
- Edit the canonical root files.
- Regenerate the bundles:
./scripts/sync-bundles.sh - Commit everything together.
To avoid forgetting step 2, enable the provided pre-commit hook once per clone:
git config core.hooksPath .githooksIt re-runs the sync script and stages the regenerated bundles automatically
on every commit. As a backstop, .github/workflows/verify-bundle-sync.yml
re-runs the same script in CI and fails the build if any bundle is out of
sync with the canonical docs — so drift can't land on main even if the hook
was skipped or bypassed.
Run npm test (./tests/test-cli.sh) after touching bin/cli.mjs — it exercises
install/uninstall against a throwaway HOME and does an MCP handshake.
Publishing a new npm version runs sync-bundles.sh automatically via prepack:
npm version patch && npm publishDisclaimer: This repository is a community-maintained restructuring of the official documentation designed for AI efficiency. It is not affiliated with TradingView.
