Skip to main content
Glama
TradingView OpenCode Agent

TradingView OpenCode Agent

by jadatorin

TradingView OpenCode Agent 🤖

Conecta tu TradingView Desktop con opencode.ai para análisis de charts con IA.

Este proyecto está INSPIRADO en tradingview-mcp de tradesdontlie. No es un fork directo — es una reimplementación con código 100% original y documentación en español/inglés.

✨ Características

Característica

Descripción

📊 Análisis de Chart

Lee indicadores, niveles, tablas de Pine, y estado del gráfico

📈 Indicadores

SMC, ICT, RSI, MACD, Bollinger Bands, VWAP, EMA, SMA, Stochastic, y más...

🎯 Niveles SMC

Detecta CHoCH, BOS, SFP, Fair Price Zones, zonas de liquidez

⏪ Replay Mode

Practica trading en datos históricos con control de barras

📋 Reports

Genera reportes de estrategia con métricas de rendimiento

🔍 Multi-Symbol

Escanea múltiples instrumentos en batch

📸 Screenshots

Captura charts automáticamente para análisis

🔔 Alertas

Crea y gestiona alertas de precio

Related MCP server: TradingView MCP Bridge

🚀 Instalación Rápida

# 1. Clonar el repo
git clone https://github.com/jadatorin/tradingview-opencode-agent.git
cd tradingview-opencode-agent

# 2. Instalar dependencias
npm install

# 3. Configurar opencode.ai
# Agregar a tu ~/.config/opencode/mcp.json:
{
  "mcp": {
    "tradingview": {
      "command": ["node", "C:/Users/TU_USUARIO/proyects/tradingview-opencode-agent/src/index.js"],
      "type": "local"
    }
  }
}

# 4. Iniciar TradingView con CDP (Chrome + sesión persistente)
.\launchers\launch_tv_cdp.ps1

   # Alternativa: si tenés la versión Desktop (MSIX/Store):
   .\launchers\launch_tv_msix.ps1
   # ⚠️ MSIX no soporta CDP — las tools MCP no conectarán

# 5. Verificar conexión
npm run test

📋 Requisitos

Requisito

Versión Mínima

Node.js

18+

TradingView Desktop

Windows/Mac/Linux (cualquiera)

opencode.ai

Cliente MCP-compatible

Suscripción TradingView

Para datos en tiempo real (opcional)

🎯 Uso Rápido

Análisis de Chart

"Analiza mi chart de ES1! en 15 minutos"
"Qué indicadores tengo activos?"
"Cuáles son los niveles de soporte y resistencia?"
"Dame un screenshot del gráfico actual"

Pine Script

"Escribe un indicador de VWAP con bandas"
"Compila mi script de estrategia"
"Hay errores de compilación? cuales?"
"Agrega un oscilador estocástico"

Replay Trading

"Inicia replay en SPY desde marzo 2025"
"Avanza 5 velas hacia adelante"
"Toma una posición larga en el último swing"
"Cierra la posición y muéstrame el P&L"

Multi-Symbol Scan

"Escanea ES, NQ, YM para oportunidades alcistas"
"Compara RSI en BTC, ETH y SOL"
"Múltiples screenshots de mi watchlist"

📁 Estructura del Proyecto

tradingview-opencode-agent/
├── src/                          # Servidor MCP
│   ├── index.js                  # Entry point
│   ├── server.js                 # Implementación del servidor
│   ├── config.js                 # Configuración centralizada
│   └── utils/
│       ├── cdp-client.js         # Cliente Chrome DevTools Protocol
│       └── trading-helpers.js    # Helpers de TradingView
│
├── opencode-skills/              # Skills para opencode.ai
│   ├── SKILL.md                  # Dispatcher principal
│   ├── chart-analysis/           # Análisis técnico
│   ├── pine-develop/             # Desarrollo Pine Script
│   ├── replay-practice/          # Modo replay
│   ├── multi-symbol-scan/        # Escaneo multi-símbolo
│   ├── strategy-report/          # Reportes de estrategia
│   └── docs/                     # Docs de referencia
│
├── launchers/                    # Scripts de lanzamiento
│   ├── launch_tv_cdp.ps1         # [RECOMENDADO] Chrome + CDP + sesión persistente
│   ├── launch_tv.ps1             # Windows universal (detecta cualquier versión)
│   ├── launch_tv.sh              # Linux/macOS
│   ├── launch_tv_desktop.ps1     # Desktop installer
│   ├── launch_tv_msix.ps1        # Microsoft Store (sin CDP)
│   ├── start_all.ps1             # Lanza CDP + MCP server en un solo comando
│   └── start_mcp.ps1             # Solo MCP server (cuando TV ya está abierto)
│
├── docs/                         # Documentación principal
└── package.json                  # Dependencias Node.js

🔧 Configuración

Variables de Entorno (opcional)

# Puerto de debug de Chrome (default: 9222)
CDP_PORT=9222

# Host de Chrome (default: localhost)
CDP_HOST=localhost

# Directorio para screenshots (default: ./screenshots)
SCREENSHOT_DIR=./screenshots

# Timeout de operaciones (default: 30000ms)
TIMEOUT_MS=30000

Configuración de MCP

OpenCode (formato correcto)

{
  "mcp": {
    "tradingview": {
      "command": ["node", "C:/Users/TU_USUARIO/proyects/tradingview-opencode-agent/src/index.js"],
      "type": "local"
    }
  }
}

Claude Desktop / Cursor

{
  "mcpServers": {
    "tradingview": {
      "command": "node",
      "args": ["C:/Users/TU_USUARIO/proyects/tradingview-opencode-agent/src/index.js"]
    }
  }
}

Tip: Para rutas relativas usa ./src/index.js si el config está en la raíz del proyecto.

🛡️ Seguridad

Aspecto

Estado

✅ Código 100% original

Auditado, sin dependencias externas

✅ Sin conexiones a servidores

Todo corre localmente

✅ Sin recopilación de datos

No hay telemetry ni tracking

✅ Chrome DevTools Protocol

Conexión local a tu app

📚 Documentación Detallada

Documento

Descripción

INSTALL

Guía paso a paso de instalación

MCP

Configuración detallada de MCP

ARCHITECTURE

Arquitectura técnica del proyecto

TROUBLESHOOTING

Problemas comunes y soluciones

../launchers/README.md

Scripts de lanzamiento

../opencode-skills/SKILL.md

Skills de opencode.ai

🤝 Contribuir

# 1. Fork el repo
# 2. Crea una rama
git checkout -b feature/nueva-feature

# 3. Commit con convencionales
git commit -m 'feat: nueva feature awesome'

# 4. Push
git push origin feature/nueva-feature

# 5. Abre un Pull Request

📜 Licencia

MIT License — ver LICENSE

👥 Autores

jadatorin (aka bitorin)

Inspirado por: tradesdontlie/tradingview-mcp


⭐ Si te resultó útil, dale una estrella al repo!

Available Tools

22 tools
alert_createC

Create a new alert

Inputs: condition (required), symbol, message, interval.

alert_deleteB

Delete an alert by ID

Inputs: id (required).

alert_listB

List all alerts

Inputs: no named parameters.

batch_runC

Execute operations across multiple symbols

Inputs: symbols (required), operation (required), count, timeframe.

capture_screenshotC

Capture chart screenshot

Inputs: filename, full_page.

chart_get_stateB

Get current chart state: symbol, timeframe, indicators

Inputs: no named parameters.

data_get_ohlcvB

Get historical OHLCV bars

Inputs: symbol (required), to, from, count, +1 more.

data_get_pine_labelsB

Get drawn labels from Pine scripts

Inputs: all.

data_get_pine_linesB

Get drawn lines from Pine scripts

Inputs: all.

data_get_pine_tablesB

Get table data from Pine scripts

Inputs: table_id.

data_get_study_valuesB

Get values from indicators/studies on chart

Inputs: symbols, study_id.

draw_clearB

Clear all drawings or drawings of a type

Inputs: type.

draw_listB

List all drawn objects on chart

Inputs: type.

draw_removeB

Remove a drawn object by ID

Inputs: id (required).

draw_shapeC

Draw a shape on the chart

Inputs: type (required), points (required), text, style.

quote_getA

Get current quote (price, OHLC) for a symbol

Inputs: symbol (required).

replay_startC

Start replay mode

Inputs: to, from.

replay_statusB

Get current replay status

Inputs: no named parameters.

replay_stepA

Advance replay by one bar

Inputs: no named parameters.

replay_stopA

Stop replay mode

Inputs: no named parameters.

tv_health_checkA

Verify CDP connection to TradingView/Chrome

Inputs: no named parameters.

tv_launchC

Detect and launch TradingView application

Inputs: url, browser.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 22 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose, targeting specific actions like data retrieval, drawing, or replay. Overlaps are minimal and descriptions clarify differences, e.g., quote_get vs data_get_ohlcv or study vs pine objects.

    Naming Consistency4/5

    Most tools follow a domain_verb_object pattern (e.g., chart_get_state, alert_create), but batch_run and tv_launch deviate slightly in structure. Overall consistent within each subdomain.

    Tool Count3/5

    With 22 tools, the set is on the heavier side, bordering on excessive for a charting assistant. While each tool serves a distinct function, the overall count could be streamlined without losing core capabilities.

    Completeness3/5

    The tool set covers major areas like data, drawings, alerts, and replay, but lacks essential chart modification tools (e.g., set symbol/timeframe, add/remove indicators). This limits the agent's ability to perform full chart interactions.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Personal AI assistant for your TradingView Desktop charts. Connects AI to your locally running TradingView app via Chrome DevTools Protocol for AI-assisted chart analysis, Pine Script development, and workflow automation.
      88 npm
      -
    • F
      license
      Not graded
      quality
      C
      maintenance
      Connects AI assistants to TradingView Desktop for chart analysis, Pine Script development, and workflow automation via Chrome DevTools Protocol.
      88 npm
      -
    • F
      license
      Not graded
      quality
      C
      maintenance
      Connects AI assistants to TradingView Desktop for chart analysis, Pine Script development, and automation via Chrome DevTools Protocol.
      88 npm
      -