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

Diagram

Rendering…

Legend

MarkMeaning
WorkingImplemented, usable, covered by first-party tests
PartialCallable but mock, host-bound, or incomplete vs hosted Pine
ResidualKnown open hole on an otherwise landed surface
Out of scopeIntentionally 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.

SuiteRateNotes
Parse + unparse99.96% (2476/2477)Residual: one intentional invalid line-wrap demo
Runtime interpret (50 bars)100% excl. EXPECTED_FAIL2466 OK + 11 listed demos
set01 Runtime249/249Interpret (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)

ItemClass
Interpret↔compile value MISMATCH (optional set0x community corpus)Residual (P1p official builtins closed)
PYNE_SERIES_RING default-onResidual (flagged off)
Pixel chart / editor word-wrap / TV UIOut of scope
Foreign live fundamentals without a feedOut of scope
TV Supertrend band ratchetOut of scope
Tick-path trail / brokerOut of scope
Bit-identical every recursive smoother vs TVOut of scope
Parallel bars / whole-script vectorizationOut of scope
Diagram

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).

ArtifactRole
scripts/compare_interp_compile.pyCorpus harness → .cache/interp_compile_parity.json
tests/test_interp_compile_parity.pyAlways-on smoke
tests/test_first_party_ta_goldens.pyATR / Supertrend / Keltner dual-host

Known contract differences (not silent value bugs):

  1. Foreign / complex request.*na on both hosts when no feed.
  2. First-party hline / fill / bgcolor / plotshape keys match; harness --ignore-hline-keys / --ignore-fill-keys remain optional for leftover corpus noise.
  3. Pivot-starved Auto Fib → matching runtime.error (both_error_same), not invented pivots.

Internals

ArtifactRole
docs/compatibility_guarantee.mdHistorical long-form; this page is the map
COMPATIBILITY.mdRepo-root distillation of this map
docs/pine_v6_full_surface_inventory.mdName-level dispatch tables
docs/known_divergences.mdSemantic deltas vs public Pine docs
tests/fixtures/parity/First-party strategy fixtures

Invariants & edge cases

  1. Parse success ≠ evaluate success. Round-trip can still depend on request.* data.
  2. Dispatch success ≠ hosted semantics. 0 missing vs the public function list does not mean TV-identical bars.
  3. Interpret is the oracle. Compile matches where eligible; mode=auto falls back.
  4. Plots are not a renderer. Registry + series export; pixels are AXIS / clients.
  5. Floating-point is statistical for some recursive smoothers — Numerical validation.
  6. 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

ObservationRead as
Parse error on a new TV release-notes featureSurface gap — Missing features
Numerical drift on a custom smootherBar-mode vs list-mode; na; known divergences
Interpret vs compile series mismatchForeign request.*, UDF last-assign na, leftover corpus keys
Strategy equity ≠ TVCommission / slippage / OHLC vs tick path
import unresolvedLibrary not in libraries= / registry
/run 400 UNKNOWN_FIELDSExtra key not in RUN_SCHEMA

See also