INNER CODE UNIT · Python
get_cci
Spoofkapoof/TradingViewMCPServer · tradingview_mcp/server.py:712
def get_cci(symbol: str, timeframe: str = "1h", period: int = 20) -> dict:
"""
Calculate CCI (Commodity Channel Index).
Args:
symbol: Symbol (e.g., 'EURUSD', 'AAPL', 'BTC')
timeframe: Time interval ('5m', '15m', '1h', '4h', '1d')
period: Period for calculation (default 20)
Returns:
CCI value and signal (OVERBOUGHT/OVERSOLD/NEUTRAL)
"""
hist_data = get_historical_data(symbol, timeframe)
if not hist_data.get("success"):
return hist_data
cci = calculate_cci(hist_data["data"], period)