| name | tradingview-mcp-assistant |
| description | AI-assisted TradingView chart analysis and automation via Chrome DevTools Protocol for Claude Code |
| triggers | ["analyze my TradingView chart","help me write a Pine Script indicator","automate my TradingView workflow","read indicator values from TradingView","set up multi-chart layout in TradingView","create TradingView price alerts","draw support and resistance levels","practice trading with replay mode"] |
TradingView MCP Assistant
Skill by ara.so — MCP Skills collection.
Personal AI assistant for TradingView Desktop charts. Connects Claude Code to your locally running TradingView app via Chrome DevTools Protocol for AI-assisted chart analysis, Pine Script development, and workflow automation.
Important: This tool requires a valid TradingView subscription and the Desktop app. It communicates only with your local TradingView instance via CDP (Chrome DevTools Protocol) — no external connections, no data transmission.
What This Skill Enables
- Pine Script development — write, compile, debug, and iterate on indicators/strategies
- Chart navigation — change symbols, timeframes, zoom to dates, manage layouts
- Visual analysis — read indicator values, price levels, and Pine Script drawings
- Drawing tools — add trend lines, horizontal lines, rectangles, text annotations
- Alert management — create, list, and delete price alerts
- Replay mode — step through historical bars for practice trading
- Multi-pane layouts — set up 2x2, 3x1 grids with different symbols
- Chart streaming — monitor live data with JSONL output
- CLI access — every MCP tool available as
tv command for scripting
Installation
Prerequisites
- TradingView Desktop app (paid subscription required)
- Node.js 18+
- Claude Code with MCP support
- macOS, Windows, or Linux
Setup Steps
git clone https://github.com/tradesdontlie/tradingview-mcp.git
cd tradingview-mcp
npm install
npm link
Launch TradingView with Debug Mode
TradingView Desktop must run with Chrome DevTools Protocol enabled on port 9222.
macOS:
./scripts/launch_tv_debug_mac.sh
Windows:
scripts\launch_tv_debug.bat
Linux:
./scripts/launch_tv_debug_linux.sh
Or use the MCP tool:
tv_launch()
Configure Claude Code
Add to ~/.claude/.mcp.json or project .mcp.json:
{
"mcpServers": {
"tradingview": {
"command": "node",
"args": ["/absolute/path/to/tradingview-mcp/src/server.js"]
}
}
}
Verify Connection
Ask Claude: "Use tv_health_check to verify TradingView is connected"
Key MCP Tools
Chart Reading (Start Here)
const state = await chart_get_state();
const quote = await quote_get();
const values = await data_get_study_values();
const bars = await data_get_ohlcv({ summary: true });
Pine Script Data (Custom Indicators)
Read line.new(), label.new(), table.new(), box.new() from Pine Scripts:
const lines = await data_get_pine_lines({
study_filter: "Session Levels"
});
const labels = await data_get_pine_labels({
study_filter: "Market Structure"
});
const tables = await data_get_pine_tables({
study_filter: "Volume Profile"
});
const boxes = await data_get_pine_boxes({
study_filter: "Supply Demand"
});
Always use study_filter to target specific indicators — reduces noise and token usage.
Chart Control
await chart_set_symbol({ symbol: "AAPL" });
await chart_set_timeframe({ timeframe: "D" });
await chart_set_type({ type: "HeikinAshi" });
await chart_scroll_to_date({ date: "2025-01-15" });
await chart_set_visible_range({
from: 1705276800,
to: 1705363200
});
await chart_manage_indicator({
action: "add",
name: "Relative Strength Index"
});
await chart_manage_indicator({
action: "remove",
indicator_id: "123abc"
});
Pine Script Development
await pine_set_source({
source: `//@version=5
indicator("My RSI", overlay=false)
rsiValue = ta.rsi(close, 14)
plot(rsiValue, "RSI", color=color.blue)
hline(70, "Overbought", color=color.red)
hline(30, "Oversold", color=color.green)`
});
const result = await pine_smart_compile();
if (!result.success) {
const errors = await pine_get_errors();
}
const logs = await pine_get_console();
await pine_save({ name: "My Custom RSI" });
const code = await pine_get_source();
const analysis = await pine_analyze_code();
Multi-Pane Layouts
const panes = await pane_list();
await pane_set_layout({ layout: "2x2" });
await pane_set_symbol({ pane_index: 0, symbol: "ES1!" });
await pane_set_symbol({ pane_index: 1, symbol: "NQ1!" });
await pane_set_symbol({ pane_index: 2, symbol: "AAPL" });
await pane_set_symbol({ pane_index: 3, symbol: "TSLA" });
await pane_focus({ pane_index: 1 });
Drawing Tools
await draw_shape({
shape_type: "horizontal_line",
price: 24500,
text: "Key Level",
color: "#FF0000"
});
await draw_shape({
shape_type: "trend_line",
price1: 24000,
time1: "2025-01-10T10:00:00Z",
price2: 24500,
time2: "2025-01-15T15:00:00Z",
color: "#00FF00"
});
await draw_shape({
shape_type: "rectangle",
price1: 24000,
time1: "2025-01-10T10:00:00Z",
price2: 24500,
time2: "2025-01-15T15:00:00Z",
fill_color: "#0000FF33"
});
const drawings = await draw_list();
await draw_remove({ drawing_id: "abc123" });
await ();
Alert Management
const alerts = await alert_list();
await alert_create({
symbol: "BTCUSD",
condition: "crossing",
price: 45000,
message: "BTC crossed 45k"
});
await alert_delete({ alert_id: "xyz789" });
Replay Mode
await replay_start({ date: "2025-03-01" });
await replay_step({ direction: "forward", bars: 1 });
await replay_step({ direction: "backward", bars: 5 });
await replay_trade({
action: "long",
price: 24500,
quantity: 1,
stop_loss: 24400,
take_profit: 24700
});
const status = await replay_status();
await replay_autoplay({ speed: 2 });
await replay_stop();
Screenshot Capture
await capture_screenshot({ region: "chart" });
await capture_screenshot({
region: "custom",
x: 100, y: 100, width: 800, height: 600
});
CLI Usage
Every MCP tool is also a tv CLI command. All output is JSON.
tv status
tv launch
tv quote
tv ohlcv --summary
tv state
tv values
tv symbol AAPL
tv timeframe D
tv type HeikinAshi
tv scroll --date 2025-01-15
tv pine get
tv pine compile
tv pine errors
tv pine save "My Indicator"
tv data lines --filter "Levels"
tv data labels --filter "MSB"
tv data tables --filter "Profile"
tv draw shape --type horizontal_line --price 24500
tv draw list
tv draw clear
tv pane layout 2x2
tv pane symbol 0 ES1!
tv pane list
tv stream quote
tv stream bars
tv stream values
tv stream all
tv stream quote | jq
Common Patterns
Full Chart Analysis Workflow
const state = await chart_get_state();
const quote = await quote_get();
const values = await data_get_study_values();
const lines = await data_get_pine_lines({ study_filter: "Levels" });
const labels = await data_get_pine_labels({ study_filter: "Structure" });
const tables = await data_get_pine_tables({ study_filter: "Stats" });
const ohlcv = await data_get_ohlcv({ summary: true });
const screenshot = await capture_screenshot({ region: "chart" });
const analysis = `
Chart: ${state.symbol} ${state.timeframe}
Price: ${quote.close} (${quote.changePercent}%)
RSI: ${values.find(v => v.name.includes('RSI'))?.plots[0]?.value}
Key Levels:
Screenshot:
`;
Pine Script Iteration
const code = `//@version=5
indicator("VWAP Bands", overlay=true)
vwapValue = ta.vwap
stdDev = ta.stdev(close, 20)
upper = vwapValue + stdDev
lower = vwapValue - stdDev
plot(vwapValue, "VWAP", color=color.blue)
plot(upper, "Upper", color=color.red)
plot(lower, "Lower", color=color.green)`;
await pine_set_source({ source: code });
const result = await pine_smart_compile();
if (!result.success) {
const errors = await pine_get_errors();
}
const logs = await pine_get_console();
await pine_save({ name: "VWAP Bands" });
Multi-Symbol Dashboard
await pane_set_layout({ layout: "2x2" });
await pane_set_symbol({ pane_index: 0, symbol: "ES1!" });
await pane_set_symbol({ pane_index: 1, symbol: "NQ1!" });
await pane_set_symbol({ pane_index: 2, symbol: "YM1!" });
await pane_set_symbol({ pane_index: 3, symbol: "RTY1!" });
Automated Level Detection
const lines = await data_get_pine_lines({
study_filter: "Supply Demand Zones"
});
for (const line of lines) {
await alert_create({
symbol: state.symbol,
condition: "crossing",
price: line.y,
message: `Price crossed ${line.text} at ${line.y}`
});
}
Replay Practice Session
await replay_start({ date: "2025-05-01" });
await replay_step({ direction: "forward", bars: 10 });
const quote = await quote_get();
await replay_trade({
action: "long",
price: quote.close,
quantity: 1,
stop_loss: quote.close * 0.98,
take_profit: quote.close * 1.02
});
await replay_step({ direction: "forward", bars: 20 });
Troubleshooting
Connection Issues
tv status
./scripts/launch_tv_debug_mac.sh
lsof -i :9222
netstat -ano | findstr :9222
MCP Tools Not Appearing in Claude
- Check
~/.claude/.mcp.json has absolute path
- Restart Claude Code completely
- Check Claude Code logs: Help → Show Logs
- Verify Node.js version:
node --version (must be 18+)
Pine Script Compilation Fails
const result = await pine_smart_compile();
if (!result.success) {
const errors = await pine_get_errors();
console.log(errors);
}
Indicator Values Empty
const state = await chart_get_state();
console.log(state.indicators);
await indicator_toggle_visibility({
indicator_id: "abc123",
visible: true
});
await new Promise(r => setTimeout(r, 1000));
const values = await data_get_study_values();
Pine Data Returns Empty
const state = await chart_get_state();
const lines = await data_get_pine_lines({
study_filter: "Session Levels"
});
Streaming Stops
./scripts/launch_tv_debug_mac.sh
tv stream quote
High Token Usage
const bars = await data_get_ohlcv({ summary: true });
const lines = await data_get_pine_lines({
study_filter: "Levels"
});
Environment Variables
None required — all communication is local via CDP on port 9222.
Optional CLI customization:
export TV_CDP_PORT=9222
export TV_TIMEOUT=30000
Security Considerations
- No external connections — only localhost CDP (port 9222)
- No data storage — all data stays on your machine
- No TradingView server access — requires valid subscription
- Debug port is local-only — not exposed to network
- Review TradingView Terms of Use for programmatic access compliance
References