Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Pine Script v6 IDE ToolsNew to Visual Studio Code? Get it now.
Pine Script v6 IDE Tools

Pine Script v6 IDE Tools

Jaroslav Pantsjoha

|
295 installs
| (0) | Free
Unofficial Pine Script v6 support for VS Code — IntelliSense, hover docs, and real-time validation with 100% language coverage.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Pine Script v6 Language Support - VS Code Extension

Complete Pine Script v6 language support with 100% construct coverage, intelligent IntelliSense, real-time diagnostics, and zero false positives. Community-driven open source project.

CI/CD Pipeline Version License Language Coverage Tests


🎯 What is This?

A community-driven Visual Studio Code extension for Pine Script v6 developers. Write TradingView indicators and strategies with modern IDE features: intelligent code completion, real-time error detection, and comprehensive language support.

Key Achievement: 100% coverage of Pine Script v6 language constructs (all official language features from TradingView documentation).

Created by: Jaroslav Pantsjoha and the community.


✨ Key Features

🔍 Complete v6 Language Support

  • ✅ All 31 constant namespaces recognized (xloc.*, yloc.*, extend.*, scale.*, display.*, hline.*, barmerge.*, font.*, text.*, order.*, currency.*, dayofweek.*, and more)
  • ✅ All 27 standalone built-ins (ask, bid, time_close, time_tradingday, timenow, etc.)
  • ✅ All 15 keywords (and, or, not, enum, export, import, method, type, var, varip, etc.)
  • ✅ All 21 operators (+, -, *, /, ==, !=, ?:, =>, etc.)
  • ✅ All 21 variable namespaces (barstate.*, syminfo.*, timeframe.*, strategy.*, etc.)
  • ✅ All 22 function namespaces (ta.*, math.*, input.*, str.*, array.*, etc.)

🚫 Zero False Positives

// These are ALL valid v6 code - no errors!
x = xloc.bar_index
y = yloc.price
e = extend.both
s = scale.left
d = display.all
c = currency.USD
p = position.top_center

🎯 Real-Time Diagnostics

  • Detects undefined functions and variables
  • Catches missing required parameters
  • Identifies invalid Pine Script v6 syntax
  • Warns about too many arguments
  • Fast validation (< 100ms for typical scripts)

💡 Intelligent IntelliSense

  • 457+ built-in functions with autocomplete
  • Parameter hints for all major functions
  • Hover documentation
  • Namespace-aware completions

📝 Syntax Highlighting

  • Complete Pine Script v6 syntax support
  • Built-in variables and constants highlighted
  • Function calls, keywords, and operators distinguished
  • Comment and string literal recognition

📦 Installation

From VSIX (Recommended for v0.4.0)

  1. Download the latest release: pine-script-extension-0.4.0.vsix

  2. Install in VS Code:

    code --install-extension pine-script-extension-0.4.0.vsix
    
  3. Reload VS Code:

    • Press Cmd+Shift+P (Mac) or Ctrl+Shift+P (Windows/Linux)
    • Type: Developer: Reload Window

From VS Code Marketplace (Coming Soon)

  1. Open VS Code
  2. Press Cmd+Shift+X (Mac) or Ctrl+Shift+X (Windows/Linux)
  3. Search for "Pine Script v6 Professional"
  4. Click Install

🚀 Quick Start

1. Create a New Pine Script File

# Create a file with .pine extension
touch my-indicator.pine

2. Start Coding

//@version=6
indicator("My First Indicator", overlay=true)

// Use all v6 features with full IntelliSense
length = input.int(20, "Length")
src = input.source(close, "Source")

// All namespaces recognized
sma = ta.sma(src, length)
ema = ta.ema(src, length)

// Plot with all style constants
plot(sma, "SMA", color.blue, style=plot.style_line)
plot(ema, "EMA", color.red, style=plot.style_linebr)

// Use all position constants
if ta.crossover(ema, sma)
    label.new(bar_index, high, "Buy",
             xloc=xloc.bar_index,
             yloc=yloc.abovebar,
             color=color.green,
             style=label.style_label_up)

3. See Real-Time Validation

  • Errors appear in the Problems panel
  • Squiggly underlines show issues inline
  • Hover for error details

📊 Pine Script v6 Documentation Parity

This extension provides 100% coverage of Pine Script v6 language constructs as documented in the official TradingView Pine Script v6 Reference.

Category Coverage Details
Constant Namespaces 31/31 (100%) All namespace.constant patterns recognized
Built-in Variables 27/27 (100%) All standalone variables (close, ask, bid, etc.)
Variable Namespaces 21/21 (100%) All namespace.* variable patterns
Function Namespaces 22/22 (100%) All namespace.function() patterns
Keywords 15/15 (100%) All v6 keywords (and, enum, export, etc.)
Operators 21/21 (100%) All v6 operators (+, -, ?:, etc.)

See: V0.4.0 Coverage Analysis for detailed breakdown.


🔧 Parser & Validator Improvements (2025-10-06)

Recent Quality Enhancements (Dev Tools Only):

We've significantly improved the internal validation tool (MCP server) with a 54.1% error reduction:

  • Baseline: 853 false positive errors
  • Current: 392 errors remaining
  • Total improvement: -461 errors (-54.1%)

What was fixed:

  • ✅ If/else indentation-based parsing
  • ✅ For loop iterator variable scoping
  • ✅ Type annotation parsing (int, float, bool, etc.)
  • ✅ Multi-line function body type inference
  • ✅ Built-in function signatures (variadic functions)
  • ✅ All 48 Pine Script v6 namespaces recognized

Note: These improvements are in the development/QA tools only. The published VSCode extension's user-facing features (syntax highlighting, IntelliSense, hover docs) have always worked correctly and remain unchanged.

See: errors-fix.md for complete technical details and SESSION-4-CONTROL-FLOW-SUMMARY.md for latest changes.


🎓 Examples

Example 1: Multi-Timeframe Analysis

//@version=6
indicator("MTF Analysis", overlay=true)

// Request data from higher timeframe
htf_close = request.security(syminfo.tickerid, "D", close,
                             barmerge.gaps_on,
                             barmerge.lookahead_off)

// Plot with display options
plot(htf_close, "Daily Close",
     color=color.blue,
     display=display.all)

Example 2: Strategy with All Features

//@version=6
strategy("Complete Strategy", overlay=true)

// Use all input types
length = input.int(20, "Length")
src = input.source(close, "Source")
trade_type = input.string("Long", "Trade Type",
                          options=["Long", "Short", "Both"])

// Strategy execution
if ta.crossover(close, ta.sma(src, length))
    strategy.entry("Long", strategy.long)

if ta.crossunder(close, ta.sma(src, length))
    strategy.close("Long")

More examples: examples/ directory


🤝 Contributing

We welcome contributions! This is a community-driven project.

How to Contribute

  1. Report Issues: Found a bug or false positive? Open an issue
  2. Suggest Features: Have an idea? Share it in discussions
  3. Submit PRs: Fix bugs, improve docs, add features

See: Contributing Guide for detailed instructions.

Development Setup

# Clone the repository
git clone https://github.com/YourGitHub/pine-script-vscode-extension.git
cd pine-script-vscode-extension

# Install dependencies
npm install

# Build and test
npm run rebuild

# Install locally for testing
code --install-extension build/pine-script-extension-0.4.0.vsix

🤖 MCP Integration - AI-Powered Validation

Status: ✅ Fully Operational (v1.0.0)

This project includes a Model Context Protocol (MCP) server that provides Pine Script v6 validation to AI assistants like Claude Code, Gemini, and other MCP-compatible tools.

What You Get

  • ✅ Validate .pine files directly from Claude Code or other AI assistants
  • ✅ Comprehensive error reporting with line numbers, severity levels, and detailed messages
  • ✅ Zero setup required - automatically configured for VS Code workspace
  • ✅ Works with file paths or code strings - validate files or inline code snippets
  • ✅ Developer-friendly - JSON-RPC 2.0 protocol with full semantic analysis

Quick Start (VS Code + Claude Code)

The MCP server is automatically configured when you open this project in VS Code with Claude Code installed.

Just ask Claude:

"Validate the examples/global-liquidity.v6.pine file"

Features

  • Real-time validation via AI assistants
  • Comprehensive validator with semantic analysis (not just syntax checking)
  • Containerized validation with Docker for CI/CD pipelines
  • Easy integration with any MCP-compatible client

Documentation

  • Full MCP docs: MCP-INTEGRATION.md
  • Test the server: npm run test:mcp
  • Gemini-specific setup: mcp/README.md (legacy)

Example Output

{
  "source": "File: my-indicator.pine",
  "total_errors": 2,
  "summary": "❌ 2 error(s), 0 warning(s) found",
  "errors": [
    {
      "line": 10,
      "column": 5,
      "message": "Undefined variable 'my_var'",
      "severity": 0
    }
  ]
}

For Developers

# Test the MCP server
npm run test:mcp

# Run QA validation on all examples
npm run qa:pinescript

# Build Docker container
docker build -t pinescript-validator mcp/

🤖 AI Code Assistant - Gemini Pine Script v6 Expert

Want an AI assistant that's an expert in Pine Script v6? We've created a comprehensive context file for Google Gemini!

Features

  • 6,665 official language constructs knowledge
  • 100% v6 syntax mastery with zero false positives
  • Code generation following TradingView best practices
  • Anti-repainting patterns and performance optimization
  • Self-referencing documentation (auto-lookup from TradingView docs)

Quick Setup

  1. Install Gemini CLI:

    npm install -g @google-gemini/gemini-cli
    
  2. Use the expert context:

    gemini chat --context GEMINI.md
    
  3. Ask Pine Script v6 questions:

    > How do I prevent repainting with request.security()?
    > Generate a strategy with trailing stop loss
    > Optimize this indicator for performance
    

See: GEMINI.md - Complete Pine Script v6 expert system context

Gemini CLI: https://github.com/google-gemini/gemini-cli


📖 Documentation

For Users

  • Quick Start Guide - Get started in 5 minutes
  • Testing Guide - Verify everything works
  • Syntax Highlighting - Customize colors

For AI/LLM Development

  • GEMINI.md - Complete Pine Script v6 expert context for Gemini
  • AI Assistant Guide - Pine Script v6 agent workflows

For Contributors

  • Contributing Guide - How to contribute
  • Architecture - Technical decisions
  • Test Strategy - Testing approach

Project Info

  • Changelog - Version history
  • Coverage Analysis - What we validate

🐛 Known Limitations

This extension focuses on syntax validation, not runtime behavior:

✅ What We Validate

  • Syntax correctness (valid Pine Script v6 code)
  • Undefined functions/variables/namespaces
  • Missing required parameters
  • Too many parameters
  • Invalid constant references

❌ What We Don't Validate

  • Type mismatches (int vs float)
  • Runtime errors (division by zero, etc.)
  • Logic errors (impossible conditions)
  • Pine Script runtime limits (max variables, max plots, etc.)

These are intentional limitations - a syntax validator shouldn't predict runtime behavior.


📝 License

This project is licensed under the MIT License - see LICENSE for details.

No Warranty

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. See license for full details.


⚠️ Disclaimer

This is an independent community project and is not affiliated with, endorsed by, or sponsored by TradingView.

  • Pine Script™ is a trademark of TradingView, Inc.
  • All TradingView documentation references are for compatibility purposes only
  • Use at your own risk

🙏 Acknowledgments

  • TradingView - For creating Pine Script and providing comprehensive documentation
  • VS Code Team - For the excellent extension API
  • Contributors - Thank you to everyone who has contributed!

📬 Support

  • Issues: Report bugs via GitHub Issues
  • Questions: Ask in GitHub Discussions
  • Updates: Watch this repo for new releases

Made with ❤️ by the community, for the community.

Happy Trading! 📈

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft