Version 3.1 is a major update that adds full Pine Script v6 support, fixes critical version detection issues, and improves the overall architecture and documentation.
What's New:
- Full support for Pine Script v6 (latest version from TradingView)
- Support for v6-exclusive features:
typekeyword for custom data structures (structs)enumkeyword for enumeration typesmapnamespace with full key-value collection support
New Functions (10+):
map.new<K, V>()- Create mapsmap.put(map, key, value)- Add/update entriesmap.get(map, key)- Retrieve valuesmap.contains(map, key)- Check key existencemap.remove(map, key)- Remove entriesmap.keys(map)- Get all keysmap.values(map)- Get all valuesmap.size(map)- Get entry countmap.clear(map)- Clear maptype- Define custom typesenum- Define enumerations
Enhanced Data Types:
- Added
MAP,ENUM,STRUCTdata types to type system - Updated function signature database to 110+ functions
- Full parameter validation for v6 functions
Problem:
- Documentation claimed v6 support but code still marked v5 as latest
- Default version detection returned v5 instead of v6
- Conversion system didn't support v5→v6 migration
Solution:
- Updated default version detection to return v6
- Implemented
_convert_to_v6()method in VersionConverter - Updated all docstrings and documentation to reflect v6 as latest
- Fixed version detection confidence scoring for v6 features
Files Changed:
tradingview_mcp/pine_script/versions.py(lines 5, 40-42, 198, 242-280, 383-400)tradingview_mcp/pine_script/signatures.py(added v6 functions)tradingview_mcp/server.py(updated tool descriptions)
Problem:
- Some docs said v1-v5, others said v1-v6
- Server instructions mentioned v1-v5 only
- No examples of v6 features
Solution:
- Unified all documentation to clearly state v6 as latest
- Added comprehensive v6 feature examples
- Updated all MCP tool descriptions
- Added v6 migration guides
Files Updated:
README.mdPINE_SCRIPT.mdtradingview_mcp/server.py
ARCHITECTURE.md (NEW)
- Comprehensive architecture documentation
- Current modular structure explained
- Future architecture proposal for v4.0
- Module interface specifications
- Migration strategy for contributors
V3.1_IMPROVEMENTS.md (NEW)
- This file - comprehensive change summary
- Feature breakdown
- Migration guide
- Known limitations
PINE_SCRIPT.md:
- Added "Pine Script v6 Features" section with examples
- Updated all version references to v1-v6
- Added v6 migration examples (type, enum, map)
- Updated best practices for v6
README.md:
- Highlighted v6 support prominently
- Updated feature lists with v6 capabilities
- Added architecture section
- Updated version history
Current Structure:
tradingview_mcp/
├── api/ # TradingView Analysis
├── indicators/ # TradingView Analysis
├── utils/ # TradingView Analysis
└── pine_script/ # Pine Script Tools (separate concern)
Benefits:
- Clear separation of concerns
- TradingView analysis logic isolated from Pine Script tools
- Easier to maintain and extend
- Better test organization
New Types Added:
DataType.MAPfor v6 map collectionsDataType.ENUMfor v6 enumerationsDataType.STRUCTfor v6 custom types
Signature Database:
- Expanded from 50+ to 110+ functions
- Complete v6 namespace coverage
- Enhanced parameter validation
New Converter:
def _convert_to_v6(code: str) -> Tuple[str, List[str], List[str]]:
"""Convert code to Pine Script v6"""Features:
- Backward compatibility checking
- Informational warnings about v6 features
- Suggestions for using new v6 capabilities
Enhanced Detection:
- Detects v6-specific keywords:
struct,enum - Recognizes
map.*namespace usage - Higher confidence scoring for v6 features
- Better suggestions for upgrading to v6
-
tradingview_mcp/pine_script/signatures.py
- Added 10+ v6 map functions
- Added type and enum keywords
- Added MAP, ENUM, STRUCT data types
- Updated header to mention v6 support
-
tradingview_mcp/pine_script/versions.py
- Updated header to mention v6 support
- Changed default version from v5 to v6
- Added v6 feature detection
- Implemented
_convert_to_v6()method - Enhanced version suggestions
-
tradingview_mcp/server.py
- Updated server instructions to mention v6
- Updated tool descriptions to include v6 support
- Changed version parameters from (1-5) to (1-6)
-
PINE_SCRIPT.md
- Updated overview to highlight v6 as latest
- Added comprehensive v6 features section with examples
- Updated supported versions list
- Updated version conversion section
- Updated best practices for v6
- Updated version history
-
README.md
- Updated Pine Script tools section
- Highlighted v6 support prominently
- Updated MCP tools descriptions
- Updated version history
- Added architecture section
-
ARCHITECTURE.md
- Complete architecture documentation
- Current and proposed structure
- Module interfaces
- Migration strategies
-
V3.1_IMPROVEMENTS.md
- This file - comprehensive change summary
- ✅ No breaking changes
- ✅ Backward compatible with v1-v5 code
- ✅ Enhanced error messages
- ✅ Better type safety
- ✅ No performance regression
- ✅ Same caching strategy
- ✅ Efficient v6 function lookup
- ✅ All existing tests pass
⚠️ Need to add v6-specific tests (future work)
No changes required! Your existing setup continues to work.
To use v6 features:
- Start your Pine Script with
//@version=6 - Use new v6 features:
type,enum,map - Ask Claude to validate your v6 code
Example:
//@version=6
indicator("My V6 Indicator")
// Use v6 map feature
var myMap = map.new<string, float>()
map.put(myMap, "price", close)
// Use v6 type feature
type TradeSetup
float entry
float stop
plot(close)
If updating Pine Script code:
- Check
ARCHITECTURE.mdfor structure - Add v6 functions to
signatures.pyif needed - Update tests to cover v6 features
- Follow existing code patterns
If adding new features:
- Determine if it's TradingView analysis or Pine Script tool
- Place code in appropriate module
- Update documentation
- Add tests
- Files Modified: 5
- Files Added: 2
- Lines Added: ~350
- Lines Modified: ~50
- Functions Added: 12 (v6 features)
- New Docs: 2 files (1500+ lines)
- Updated Docs: 3 files
- Code Examples: 15+ new examples
- Pine Script Versions: v1, v2, v3, v4, v5, v6 ✅
- Built-in Functions: 110+ ✅
- Namespaces: ta, math, str, array, map, strategy, input ✅
Current State:
- Basic v6 keyword detection works
- Function signature validation works
- Map namespace fully supported
Missing:
- Deep validation of custom type definitions
- Enum value validation
- Complex struct member validation
Workaround:
- Use TradingView's online editor for complex v6 validation
- Basic syntax validation still works
Current State:
- General error explanations work
- Type errors detected
Missing:
- v6-specific error codes
- Custom type error explanations
Planned:
- Will add in v3.2 based on user feedback
Existing Limitation:
- Historical data only works for Forex
- Crypto/Stocks only have real-time quotes
Not addressed in v3.1:
- This is an Alpha Vantage API limitation
- Will require additional API integrations
- Add v6-specific tests
- Enhanced v6 error messages
- Custom type validation improvements
- Performance optimizations
- Full modular architecture refactor
- Separate
tradingview_analysismodule - Separate
pine_script_toolsmodule - Lightweight orchestrator server
- Plugin system for extensions
This update was made possible by:
- TradingView's Pine Script v6 documentation
- User feedback and bug reports
- Community contributions
Issues:
Documentation:
- Main README: README.md
- Pine Script Guide: PINE_SCRIPT.md
- Architecture: ARCHITECTURE.md
- Contributing: CONTRIBUTING.md
Version: 3.1.0 Release Date: 2025-01-XX Status: ✅ Complete