Deterministic Pine Script™ Evaluation.
At the Edge.
A deterministic Pine Script\u2122 v5 and v6 runtime built on ANTLR4 and an ASDL AST. pynescript runs on Cloudflare\u00AE Workers via pyne-worker and pine-worker — no bar limits, no infrastructure overhead, no vendor lock-in.
Pine v5 & v6 Builtins
Max Backtest Bars
Edge Signal Latency
Infra Monthly Cost
[LEAVING THE BARBED WIRE BEHIND]
TradingView\u00AE has controlled the Pine Script\u2122 ecosystem for over a decade. Zero open-source runtimes. No way to self-host. Strict bar limits and mandatory subscriptions. pynescript dissolves these constraints.
| Capability | TradingView® | Freqtrade | 3commas | pyne-worker / pynescript |
|---|---|---|---|---|
| 100% Pine Script™ Syntax | Yes | No (Python rewrite) | No | • Yes (100% v5/v6 AST) |
| Open Source Runtime | No (Proprietary) | Yes (Python) | No | • Yes (AGPL v3) |
| Free / Self-Hostable | No ($50–$200/mo) | Yes (VPS required) | No ($30–$150/mo) | • Yes (Cloudflare® Free Tier) |
| Cloudflare® Edge Infrastructure | No | No | No | • Yes (<15ms Global Edge) |
| Backtest > 20k Bars | No (20k limit) | Yes | No | • Yes (Uncapped R2 Storage) |
| Programmatic REST/RPC API | No (Limited webhooks) | Yes | Yes | • Yes (Open REST & TS API) |
| Direct Strategy Events → Execution | No (Manual alert setup) | Yes (Custom code) | Yes | • Yes (Built-in trade-worker) |
| Multi-Strategy Batch Execution | No (1 chart per tab) | Yes | Yes | • Yes (Parallel edge isolates) |
[DUAL RUNTIME PARADIGM]
Two runtimes, one grammar. The Python reference engine guarantees AST parsing fidelity through ANTLR4. Cloudflare\u00AE Workers deliver deterministic, sub-15ms execution at the global edge. pynescript is the bifurcated execution model that makes this possible.
pynescript (Python Core)
~8,000 LOC Python
- ›Full ANTLR4 Grammar for Pine v5 & v6
- ›ASDL-generated AST (25+ node types)
- ›500+ builtins across 25+ namespaces
- ›Strategy event state machine (entry/exit/close)
- ›Language Server Protocol (pygls) & VS Code extension
- ›Flask Pro REST API & CLI suite
pyne-worker (Python CF Worker)
~1,100 LOC Python
- ›Cloudflare® Workers Python Runtime
- ›Constant-time HMAC API authentication
- ›Sliding window rate limiting (100 req/60s)
- ›Cloudflare® R2 gzipped JSONL bar fetcher
- ›StrategyEvent → trade-worker Webhook forwarding
- ›25/25 production parity test harness passing
pine-worker (TypeScript Edge)
~8,000 LOC TypeScript
- ›ANTLR4 TypeScript Parser from same grammar
- ›Zod AST schemas + visitor evaluator
- ›10 core ported builtin modules (ta, math, strategy, arrays, strings, drawing, plotting, input, alerts, utility)
- ›Zero-dependency edge V8 isolate execution
- ›Service binding integration with hoox trade-worker
- ›Chart CSV exporter for TradingView® compatibility
Pine Script™ Strategy Lifecycle Topology
Inspect the Engine in Action
Trace a Pine Script\u2122 strategy from source through the ASDL AST, into strategy state machine evaluation, and out as structured trade events for Cloudflare\u00AE Workers execution.
//@version=6
strategy("HOOX Edge Grid Master", overlay=true, initial_capital=10000)
// Strategy Inputs
fastLength = input.int(12, "Fast EMA")
slowLength = input.int(26, "Slow EMA")
gridLevels = input.int(5, "Grid Levels")
// Builtin Indicators (ta.* namespace)
fastEma = ta.ema(close, fastLength)
slowEma = ta.ema(close, slowLength)
// Entry Signal Logic
longCondition = ta.crossover(fastEma, slowEma)
if (longCondition)
strategy.entry("Grid_Long_1", strategy.long, qty=0.25)
strategy.exit("TP_Exit_1", "Grid_Long_1", profit=150, loss=50)
// Visual Plotting
plot(fastEma, color=color.cyan, title="Fast EMA")
plot(slowEma, color=color.purple, title="Slow EMA")Modular Pine Script™ Stack
Use the Python package locally, deploy to Cloudflare\u00AE Workers in Python or TypeScript, or integrate via VS Code. Every component is AGPL v3 open source.
pynescript
Python reference engine with ANTLR4 parser, ASDL AST, 500+ builtins, REPL, and linter.
pyne-worker
Production Python Cloudflare® Worker with R2 data ingestion and trade-worker event forwarding.
pine-worker
High-performance TypeScript Cloudflare® Worker port for pure V8 isolate execution.
superchart
Open-source PWA charting client with native pynescript Pine Script™ integration.
pynescript-lsp
VS Code extension providing auto-complete, hover docs, and inlay hints for Pine Script™.
[OPEN SOURCE BY DESIGN]
Pine Script\u2122 evaluation has been a closed ecosystem since TradingView\u00AE launched. The grammar was proprietary. The runtime was proprietary. If you wanted to run Pine outside their browser, you couldn\u2019t. pynescript changes that. The code is AGPL v3 open source. Revenue comes from managed hosting, never from software freedom.
The Value-Add Model
- • Closed-source evaluator runtime
- • Paywall the core runtime
- • API keys that expire monthly
- • Obscure the grammar and parser
- • Open-source evaluator (AGPL v3)
- • Free self-host + free basic SaaS
- • Charge for managed hosting, not code
- • Publish everything, let anyone fork
Open Source
AGPL v3 Copyleft
- ✓Full Python evaluator & all 500+ builtins
- ✓pyne-worker & pine-worker source access
- ✓ANTLR4 grammar & ASDL definitions
- ✓All tests & parity test harness
- ✓Unlimited self-hosting on Cloudflare®
Pro SaaS
Managed Edge Cloud
- ✓5 active Pine Script™ strategies
- ✓10 symbol streams (real-time)
- ✓Zero-config managed Cloudflare® R2 data
- ✓Automatic trade-worker event dispatch
- ✓Priority support & backtest engine
Commercial / Enterprise
Proprietary License
- ✓Non-AGPL commercial license rights
- ✓SLA & dedicated infrastructure
- ✓Custom builtin integration support
- ✓On-premise deployment package
- ✓Direct engineering access
[THE PHILOSOPHY] Software freedom means the code survives any single company. If someone builds a better service on top of this codebase, that\u2019s a win. The code is open. People choose the best service.
The $0/Month Self-Hosted Quant Stack
Every component runs inside Cloudflare\u00AE free tier limits. Zero monthly costs. Zero maintenance. Zero lock-in.
TradingView® Alert or Custom Webhook
Fire your signal directly to the edge gateway. No browser dependency. No tab crashes.
pyne-worker / pine-worker Evaluation
Evaluates Pine Script™ strategy on Cloudflare® Workers in <15ms. Emits typed StrategyEvent.
trade-worker Execution
Validates HMAC risk limits and dispatches execution orders to Binance/Coinbase APIs.
Cloudflare® Pages Dashboard
Real-time P&L visualization and trade reporting stored in Cloudflare® D1.
Infrastructure Cost Comparison
- • TradingView Premium: $200/mo
- • 3commas Pro: $30/mo
- • 20k bar backtest limit
- • Webhook latency: 200-500ms
- • Vendor lock-in
- • Cloudflare® Workers: Free (100k req/day)
- • Cloudflare® R2: Free (10GB)
- • Cloudflare® D1: Free (5M rows)
- • Uncapped backtesting bars
- • Sub-15ms edge latency
- • Full AGPL v3 source access