Skip to content

v0.4.4 - Parser Database Fixes & Validation Improvements

Choose a tag to compare

@github-actions github-actions released this 07 Oct 09:03
· 127 commits to main since this release

🔧 Pine Script v6 Extension - v0.4.4

Critical Parser Database Fixes

This release fixes two important false positive validation errors that were affecting users working with mathematical functions and strategy scripts.


✨ What's Fixed

1. math.round() Parameter Definition ✅

Problem: Validator incorrectly reported "Too many arguments for 'math.round'" when using precision parameter.

Fixed: math.round() now correctly accepts optional precision parameter.

Before (v0.4.3):

rounded = math.round(close, 2)  // ❌ ERROR: Too many arguments

After (v0.4.4):

rounded = math.round(close, 2)  // ✅ Valid - rounds to 2 decimal places

2. strategy. Variable Properties* ✅

Problem: Validator reported "Unknown strategy constant or function 'position_size'" for valid strategy variables.

Fixed: Added 32 missing strategy.* runtime state variables.

Now Supported:

// Position tracking
strategy.position_size           // Current position size
strategy.position_avg_price      // Average entry price
strategy.position_entry_name     // Entry signal name

// Account metrics
strategy.equity                  // Current account equity
strategy.netprofit              // Net profit/loss
strategy.grossprofit            // Gross profit
strategy.grossloss              // Gross loss

// Trade statistics
strategy.closedtrades           // Number of closed trades
strategy.opentrades             // Number of open trades
strategy.wintrades              // Number of winning trades
strategy.losstrades             // Number of losing trades

// ... and 20 more variables

Example Usage:

//@version=6
strategy("My Strategy")

// No more false positives! ✅
if strategy.position_size > 0
    strategy.close("Long")
    
plot(strategy.equity, "Equity")
plot(strategy.netprofit, "Net Profit")

🧹 Project Improvements

Cleaned Up Project Structure

  • Organized 26 dev/debug/test scripts into dev-tools/ folder
    • dev-tools/debug/ - 10 debugging scripts
    • dev-tools/analysis/ - 6 analysis scripts
    • dev-tools/testing/ - 10 test scripts
  • Moved test Pine files to examples/
  • Removed legacy session documentation (preserved in git history)

📊 Testing & Validation

Comprehensive Testing ✅

  • 67/67 unit tests passing (100%)
  • 7/8 example files validated (1 intentionally has errors for testing)
  • All v0.4.4 fixes verified with dedicated test suite

Test Results

✅ Test 1: math.round(value, precision) - PASS
✅ Test 2: strategy.position_size - PASS
✅ Test 3: Other strategy.* variables - PASS

📦 Files Modified

  • v6/parameter-requirements-generated.ts: Added precision parameter to math.round
  • v6/pine-constants-complete.ts: Added STRATEGY_VARIABLES set with 32 runtime state variables

🚀 Installation

From VSIX

  1. Download pinescript-v6-extension-0.4.4.vsix from assets below
  2. In VS Code: Extensions → ⋯ (More Actions) → Install from VSIX...
  3. Select the downloaded file

From Marketplace

Search for "Pine Script v6 IDE Tools" in VS Code Extensions


📝 Full Changelog

See CHANGELOG.md for complete details.


🙏 Credits

Thanks to all users who reported validation issues. Your feedback helps improve the extension!


Full Language Coverage: 6,665 Pine Script v6 constructs
Test Coverage: 67 comprehensive tests
Package Size: 1.79 MB