{
  "markdown": "<p align=\"center\">\n  <img src=\"assets/hero.png\" alt=\"pinescript-plugin — Pine Script v6 for coding agents. Backed by a real validator, not prose.\" width=\"100%\">\n</p>\n\n[![Listed on ClaudePluginHub](https://www.claudepluginhub.com/badge/jpantsjoha-pinescript-plugin)](https://www.claudepluginhub.com/plugins/jpantsjoha-pinescript-plugin?ref=badge)\n[![Gate](https://github.com/jpantsjoha/pinescript-plugin/actions/workflows/gate.yml/badge.svg)](https://github.com/jpantsjoha/pinescript-plugin/actions/workflows/gate.yml)\n[![Agent Plugins 1.0.0](https://img.shields.io/badge/Agent%20Plugins-1.0.0-blue)](https://agent-plugins.org/specification)\n[![npm](https://img.shields.io/npm/v/pinescript-v6-validator?label=engine)](https://www.npmjs.com/package/pinescript-v6-validator)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)\n\n# pinescript-plugin\n\n> **Your agent writes Pine Script it cannot check. This gives it a checker.**\n\n> **Eight of these checks catch code that compiles perfectly and still loses money.**\n\nEvery AI Pine Script tool on the market ships advice. None of them can verify a\nsingle line they produce. That gap is the whole reason this exists.\n\n## The problem, precisely\n\nAsk any coding agent for a TradingView indicator. You get code that reads\nfluently and does not compile.\n\n```pine\n// Confident. Fluent. Four compile errors.\nl = line.new(x1=1, y1=2, x2=3, y2=4, colour=color.red)   // it is `color`\nplotshape(cond, shape=shape.triangleup)                   // it is `style=`\nv = math.clamp(x, 0, 1)                                   // no such function\nb = box.new(left=1, top=2, right=3, bottom=4, textalign=text.align_left)\n```\n\nThree properties of Pine make this near-certain:\n\n1. **Parameter names are not guessable.** `label.new` takes `textalign`.\n   `box.new` takes `text_halign`. Nothing about either implies the other.\n2. **Several functions have two valid call forms.** `line.new`, `label.new` and\n   `box.new` each accept a `chart.point` or independent coordinates. A model that\n   has seen one will insist the other is wrong.\n3. **The language moves quarterly, in both directions.** TradingView added\n   `request.footprint()` and multiline strings, then *removed* the wrapped-line\n   indentation rules in December 2025. Training data goes stale coming and going.\n\nSparse training data is the root cause, and TradingView say so plainly: the corpus\nfor Python is large enough to generate working code, and for Pine it is not.\n\n## The expensive half nobody addresses\n\nCompile errors cost a minute. The real damage is code that compiles and is still\nwrong: a repainting signal, a `ta.*` call inside a conditional quietly corrupting\nits own history, a strategy that opens positions and never closes them.\n\n> \"One overlooked mistake, like a repainting signal or scope error, can invalidate\n> months of backtesting.\"\n> — [PickMyTrade](https://blog.pickmytrade.io/debugging-tradingview-strategies-10-common-pine-script-mistakes/)\n\nProse cannot fix that class of bug, because the author already believes the code\nis right. **Detection can.** Eight checks ship today:\n\n| ID | Catches | Severity |\n|---|---|---|\n| S1 | `request.security()` reading the current, still-forming bar | Warning |\n| S2 | `ta.*` inside a ternary or block, leaving gaps in its history | Warning |\n| S3 | A `var` accumulator a loop re-adds to every bar and never resets | Warning |\n| S5 / S6 | Over 64 plots or 40 `request.*()` calls | Error |\n| S7 | `plot` / `bgcolor` / `fill` outside global scope | Error |\n| S8 | A function defined inside a block | Error |\n| S9 | `strategy.entry` with no exit anywhere in the script | Warning |\n\nConsidered one and decided it is fine? Silence it:\n\n```pine\nd = request.security(syminfo.tickerid, \"D\", close)   // pine-ignore: S1\n```\n\nSyntactic errors are never suppressible. A compile failure is a fact, not a\njudgement.\n\n## What you get\n\n| Component | Does |\n|---|---|\n| `validate_pine_script` | Runs every check, returns diagnostics with line numbers |\n| `lookup_pine_reference` | The real signature of any v6 built-in, overloads included |\n| 4 skills | Language rules, the fix loop, indicator and strategy patterns |\n| 1 hook | Validates every `.pine` file the agent edits, automatically |\n\n## Why trust it\n\nThe engine is\n[`pinescript-v6-validator`](https://www.npmjs.com/package/pinescript-v6-validator),\nthe same code running inside a VS Code extension with 1,400+ installs at 4.45\nstars. Your agent and your editor read from one implementation, so they cannot\ndisagree about a file.\n\nBehind it: 457 function signatures from the official reference, a hand-maintained\nlayer for everything TradingView shipped since, explicit overload modelling, and a\ngolden corpus proven able to fail. Reintroduce a fixed bug and the build goes red.\n\nEvery Pine example in every skill is extracted and run through that validator in\nCI. A skill shipping code that fails its own checker would be worse than no skill,\nso the build blocks it.\n\n## Plugin, or VS Code extension?\n\nBoth. The distinction matters, because getting it wrong is what makes two tools\ncontradict each other.\n\n```\n        pinescript-v6-validator  (npm)     detection lives here, once\n                     |\n        +------------+------------+\n        v                         v\n  VS Code extension          this plugin\n  surface: humans            surface: agents\n  squiggles, hover           MCP, skills, hook\n```\n\nA check is written **once**, in the engine. The extension renders it as a squiggle.\nThis plugin returns it to the model. Neither reimplements it. The moment the same\nrule exists twice they drift, and a drifted rule means your agent and your editor\ndisagree about the same file.\n\nSkills are plugin-only. Prose is useless in an editor and is the whole point for\nan agent. Editor affordances such as formatting and go-to-definition stay in the\nextension.\n\n## Install\n\nOne plugin, four coding assistants. Skills live in `skills/`; each harness reads\nits own manifest. The validation engine comes from\n[`pinescript-v6-validator`](https://www.npmjs.com/package/pinescript-v6-validator)\non npm — **no separate checkout required**.\n\n**Claude Code**\n\n```text\n/plugin marketplace add jpantsjoha/pinescript-plugin\n/plugin install pinescript-plugin@pinescript-plugin-marketplace\n```\n\n**Antigravity (Gemini)**\n\n```bash\nagy plugin install https://github.com/jpantsjoha/pinescript-plugin\n```\n\n**Codex**\n\n```bash\ncodex plugin marketplace add https://github.com/jpantsjoha/pinescript-plugin\ncodex plugin add pinescript-plugin@pinescript-plugin-marketplace\n```\n\nCodex reads `AGENTS.md` as its always-on contract and discovers skills under\n`.agents/skills/`.\n\n**Kimi Code**\n\nKimi reads `.kimi-plugin/plugin.json`. Point it at the skills directly:\n\n```bash\ngit clone https://github.com/jpantsjoha/pinescript-plugin\nkimi --skills-dir ./pinescript-plugin/skills\n```\n\n### Verify the install\n\nAsk your agent to validate something deliberately wrong:\n\n```pine\n//@version=6\nindicator(\"check\")\nl = line.new(x1=1, y1=2, x2=3, y2=4, colour=color.red)\n```\n\nYou should get **`No parameter named 'colour' in 'line.new'`**. If instead you are\ntold the script is fine, the MCP server is not connected — check your harness's\nMCP configuration.\n\n### Harness support\n\nEvery row below was verified by installing and running the tools, not by reading a\nmanifest.\n\n| | Skills | MCP tools | Hook |\n|---|:---:|:---:|:---:|\n| Claude Code | ✅ | ✅ | ✅ |\n| Antigravity | ✅ | ✅ | — *(harness has no hook support)* |\n| Codex | ✅ | ✅ | — |\n| Kimi Code | ✅ *(via `--skills-dir`)* | ✅ | — |\n\nAntigravity auditing a script through the plugin, and finding the repainting the\nauthor did not:\n\n![Antigravity loading the plugin's MCP config, calling validatePineScript, and reporting an S1 repainting finding with the fix](assets/antigravity-audit.png)\n\nTwo things are worth noticing. The model calls the plugin's own\n`validatePineScript` rather than reasoning about the code from memory — the\nverdict comes from the engine, not from the model's recollection of Pine. And it\ndoes not paraphrase the warning: it names the check, states the mechanism\n(reading a still-forming higher-timeframe bar), and gives the specific edit.\n\nThat is the difference between a skill that explains a diagnostic and one that\nmerely mentions it.\n\n### Working on the plugin itself\n\n```bash\ngit clone https://github.com/jpantsjoha/pinescript-plugin\ncd pinescript-plugin && npm install && make hooks\nmake gate    # spec · packaging · skills · links · Pine examples · MCP tests\n```\n\n## What's in it\n\n```\nskills/pinescript-v6/          execution model, overloads, anti-repainting, limits\nskills/pinescript-validation/  every diagnostic class and its deterministic fix\nskills/pinescript-indicator/   validated scaffolds: overlay, oscillator, drawings\nskills/pinescript-strategy/    entries, exits, sizing, and the repainting traps\nmcp/server.js                  validate_pine_script + lookup_pine_reference\nhooks/                         validates every .pine file the agent edits\nscripts/                       spec, packaging, skill, link and example validation\ntests/                         MCP behaviour tests\n```\n\n`make gate` runs everything: Agent Plugins 1.0.0 conformance, multi-client\npackaging consistency, skill frontmatter contracts, reference-URL resolution,\nembedded Pine validation, and the MCP behaviour tests.\n\n## What this does not do yet\n\nStating it plainly beats you finding out.\n\n- **Constant and built-in-variable NAMES are not checked.** `shape.trianglup`,\n  `color.grene` and `plot.style_circlez` validate clean here and fail on\n  TradingView. Only *parameter* names are checked, never the values.\n  `lookup_pine_reference` covers functions only, so a `found: false` for\n  `barstate.islast` means \"not a function\", not \"not real\".\n- **One check is specified but not built.** S4 (assignment inside `and`/`or`) is a\n  heuristic about intent. Until its false-positive rate measures at zero it stays\n  out. The related shape — a `ta.*` call on the right of `and`/`or`, which v6\n  short-circuits into a conditional call — escapes S2 for the same reason.\n- **Re-declaring a name with `=`** is a TradingView error and passes here.\n- **No type inference.** A `series` value passed where `simple` is required\n  compiles here and fails on TradingView. Fixing that needs an AST the engine\n  does not have.\n- **Hooks work in Claude Code only.** Antigravity, Codex and Kimi get the skills\n  and the MCP tools. Their harnesses do not load the hook.\n- **A clean validation is not proof the script is right.** It means no known\n  defect matched. Backtest assumptions, unconfirmed-bar entries and position\n  sizing remain yours to check.\n\n## Related projects\n\n| Project | What it is |\n|---|---|\n| **[pinescript-vscode-extension](https://github.com/jpantsjoha/pinescript-vscode-extension)** | The VS Code extension — IntelliSense, hover docs, real-time validation. Source of the engine this plugin uses. |\n| **[googlecloud-plugin](https://github.com/jpantsjoha/googlecloud-plugin)** | Same plugin architecture applied to Google Cloud delivery — solution design, security, SRE, agentic patterns. |\n\n### Prior art\n\n[TradersPost/pinescript-agents](https://github.com/TradersPost/pinescript-agents)\ncovers similar ground with seven skills and is worth a look.\n[double232/pinescript-skill](https://github.com/double232/pinescript-skill) is one\ndeep skill with a good catalogue of hard language constraints.\n\nThe claim here is narrow and checkable. Both are prose. Neither can verify a line\nof the Pine it produces. This ships the checker.\n\n## Contributing\n\nFound Pine that this validator gets wrong? That is the most valuable bug report\navailable. A false positive is worse than a missed error, because it puts red\nmarks on correct code and teaches people to ignore the tool. Open an issue with\nthe smallest script that reproduces it.\n\n## Author\n\n**Jaroslav Pantsjoha**\n\n- Website: [jpantsjoha.com](https://jpantsjoha.com)\n- GitHub: [@jpantsjoha](https://github.com/jpantsjoha)\n- LinkedIn: [in/johas](https://uk.linkedin.com/in/johas)\n\n## License\n\nMIT\n",
  "bytes": 12101,
  "sha": "c5d9e3cacdd0df7724a63a80c1a7a87e3176680d2767a0530f9d2a203e640781",
  "repo_slug": "jpantsjoha/pinescript-plugin",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_jpantsjoha_pinescript_plugin_1182c8b0/readme"
}