Skip to main content
Glama
patch-ridermg48

TradingView MCP Server

coin_analysis

Analyze cryptocurrency performance using technical indicators and metrics for specific coins, exchanges, and timeframes to support trading decisions.

Instructions

Get detailed analysis for a specific coin on specified exchange and timeframe.

Args:
    symbol: Coin symbol (e.g., "ACEUSDT", "BTCUSDT")
    exchange: Exchange name (BINANCE, KUCOIN, etc.) 
    timeframe: Time interval (5m, 15m, 1h, 4h, 1D, 1W, 1M)

Returns:
    Detailed coin analysis with all indicators and metrics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes
exchangeNoKUCOIN
timeframeNo15m

Implementation Reference

  • The coin_analysis tool handler. Uses tradingview_ta.get_multiple_analysis to fetch indicators for the specified symbol, computes metrics using compute_metrics, and returns a comprehensive analysis dictionary including price data, Bollinger Band analysis, technical indicators (RSI, MACD, ADX, Stoch), and market sentiment.
    @mcp.tool()
    def coin_analysis(
        symbol: str,
        exchange: str = "KUCOIN",
        timeframe: str = "15m"
    ) -> dict:
        """Get detailed analysis for a specific coin on specified exchange and timeframe.
        
        Args:
            symbol: Coin symbol (e.g., "ACEUSDT", "BTCUSDT")
            exchange: Exchange name (BINANCE, KUCOIN, etc.) 
            timeframe: Time interval (5m, 15m, 1h, 4h, 1D, 1W, 1M)
        
        Returns:
            Detailed coin analysis with all indicators and metrics
        """
        try:
            exchange = sanitize_exchange(exchange, "KUCOIN")
            timeframe = sanitize_timeframe(timeframe, "15m")
            
            # Format symbol with exchange prefix
            if ":" not in symbol:
                full_symbol = f"{exchange.upper()}:{symbol.upper()}"
            else:
                full_symbol = symbol.upper()
            
            screener = EXCHANGE_SCREENER.get(exchange, "crypto")
            
            try:
                analysis = get_multiple_analysis(
                    screener=screener,
                    interval=timeframe,
                    symbols=[full_symbol]
                )
                
                if full_symbol not in analysis or analysis[full_symbol] is None:
                    return {
                        "error": f"No data found for {symbol} on {exchange}",
                        "symbol": symbol,
                        "exchange": exchange,
                        "timeframe": timeframe
                    }
                
                data = analysis[full_symbol]
                indicators = data.indicators
                
                # Calculate all metrics
                metrics = compute_metrics(indicators)
                if not metrics:
                    return {
                        "error": f"Could not compute metrics for {symbol}",
                        "symbol": symbol,
                        "exchange": exchange,
                        "timeframe": timeframe
                    }
                
                # Additional technical indicators
                macd = indicators.get("MACD.macd", 0)
                macd_signal = indicators.get("MACD.signal", 0)
                adx = indicators.get("ADX", 0)
                stoch_k = indicators.get("Stoch.K", 0)
                stoch_d = indicators.get("Stoch.D", 0)
                
                # Volume analysis
                volume = indicators.get("volume", 0)
                
                # Price levels
                high = indicators.get("high", 0)
                low = indicators.get("low", 0)
                open_price = indicators.get("open", 0)
                close_price = indicators.get("close", 0)
                
                return {
                    "symbol": full_symbol,
                    "exchange": exchange,
                    "timeframe": timeframe,
                    "timestamp": "real-time",
                    "price_data": {
                        "current_price": metrics['price'],
                        "open": round(open_price, 6) if open_price else None,
                        "high": round(high, 6) if high else None,
                        "low": round(low, 6) if low else None,
                        "close": round(close_price, 6) if close_price else None,
                        "change_percent": metrics['change'],
                        "volume": volume
                    },
                    "bollinger_analysis": {
                        "rating": metrics['rating'],
                        "signal": metrics['signal'],
                        "bbw": metrics['bbw'],
                        "bb_upper": round(indicators.get("BB.upper", 0), 6),
                        "bb_middle": round(indicators.get("SMA20", 0), 6),
                        "bb_lower": round(indicators.get("BB.lower", 0), 6),
                        "position": "Above Upper" if close_price > indicators.get("BB.upper", 0) else 
                                   "Below Lower" if close_price < indicators.get("BB.lower", 0) else 
                                   "Within Bands"
                    },
                    "technical_indicators": {
                        "rsi": round(indicators.get("RSI", 0), 2),
                        "rsi_signal": "Overbought" if indicators.get("RSI", 0) > 70 else
                                     "Oversold" if indicators.get("RSI", 0) < 30 else "Neutral",
                        "sma20": round(indicators.get("SMA20", 0), 6),
                        "ema50": round(indicators.get("EMA50", 0), 6),
                        "ema200": round(indicators.get("EMA200", 0), 6),
                        "macd": round(macd, 6),
                        "macd_signal": round(macd_signal, 6),
                        "macd_divergence": round(macd - macd_signal, 6),
                        "adx": round(adx, 2),
                        "trend_strength": "Strong" if adx > 25 else "Weak",
                        "stoch_k": round(stoch_k, 2),
                        "stoch_d": round(stoch_d, 2)
                    },
                    "market_sentiment": {
                        "overall_rating": metrics['rating'],
                        "buy_sell_signal": metrics['signal'],
                        "volatility": "High" if metrics['bbw'] > 0.05 else "Medium" if metrics['bbw'] > 0.02 else "Low",
                        "momentum": "Bullish" if metrics['change'] > 0 else "Bearish"
                    }
                }
                
            except Exception as e:
                return {
                    "error": f"Analysis failed: {str(e)}",
                    "symbol": symbol,
                    "exchange": exchange,
                    "timeframe": timeframe
                }
                
        except Exception as e:
            return {
                "error": f"Coin analysis failed: {str(e)}",
                "symbol": symbol,
                "exchange": exchange,
                "timeframe": timeframe
            }
  • Helper function compute_metrics called within coin_analysis to calculate key metrics: price change, Bollinger Band width (bbw), BB rating and signal from raw indicators.
    def compute_metrics(indicators: Dict) -> Optional[Dict]:
        try:
            open_price = indicators["open"]
            close = indicators["close"]
            sma = indicators["SMA20"]
            bb_upper = indicators["BB.upper"]
            bb_lower = indicators["BB.lower"]
            bb_middle = sma
    
            change = compute_change(open_price, close)
            bbw = compute_bbw(sma, bb_upper, bb_lower)
            rating, signal = compute_bb_rating_signal(close, bb_upper, bb_middle, bb_lower)
    
            return {
                "price": round(close, 4),
                "change": round(change, 3),
                "bbw": round(bbw, 4) if bbw is not None else None,
                "rating": rating,
                "signal": signal,
            }
        except (KeyError, TypeError):
            return None
  • The @mcp.tool() decorator registers the coin_analysis function as an MCP tool.
    @mcp.tool()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool returns ('Detailed coin analysis with all indicators and metrics') but provides no information about rate limits, authentication requirements, data freshness, error conditions, or whether this is a read-only operation versus one that might trigger computations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with a clear purpose statement followed by organized Args and Returns sections. Every sentence earns its place: the first establishes the core function, while the parameter and return explanations provide essential context without redundancy. The formatting with clear section headers enhances readability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 3-parameter tool with no annotations and no output schema, the description provides adequate basic information about what the tool does and what parameters it accepts. However, it lacks important contextual details about the analysis methodology, what 'all indicators and metrics' includes, whether there are limitations on historical data, or how this differs from the sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates well by explaining all three parameters in the Args section. It provides concrete examples for 'symbol' (ACEUSDT, BTCUSDT), lists possible exchanges, and enumerates timeframe options. This adds significant value beyond the bare schema, though it doesn't specify whether exchange names are case-sensitive or if additional timeframes might be supported.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get detailed analysis') and resource ('for a specific coin'), making it immediately understandable. However, it doesn't explicitly differentiate this coin analysis tool from its siblings like 'rating_filter' or 'volume_confirmation_analysis', which might also provide coin-related insights.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus the nine sibling tools listed. It mentions the required parameters but gives no context about when this analysis is appropriate compared to alternatives like 'top_gainers' or 'bollinger_scan', leaving the agent to guess based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/patch-ridermg48/tradingview-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server