Production-ready multi-asset trading assistant and Pine Script development server for Claude Desktop
Professional trading assistant supporting Forex, Stocks, and Crypto with 25+ technical indicators, Pine Script v6 development tools, and production-grade reliability.
- π₯ Health Monitoring: Built-in health check tool with cache statistics and API status
- π Auto-Retry Logic: Exponential backoff for network failures (3 retries: 2s, 4s, 8s)
- β‘ LRU Cache: Memory-bounded cache (1000 entries) with automatic eviction
- π³ Docker Support: Production-ready containerization with Docker Compose
- π CI/CD Pipeline: Automated testing across Python 3.9-3.12
- β 100% Test Coverage: 44/44 tests passing
- Multi-Asset Support: Forex (22+ pairs), US Stocks, Cryptocurrencies
- 25+ Technical Indicators: Volume Profile, Market Profile, VWAP, Fibonacci, Bollinger Bands, MACD, Moving Averages, ATR, Support/Resistance, Pivot Points, Stochastic, RSI, CCI, Williams %R, ADX, Ichimoku Cloud, and more
- Full Historical Data: Live quotes and historical data for all asset types (Forex, Stocks, Crypto) via Alpha Vantage API
- Smart Caching: 70% reduction in API calls with intelligent caching
- Claude Desktop Integration: Seamless integration with Claude Desktop via MCP
- Pine Script v6 Support: Full support for latest Pine Script v6 with type, enum, and map! β
- Real-time Syntax Validation: Comprehensive syntax and semantic error checking with line-by-line feedback
- Intelligent Autocomplete: Context-aware code completion with function signatures and documentation
- Live Documentation Access: Instant access to Pine Script function documentation with examples (110+ functions)
- Version Detection: Automatic detection of Pine Script version (v1-v6) with compatibility analysis
- Version Conversion: Automatic code conversion between Pine Script versions (v3βv4βv5βv6)
- Code Testing Sandbox: Safe testing environment with validation and performance metrics
- Error Explanations: Detailed error descriptions with causes, solutions, and code examples
- Code Templates: Ready-to-use templates for indicators, strategies, and overlays
- Python 3.9+ or Docker
- Claude Desktop
- Alpha Vantage API key (Get free key)
# 1. Clone repository
git clone https://github.com/lev-corrupted/TradingViewMCPServer.git
cd TradingViewMCPServer
# 2. Create .env file
echo "ALPHA_VANTAGE_API_KEY=your_key_here" > .env
# 3. Run with Docker Compose
docker-compose up -d
# 4. Check server health
docker-compose logs -f
# 1. Clone repository
git clone https://github.com/lev-corrupted/TradingViewMCPServer.git
cd TradingViewMCPServer
# 2. Create virtual environment
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 3. Install dependencies
pip install -e .
# 4. Create .env file
echo "ALPHA_VANTAGE_API_KEY=your_key_here" > .env
- Configure Claude Desktop:
Edit ~/Library/Application Support/Claude/claude_desktop_config.json
(macOS) or %APPDATA%\Claude\claude_desktop_config.json
(Windows):
{
"mcpServers": {
"tradingview": {
"command": "/absolute/path/to/TradingViewMCPServer/.venv/bin/python",
"args": [
"/absolute/path/to/TradingViewMCPServer/tradingview_mcp/server.py",
"stdio"
]
}
}
}
Replace /absolute/path/to/TradingViewMCPServer
with your actual installation path.
- Restart Claude Desktop
Monitor server health and performance:
Check server health
What's the cache hit rate?
Show me server statistics
Returns:
- Server version and status
- API key configuration
- Cache statistics (size, hit rate, evictions)
- Total API calls made
Ask Claude Desktop natural language questions:
What's the current price of AAPL?
Show me Bollinger Bands for TSLA on 1h timeframe
Calculate Fibonacci levels for BTC
Get MACD for EURUSD with RSI
Show me support and resistance for NVDA
What's the volume profile for SPY?
Give me the Ichimoku Cloud for ETH
Calculate pivot points and CCI for GBPUSD
Analyze AAPL with Williams %R indicator
Ask Claude to help with Pine Script code:
Validate this Pine Script code: [paste code]
Convert this v4 code to v5: [paste code]
Show me documentation for ta.macd
Test this indicator on AAPL 1h timeframe: [paste code]
Explain error E101
Detect the version of this Pine Script: [paste code]
Give me a Pine Script strategy template
health_check
- Server health and cache statistics
get_price
- Get current price for any assetget_multiple_prices
- Batch price quoteslist_available_pairs
- List forex pairslist_supported_assets
- List all supported assets
analyze_pair
- Comprehensive analysisget_trading_recommendation
- Trading signalscalculate_correlation
- Pair correlation
get_volume_profile
- Volume at price levelsget_market_profile
- Market profile with TPO and value areasget_vwap
- Volume Weighted Average Priceget_volume_nodes
- High/low volume nodesdetect_unfilled_gaps
- Price gaps detection
get_stochastic
- Stochastic oscillator (%K, %D)get_rsi
- NEW! RSI (Relative Strength Index)get_cci
- NEW! CCI (Commodity Channel Index)get_williams_r
- NEW! Williams %R
get_moving_averages
- Multiple SMAs/EMAsget_macd
- MACD indicatorget_adx
- Average Directional Index (trend strength)get_ichimoku_cloud
- Ichimoku Cloud
get_bollinger_bands
- Bollinger Bandsget_atr
- Average True Range
get_fibonacci_retracement
- Fibonacci levelsget_support_resistance
- Auto-detected levelsget_pivot_points
- Daily pivot points
validate_pine_script
- Real-time syntax validation with detailed error reporting (v1-v6 support)get_pine_documentation
- Function and topic documentation with examples (110+ functions)test_pine_script
- Safe sandbox testing with metricsexplain_pine_error
- Detailed error explanations with solutionsdetect_pine_version
- Automatic version detection (v1-v6)convert_pine_version
- Automatic version conversion (supports v6!)autocomplete_pine
- Intelligent code completion (includes v6 features)get_pine_template
- Ready-to-use code templates
Major pairs, crosses, exotics, and gold (XAUUSD)
US equities including AAPL, MSFT, GOOGL, AMZN, TSLA, NVDA, META, and more
BTC, ETH, BNB, XRP, ADA, SOL, and other major cryptocurrencies
Alpha Vantage free tier:
- 25 requests per day
- 5 API calls per minute
For higher limits, upgrade to premium API key.
Supported timeframes: 5m
, 15m
, 30m
, 1h
, 4h
, 1d
Major production-grade improvements:
- β LRU Cache: Memory-bounded cache with automatic eviction (1000 entries max)
- β Auto-Retry: Exponential backoff for network failures (3 retries: 2s, 4s, 8s)
- β Health Check: New MCP tool for monitoring and debugging
- β 100% Tests: All 44 tests passing (was 93%)
- β Docker Support: Production-ready Dockerfile and docker-compose.yml
- β CI/CD Pipeline: Automated testing across Python 3.9-3.12
- β Requirements: Separate runtime and dev dependencies
- Fixed version mismatch in pyproject.toml
- Fixed 3 failing tests (ATR, Bollinger Bands, Pine Script v5)
- Verified .env security (not in git)
Test Results: 44/44 passing (100%) | Files Changed: 12 | Lines Added: 661+
See IMPROVEMENTS_v3.4.0.md for full details.
- Added RSI (Relative Strength Index) indicator
- Added CCI (Commodity Channel Index) indicator
- Added Williams %R indicator
- Full historical data support for Stocks and Crypto
- Updated README: 20+ β 25+ indicators
Major update with full Pine Script v6 support:
- Pine Script v6: Full support for the latest Pine Script version
- V6 Data Structures: type (structs), enum, and map collections
- 110+ Function Signatures: Enhanced function database including map.* namespace
- Enhanced Conversion: v3βv4βv5βv6 automatic migration
- 8 Pine Script MCP Tools: Complete development environment
- 3000+ Lines of Pine Script Code: Lexer, parser, validator, and more
- Version Support: Full support for Pine Script v1-v6
- Intelligent Analysis: AST-based parsing and validation
- Context-aware Completion: Namespace-aware autocomplete (ta., math., str., map.)
- Error Database: Detailed explanations for common errors
See PINE_SCRIPT.md for complete Pine Script documentation.
- Modular Design: Clear separation between TradingView analysis and Pine Script tools
- Well-Organized Codebase: Logical grouping by functionality
- Unified MCP Server: Single installation, seamless integration
See ARCHITECTURE.md for detailed architecture documentation.
Initial Pine Script development tools release:
- 8 comprehensive MCP tools
- Support for Pine Script v1-v5
- Automatic code conversion and validation
This version included major improvements and refactoring:
- Modular Structure: Refactored from monolithic 1700-line file to organized modules
api/
: API client with caching and rate limitingindicators/
: Technical indicators organized by typeutils/
: Utility functions and formattersconfig.py
: Centralized configuration
- Smart Caching: In-memory cache with TTL reduces API calls by ~70%
- Rate Limiting: Automatic rate limit protection prevents API errors
- Improved Error Handling: Standardized error responses with helpful suggestions
- Comprehensive Logging: Debug and track all operations
- Type Hints: Full type annotations throughout
- Better Calculations: Fixed MACD, Stochastic, and ADX formulas
- Constants: All magic numbers extracted to named constants
- Test Suite: pytest-based testing framework included
- Lower Python Requirement: Now works with Python 3.9+ (was 3.13+)
- Development Tools: Added black, mypy, pytest, and other dev dependencies
- Better Documentation: Improved docstrings and code comments
- Universal Asset Detection: Automatically detects Forex, Stocks, or Crypto
- Better Forex Detection: Handles various formats (EUR/USD, EURUSD, etc.)
- Cache Statistics: View cache performance with
get_server_stats()
tool
Run the test suite:
# Install development dependencies
pip install -r requirements-dev.txt
# Run all tests
pytest
# Run with coverage
pytest --cov=tradingview_mcp --cov-report=html
# Run specific test file
pytest tests/test_cache.py -v
# Run tests matching pattern
pytest -k "test_cache" -v
- Verify config file path is correct
- Check Python path in config
- Ensure
.env
file exists with valid API key - Restart Claude Desktop
Wait 1 minute between requests or upgrade API key.
Ensure virtual environment is activated and dependencies installed:
source .venv/bin/activate
pip install -e .
MIT License - see LICENSE file for details
We welcome contributions! Please see CONTRIBUTING.md for detailed guidelines.
- Bug Reports: Use the bug report template
- Feature Requests: Use the feature request template
- Code Contributions: Fork, create a branch, and submit a PR
- Documentation: Improvements to README, code comments, or examples
- New technical indicators (RSI, CCI, Williams %R, etc.)
- Performance optimizations
- Additional asset types or markets
- Better error handling
- Enhanced documentation
- Example use cases
See CONTRIBUTING.md for development setup and coding standards.
For issues or questions:
- Check the Troubleshooting section
- Review CONTRIBUTING.md
- Search existing GitHub Issues
- Open a new issue with the appropriate template