# TradingViewMCPServer - Project Summary
## š Overview
**TradingViewMCPServer** is a comprehensive Model Context Protocol (MCP) server that provides TWO powerful functionalities:
1. **TradingView Analysis Tools** - Real-time market data, technical indicators, and trading analysis
2. **Pine Script Development Tools** - Complete IDE-like environment for Pine Script development
### Current Version
**v3.1.0** - Latest with full Pine Script v6 support
---
## šÆ Quick Reference
### Documentation Structure
```
TradingViewMCPServer/
āāā README.md # Main documentation - Start here!
āāā CHANGELOG.md # Version history (consolidated)
āāā docs/ # Documentation
ā āāā ARCHITECTURE.md # Architecture details
ā āāā CONTRIBUTING.md # How to contribute
ā āāā guides/ # Usage guides
ā āāā releases/ # Release notes
āāā examples/ # Example code
āāā pine-scripts/ # Pine Script strategies
āāā README.md # Strategy folder guide
āāā indicators/ # Custom indicators
āāā strategies/ # Trading strategies
āāā overlays/ # Chart overlays
āāā examples/ # Example scripts
```
### Key Documentation
| Document | Purpose | When to Use |
|----------|---------|-------------|
| [README.md](../README.md) | Main documentation, features, installation | First time setup, feature overview |
| [ARCHITECTURE.md](ARCHITECTURE.md) | Project structure, design | Understanding codebase, contributing |
| [CHANGELOG.md](../CHANGELOG.md) | Version history | See what's new, migration |
| [guides/PINE_SCRIPT.md](guides/PINE_SCRIPT.md) | Pine Script tools guide | Developing Pine Script code |
| [releases/](releases/) | Version release notes | Understanding specific version updates |
| [examples/pine-scripts/README.md](../examples/pine-scripts/README.md) | Strategy organization | Storing your Pine Script code |
---
## š Features
### TradingView Analysis Tools
#### Market Data
- Multi-asset support (Forex, Stocks, Crypto)
- 22+ Forex pairs
- Real-time quotes
- Historical data
#### Technical Indicators (20+)
- Trend: MA, MACD, ADX, Ichimoku
- Momentum: Stochastic, RSI
- Volatility: Bollinger Bands, ATR
- Volume: VWAP, Volume Profile, Market Profile
- S/R: Support/Resistance, Pivot Points, Gaps
### Pine Script Development Tools (v1-v6 Support)
#### 8 MCP Tools
1. **validate_pine_script** - Real-time validation
2. **get_pine_documentation** - Function docs (110+ functions)
3. **test_pine_script** - Safe sandbox testing
4. **explain_pine_error** - Error explanations
5. **detect_pine_version** - Version detection (v1-v6)
6. **convert_pine_version** - Version conversion (v3āv4āv5āv6)
7. **autocomplete_pine** - Code completion
8. **get_pine_template** - Code templates
#### Pine Script v6 Features (LATEST!)
- **type** - Custom data structures (structs)
- **enum** - Enumeration types
- **map.*** - Key-value collections
- 11 new v6-specific functions
- Enhanced type system
---
## š Project Structure
### Clean Modular Architecture
```
TradingViewMCPServer/
āāā tradingview_mcp/ # Main package
ā āāā server.py # MCP server (orchestrator)
ā āāā config.py # Configuration
ā ā
ā āāā api/ # TradingView Analysis
ā ā āāā alpha_vantage.py # API client
ā ā āāā cache.py # Caching layer
ā ā
ā āāā indicators/ # TradingView Analysis
ā ā āāā trend.py # MA, MACD, ADX, Ichimoku
ā ā āāā momentum.py # Stochastic, RSI
ā ā āāā volatility.py # Bollinger, ATR
ā ā āāā volume.py # VWAP, Volume Profile
ā ā āāā support_resistance.py # S/R, Pivots, Gaps
ā ā
ā āāā utils/ # TradingView Analysis
ā ā āāā asset_detector.py # Asset type detection
ā ā āāā formatters.py # Response formatting
ā ā
ā āāā pine_script/ # Pine Script Tools (separate!)
ā āāā lexer.py # Tokenization
ā āāā parser.py # AST parsing
ā āāā validator.py # Validation
ā āāā signatures.py # Function database (110+)
ā āāā errors.py # Error explanations
ā āāā documentation.py # Docs system
ā āāā sandbox.py # Testing
ā āāā versions.py # Version tools
ā āāā autocomplete.py # Code completion
ā
āāā examples/ # Example code
ā āāā pine-scripts/ # Pine Script strategies
ā āāā indicators/
ā āāā strategies/
ā āāā overlays/
ā āāā examples/
ā
āāā tests/ # Test suite
ā āāā test_cache.py
ā āāā test_indicators.py
ā āāā test_pine_script.py
ā āāā test_utils.py
ā
āāā docs/ # Documentation (see above)
āāā .venv/ # Virtual environment
```
---
## š Quick Start Guide
### 1. Installation
```bash
cd TradingViewMCPServer
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
```
### 2. Configuration
Create `.env` file:
```bash
echo "ALPHA_VANTAGE_API_KEY=your_key_here" > .env
```
Configure Claude Desktop:
```json
{
"mcpServers": {
"tradingview": {
"command": "/path/to/.venv/bin/python",
"args": ["/path/to/tradingview_mcp/server.py", "stdio"]
}
}
}
```
### 3. Usage
**TradingView Analysis:**
```
Ask Claude: "What's the current price of AAPL?"
Ask Claude: "Show me Bollinger Bands for BTC on 1h timeframe"
Ask Claude: "Calculate Fibonacci levels for EURUSD"
```
**Pine Script Development:**
```
Ask Claude: "Validate this Pine Script code: [code]"
Ask Claude: "Convert this v4 code to v6: [code]"
Ask Claude: "Show me documentation for map.new"
Ask Claude: "Create a MACD crossover strategy"
```
---
## š Version History
### v3.1.0 (Current) - Pine Script v6 Support
- Full Pine Script v6 support
- 11 new v6 functions (type, enum, map.*)
- Architecture documentation
- Strategy folder organization
- Consolidated CHANGELOG
### v3.0.0 - Pine Script Integration
- 8 Pine Script MCP tools
- 3000+ lines of Pine Script code
- v1-v5 support
- 110+ function signatures
### v2.0.0 - Complete Refactoring
- Modular architecture (1700 ā 12+ modules)
- Smart caching (70% fewer API calls)
- Rate limiting
- Test suite (60%+ coverage)
### v1.0.0 - Initial Release
- Basic forex trading assistant
- 20+ technical indicators
- Multi-asset support
---
## š ļø Development
### Running Tests
```bash
pip install -r requirements-dev.txt
pytest
pytest --cov=tradingview_mcp --cov-report=html
```
### Code Quality
```bash
black tradingview_mcp/ # Format
mypy tradingview_mcp/ # Type check
flake8 tradingview_mcp/ # Lint
```
### Contributing
1. Read [CONTRIBUTING.md](CONTRIBUTING.md)
2. Check [ARCHITECTURE.md](ARCHITECTURE.md)
3. Create feature branch
4. Add tests
5. Submit PR
---
## šÆ Use Cases
### For Traders
- Get real-time market data
- Analyze technical indicators
- Test trading strategies
- Develop custom Pine Script indicators
### For Developers
- Build trading analysis tools
- Create custom MCP servers
- Learn Pine Script development
- Contribute to open source
### For Researchers
- Backtest strategies
- Analyze market data
- Study technical indicators
- Develop trading algorithms
---
## š Statistics
### Code Metrics
- **Total Python Code**: 6000+ lines
- **Total Documentation**: 5000+ lines
- **Test Coverage**: 60%+
- **Modules**: 21
- **MCP Tools**: 36 (28 trading + 8 Pine Script)
- **Function Signatures**: 110+
### Performance
- **API Calls**: 70% reduction via caching
- **Error Rate**: 90% reduction via rate limiting
- **Validation Speed**: <500ms
- **Cache Hit Rate**: ~85%
---
## š Links
- **GitHub**: https://github.com/lev-corrupted/TradingViewMCPServer
- **Issues**: https://github.com/lev-corrupted/TradingViewMCPServer/issues
- **TradingView**: https://www.tradingview.com
- **Pine Script Docs**: https://www.tradingview.com/pine-script-docs/
- **Alpha Vantage**: https://www.alphavantage.co
---
## š Support
### Getting Help
1. Check documentation (README.md, PINE_SCRIPT.md)
2. Review [CHANGELOG.md](CHANGELOG.md) for version info
3. Search [GitHub Issues](https://github.com/lev-corrupted/TradingViewMCPServer/issues)
4. Ask Claude using the MCP tools
5. Open a new issue with template
### Common Issues
- **Version Detection**: See [PINE_SCRIPT.md](PINE_SCRIPT.md)
- **Error Explanations**: Use `explain_pine_error()` tool
- **API Rate Limits**: Check cache settings in code
- **Installation Issues**: Verify Python 3.10+ and virtual environment
---
## š Key Achievements
ā
**Modular Architecture** - Clean separation of concerns
ā
**Pine Script v6 Support** - Latest version fully supported
ā
**Comprehensive Tools** - 36 MCP tools total
ā
**Well Documented** - 5000+ lines of documentation
ā
**Tested** - 60%+ code coverage
ā
**Performant** - 70% fewer API calls
ā
**Extensible** - Easy to add new features
---
## š Future Roadmap
### v3.2 (Next Minor)
- Enhanced v6 validation
- V6-specific error messages
- Additional tests
- Performance optimizations
### v4.0 (Next Major)
- Separate `tradingview_analysis/` module
- Separate `pine_script_tools/` module
- Lightweight orchestrator server
- Plugin system
---
## š License
MIT License - See LICENSE file
---
## š Acknowledgments
- TradingView for Pine Script
- Alpha Vantage for market data API
- Anthropic for Claude and MCP
- Open source community
---
**Happy Trading & Coding!** šš
*Remember: Past performance does not guarantee future results. Use for educational purposes.*