pinescript-v6-validator
v0.3.0
Published
TradingView Pine Script v6 validator and reference dataset — 457 function signatures with explicit overload modelling. The engine behind the Pine Script v6 IDE Tools VS Code extension.
Maintainers
Readme
pinescript-v6-validator
TradingView Pine Script v6 validator and reference dataset — the engine behind the Pine Script v6 IDE Tools VS Code extension (1,400+ installs).
No vscode dependency, so the same engine runs in an editor, in CI, in a headless
CLI, and inside an MCP server. One engine means an agent and your editor cannot
disagree about a file.
Install
npm install pinescript-v6-validatorUse
const { validatePineScript } = require('pinescript-v6-validator');
const errors = validatePineScript(source);
// [{ line, column, length, message, severity }] severity: 0=error 1=warningRun all diagnostic sources via validatePineScript. Calling AccurateValidator
alone misses the whole-document checks, which is how a "clean" verdict once
appeared on files the editor was marking with errors.
const { PINE_FUNCTIONS_MERGED } = require('pinescript-v6-validator');
PINE_FUNCTIONS_MERGED['line.new'].overloads;
// Both official call forms: (first_point, second_point, …) and (x1, y1, x2, y2, …)Semantic checks — defects that compile
Most Pine tooling catches code TradingView will reject. These catch code it accepts and then behaves unexpectedly:
| ID | Detects |
|---|---|
| S1 | request.security() reading the current, still-forming bar — repainting |
| S2 | ta.* called inside a conditional — its history develops gaps |
| S5 / S6 | More than 64 plots or 40 request.*() calls — TradingView rejects the script |
| S7 | plot / bgcolor / fill outside global scope — a v6 scope error |
| S8 | A function defined inside a block — Pine has no nested functions |
| S9 | strategy.entry with no exit anywhere — unbounded risk |
Suppress a specific finding when you have considered it:
d = request.security(t, "D", close) // pine-ignore: S1Syntactic diagnostics are never suppressible — a compile error is a fact, not a judgement.
What it catches
- Overloaded constructors.
line.new,label.newandbox.neweach accept achart.pointor independent coordinates. A call is valid if it satisfies any overload — flattening them is what made correct code look broken. - Wrong parameter names —
colourforcolor,shape=forstyle=,textalignwheretext_halignbelongs - Arity errors, with balanced-paren argument counting
- Undefined namespaces, variables and functions; user-defined
type/enum - Multiline strings (
"""…"""),for…initerators, wrapped calls containing comments or blank lines
What it does not do
No AST, so no type inference. It is a fast line-based checker, not a compiler — roughly 12ms for a 1,300-line script.
Currency
The dataset is a point-in-time scrape of the official v6 reference
(2025-10-03) plus a hand-maintained layer covering everything TradingView shipped
since, through July 2026: request.footprint(), multiline strings, sort_field,
active on inputs, timeframe_bars_back, calc_on_every_history_tick,
syminfo.isin, box.set_xloc().
Rules get removed too — the December 2025 release dropped wrapped-line indentation restrictions, and this reflects that.
Related
- pinescript-vscode-extension — the VS Code extension
- pinescript-plugin — agent skills and MCP server built on this
License
MIT © Jaroslav Pantsjoha
