Compatibility guarantee
Grouped map of what PYNE implements for Pine Script™ v5/v6 — working, partial, residual, and by-design out of scope. hoox-pyne 0.6.4.
This page
Compatibility guarantee
Abstract
PYNE implements Pine Script™ v5/v6 language core as an inspectable pipeline: parse → AST → bar-loop evaluate. The map below is the product-facing compatibility surface for hoox-pyne 0.6.4. It is not TradingView® platform identity (chart host, proprietary data, editor-only UI) and not bit-identical results vs the hosted platform on every script or bar.
Name-level dispatch lives in Pine v6 surface (docs/pine_v6_full_surface_inventory.md). Gaps: Missing features. Checkmarks: Implementation status.
Conceptual model
Rendering…
Legend
| Mark | Meaning |
|---|---|
| Working | Implemented, usable, covered by first-party tests |
| Partial | Callable but mock, host-bound, or incomplete vs hosted Pine |
| Residual | Known open hole on an otherwise landed surface |
| Out of scope | Intentionally not a TV platform clone |
Dispatch snapshot (2026-07-25): 640 callables, 0 missing vs the public TV v6 function list (434 symbols). A registered name is not the same as hosted-platform semantics.
Working
Language, series, TA hot path, collections, strategy broker, drawings, alerts, libraries, interpret Runtime.
Partial
request.* feeds (honest na), compile eligibility, compile alerts, PyneTS vs Python oracle.
Residual
Plot MISMATCH corpus tail (P1p), PYNE_SERIES_RING default off.
Out of scope
Pixel chart, editor UX, foreign live data, bit-identical TV bars.
Interface surface
Corpus (set01–04 · 2477 scripts · 2026-08-09)
Open-source sets, not shipped in git. Not a TradingView® platform score.
| Suite | Rate | Notes |
|---|---|---|
| Parse + unparse | 99.96% (2476/2477) | Residual: one intentional invalid line-wrap demo |
| Runtime interpret (50 bars) | 100% excl. EXPECTED_FAIL | 2466 OK + 11 listed demos |
| set01 Runtime | 249/249 | Interpret (and prior compile sweep) |
EXPECTED_FAIL are path-listed demos (runtime.error library guards, lower-TF security, pathological loops) — not silent suppression.
Grouped map
Residual and out of scope (compact)
| Item | Class |
|---|---|
Interpret↔compile value MISMATCH (optional set0x community corpus) | Residual (P1p official builtins closed) |
PYNE_SERIES_RING default-on | Residual (flagged off) |
| Pixel chart / editor word-wrap / TV UI | Out of scope |
| Foreign live fundamentals without a feed | Out of scope |
| TV Supertrend band ratchet | Out of scope |
| Tick-path trail / broker | Out of scope |
| Bit-identical every recursive smoother vs TV | Out of scope |
| Parallel bars / whole-script vectorization | Out of scope |
Rendering…
Dual-host plot parity
Same script + OHLCV under mode="interpret" and mode="compile"; series compared with nan-aware allclose (rtol=1e-5, atol=1e-6).
| Artifact | Role |
|---|---|
scripts/compare_interp_compile.py | Corpus harness → .cache/interp_compile_parity.json |
tests/test_interp_compile_parity.py | Always-on smoke |
tests/test_first_party_ta_goldens.py | ATR / Supertrend / Keltner dual-host |
Known contract differences (not silent value bugs):
- Foreign / complex
request.*→naon both hosts when no feed. - First-party
hline/fill/bgcolor/plotshapekeys match; harness--ignore-hline-keys/--ignore-fill-keysremain optional for leftover corpus noise. - Pivot-starved Auto Fib → matching
runtime.error(both_error_same), not invented pivots.
Internals
| Artifact | Role |
|---|---|
docs/compatibility_guarantee.md | Historical long-form; this page is the map |
COMPATIBILITY.md | Repo-root distillation of this map |
docs/pine_v6_full_surface_inventory.md | Name-level dispatch tables |
docs/known_divergences.md | Semantic deltas vs public Pine docs |
tests/fixtures/parity/ | First-party strategy fixtures |
Invariants & edge cases
- Parse success ≠ evaluate success. Round-trip can still depend on
request.*data. - Dispatch success ≠ hosted semantics. 0 missing vs the public function list does not mean TV-identical bars.
- Interpret is the oracle. Compile matches where eligible;
mode=autofalls back. - Plots are not a renderer. Registry + series export; pixels are AXIS / clients.
- Floating-point is statistical for some recursive smoothers — Numerical validation.
- Libraries need in-process registration; there is no TV CDN.
Worked examples
Round-trip
from pynescript.ast.helper import parse, unparse
src = open("strategy.pine").read()
assert unparse(parse(src)) # structural; whitespace may differ
Interpret ↔ compile
python scripts/compare_interp_compile.py --bars 1000 --limit 50
python scripts/compare_interp_compile.py --ignore-hline-keys --ignore-fill-keys
pytest tests/test_interp_compile_parity.py -q
Failure modes
| Observation | Read as |
|---|---|
| Parse error on a new TV release-notes feature | Surface gap — Missing features |
| Numerical drift on a custom smoother | Bar-mode vs list-mode; na; known divergences |
| Interpret vs compile series mismatch | Foreign request.*, UDF last-assign na, leftover corpus keys |
| Strategy equity ≠ TV | Commission / slippage / OHLC vs tick path |
import unresolved | Library not in libraries= / registry |
/run 400 UNKNOWN_FIELDS | Extra key not in RUN_SCHEMA |