PineScript Render
PineScript Render is a VS Code extension for TradingView Pine Script developers. It provides static analysis, intelligent tooltips, and an integrated backtest preview panel powered by vectorbt — letting you visualize strategy performance without leaving the editor.
Features
Backtest Preview Panel
Run strategies directly from VS Code and view results in an interactive chart panel:
- K-Line Chart with trade entry/exit markers (Lightweight Charts)
- Equity Curve with benchmark comparison and drawdown overlay
- Metrics Bar — net profit, annualized return, win rate, Sharpe, Sortino, max drawdown
- Trades Table — sortable list of all trades with PnL, duration, exit reason
Shortcut: Ctrl+K V (or Cmd+K V on macOS) to open the preview panel.
Static Analysis
- Zero False-Positive Goal: Greedy symbol scraping handles partial parse errors gracefully
- Advanced Diagnostics: Catch void return assignments, argument count mismatches, namespace misuses
- Pine v6 Support: Full support for namespaces (
log., chart.point, UDT constructors)
Intelligent Editor Features
- Hover Documentation: Detailed reference for 800+ built-in functions
- Contextual Autocomplete: Organized by namespace (
ta., math., array.)
- Signature Help: Parameter hints as you type
- WASM Powered: Tree-sitter parser runs on WebAssembly for sub-millisecond AST generation
- Zero-Dependency Core: Bundled with esbuild, lightweight and fast
Quick Start
- Install the extension
- Open a
.pine file
- Press
Ctrl+K V to open the backtest preview
- Click "Run Backtest" to execute the strategy
Backtest Requirements
The backtest runner requires Python with vectorbt:
pip install vectorbt yfinance
Configure in VS Code settings:
| Setting |
Default |
Description |
pineScript.backtest.pythonPath |
python3 |
Path to Python interpreter |
pineScript.backtest.defaultSymbol |
BTCUSDT |
Default ticker symbol |
pineScript.backtest.defaultTimeframe |
1D |
Default timeframe |
pineScript.backtest.dataSource |
yfinance |
Data provider (yfinance or ccxt) |
Architecture
pine-script-extension/
├── client/
│ ├── src/extension.ts # Language Client entry
│ ├── src/render/ # Backtest preview (runner, watcher, provider)
│ └── webview/ # Frontend (Lightweight Charts, dark theme)
├── server/
│ ├── src/server.ts # LSP server (Hover, Completion, pine/getInputs)
│ ├── src/analyzer.ts # Static analysis engine
│ ├── src/data/definitions.json # 800+ built-in function metadata
│ └── backtest/run_backtest.py # vectorbt strategy runner (JSONL output)
└── tree-sitter-pinescript/ # Grammar (patched scanner.c)
Build & Development
cd pine-script-extension
# Install dependencies
npm run postinstall
# Build
npm run bundle
# Package VSIX
npx vsce package
# Run tests
cd server && npm run build && node out/test/test_runner.js
Support & Feedback
Disclaimer
NOT FINANCIAL ADVICE. This is a development tool for educational and research purposes only. No liability for financial losses. Trading logic should always be manually verified. Software provided "as is" without warranty.
Requirements
- VS Code: 1.75.0+
- Pine Script: v3–v6
- Backtest: Python 3.8+ with vectorbt, yfinance (optional: ccxt)
License: MIT