jpantsjoha/pinescript-plugin
TradingView Pine Script v6 for coding agents, backed by a real validator rather than prose. A language skill plus an MCP server that validates Pine and returns real signatures from the official 457-function reference — including the overloads models routinely get wrong — and a hook that checks every .pine file the agent edits.
Changelog
All notable changes to this plugin are documented here.
Format follows Keep a Changelog; versioning follows SemVer.
[0.4.3] - 2026-08-08
The accumulator guidance was the inverse of the bug
A user hit a defect the whole stack missed: a var total re-accumulated by a loop
on every bar, which grows for the life of the chart. The skills' advice — "declare
accumulators var so they persist" — is correct for a running total and is exactly
what produces this. Run the old checklist against the broken code and every item
ticks.
No skill mentioned for or while anywhere, so a reader had nothing to catch the
loop shapes with. All three skills now cover both directions and ask the question
that decides it: does the accumulator's lifetime match its meaning? "Total so
far" wants var; "total for this bar" must not have it.
Now detected as S3 in pinescript-v6-validator@0.3.0, pinned here.
Honest omissions added to "What the validator CANNOT see"
That table implied name-checking was covered. It is not:
- Constant and built-in-variable names are never checked.
shape.trianglup,color.greneandplot.style_circlezall validate clean and all fail on TradingView. Only parameter names are checked, never the values.lookup_pine_referencecovers functions only, sofound: falseforbarstate.islastmeans "not a function", not "not real". - Re-declaring a name with
=is a TradingView error and passes here. ta.*on the right ofand/orescapes S2, because v6 short-circuits.
Gate hardening
validate_skill_examples.pyreturned 0 when the engine was absent, so a localmake gateprinted "Gate passed" over zero validated examples. It now fails unless--allow-skipis passed deliberately.- The five scaffolds advertised as "validated in CI" were opened by no script at all — true by luck, not enforcement. Now validated as whole files: 31 examples, 5 of them scaffolds.
- New
make anchorsresolves every semantic check'sdocAnchoragainst real skill headings, using the installed engine. Four of nine were dead when it was written, including S1's — the most-cited defect in Pine Script. The engine's own test asserteddocAnchor.includes('#'), which all four dead links passed.
Skills now reference each other
Previously none did, so an agent that loaded pinescript-v6 never learned the
validated scaffolds existed two directories away. The PostToolUse hook is now
documented, so agents stop redundantly re-validating after every write.
Added a screenshot of Antigravity auditing a script through the plugin.
[0.4.2] - 2026-08-08
Changed
-
Requires
pinescript-v6-validator@^0.2.1, which repairs three checks that each worked on their happy path and silently missed a shape occurring constantly in real code:- S1 skipped every multi-line
request.security(). Wrapping is the normal formatting for that function, so most real repainting went undetected. - S2 checked only the true branch of a ternary.
- S9 counted
strategy.cancelas an exit. Cancel withdraws a pending order; it does not close a position.
v0.4.1 was tagged before that engine fix landed, so hub installs picked up the broken checks. This release exists to correct that.
- S1 skipped every multi-line
[0.4.1] - 2026-08-08
Fixed — found by cross-harness UAT and an adversarial coherence review
- Codex discovered zero skills while reporting a successful install.
.agents/skillswas a symlink; installers copy rather than clone, so it arrived empty. Now real files, kept in step byscripts/sync_agents_skills.pyand gated. - The hook never tried the npm engine. It resolved only local checkouts of the extension repo, so on any normal install it found nothing and exited silently — while the README promised "an actual control".
PLUGIN.mdstill demanded a built checkout of the extension, contradicting the README. It listed one skill when four ship, and "both diagnostic paths" when there are three.pinescript-strategytold agents the validator "cannot catch any of the traps below" — two of which are now S1 and S2 and are caught. An agent would have discounted a live finding as out of scope.pinescript-validationdocumented S3 and S4 as shipping checks with remedies. Neither is implemented; both are now struck through and flagged as check-by-eye.- Version was 0.4.0 in five manifests but 0.1.0 in
package.json,PLUGIN.md, the MCP server and three skill files, with no 0.4.0 changelog entry at all.
[0.4.0] - 2026-08-07
Added
- MCP server surfaces semantic findings from engine 0.2.0 with
// pine-ignorehonoured. Each carries acheckfield; its absence marks a syntactic diagnostic, which cannot be suppressed. pinescript-validationdocuments every check and its remedy.
[0.3.0] - 2026-08-07
Added
skills/pinescript-strategy— entries, exits, position sizing, and the five traps that make a backtest lie. Built from user evidence rather than assumption: practitioners report that "one overlooked mistake — like a repainting signal or scope error — can invalidate months of backtesting" (PickMyTrade). Covers repainting, unconfirmed-bar entries,ta.*in conditionals, the v6 lazy-evaluation trap, and optimistic fill assumptions — every one of which compiles cleanly and is still wrong.- Two CI-validated scaffolds:
basic-strategyandrisk-managed-strategy, the latter with ATR stops, risk-based sizing and webhook JSON payloads for broker automation (TradersPost / PickMyTrade shape).
Notable
Competitive research (_plugin/research/COMPETITIVE-LANDSCAPE.md) found that every
comparable AI tool is prose-only — none can check the code it emits. Two failure
modes exist and the industry conflates them: syntactic errors, which a validator
solves, and semantic errors that compile perfectly and are still wrong. The
expensive failures are all semantic.
Embedded Pine examples validated in CI: 14 -> 22.
[0.2.0] - 2026-08-07
Added
skills/pinescript-validation— every diagnostic class the validator emits, with its deterministic fix. Includes an explicit what the validator cannot see section (type compatibility, runtime logic, repainting, platform limits), because a clean run is not proof a script is correct, and a workflow for auditing an existing codebase of broken.pinefiles.skills/pinescript-indicator— three scaffolds validated in CI (overlay-indicator,oscillator,drawing-objects) covering plotting, drawing objects with cleanup, tables, alerts and the plot/object caps. Copy a scaffold rather than composing from memory: composing from recollection is how wrong parameter names get in.hooks/validate-pine.sh— PostToolUse hook validating every.pinefile the agent edits. Real installs into Claude Code and Antigravity both reportedHooks: 0; the plugin told agents to validate and shipped nothing to enforce it.
Changed
- The engine now comes from npm.
pinescript-v6-validator@0.1.0is published, so the plugin no longer requires a local checkout of the VS Code extension. The on-disk fallbacks remain for developing against unreleased engine changes. - Corrected the description in all five manifests. It advertised skills that did not exist — promising components the package does not ship.
Verified
Installed for real into Claude Code (Skills 3 · Hooks 1 · MCP 1) and Antigravity.
Packaging consistency across all four harness manifests is now enforced by
make gate. 14 embedded Pine examples validated in CI, up from 4.
[0.1.0] - 2026-08-07
Initial release. Scaffold plus the first skill and a working MCP server.
Added
- Agent Plugins 1.0.0 conformance —
plugin.jsonandmcp.jsonat the plugin root, closed schema, MCP declared out of band..claude-plugin/manifests for Claude Code. skills/pinescript-v6— execution model (var,:=, whyta.*must run unconditionally), the two call forms ofline.new/label.new/box.new, anti-repainting withrequest.security, platform limits, and the API TradingView shipped through July 2026 — including rules it removed.- MCP server with two tools:
validate_pine_script— runs both diagnostic paths, so its verdict matches what the VS Code extension showslookup_pine_reference— real signatures with overloads surfaced explicitly, and near-miss suggestions when a symbol is not found
make gate— spec conformance, skill contracts, reference-URL resolution, embedded Pine example validation, and MCP behaviour tests. Wired as a pre-commit hook viamake hooks, and run in CI.- 14 MCP behaviour tests, including one asserting both diagnostic sources are
wired in and one covering
alertconditionmessages containing commas.
Notable
scripts/validate_skill_examples.py extracts every ```pine block from every skill
and runs it through the real validator. Contrast blocks are split at the
WRONG/RIGHT boundary so the correct half is validated rather than the whole block
being skipped. When the engine cannot be located it skips loudly — an
unverified example must never look verified.
Known limitations
- One skill.
pinescript-validation,pinescript-strategyandpinescript-indicatorare planned. - The engine is not published to a package registry. The plugin locates it on
disk, so it requires a local checkout of
pinescript-vscode-extension. Until that is resolved this is not ready for a plugin-hub listing. - No mascot or illustrative assets yet.