68 tools for reading and controlling a live TradingView Desktop chart via CDP (port 9222).
chart_get_state→ symbol, timeframe, chart type, list of all indicators with entity IDsdata_get_study_values→ current numeric values from all visible indicators (RSI, MACD, BBands, EMAs, etc.)quote_get→ real-time price, OHLC, volume for current symbol
Custom Pine indicators draw with line.new(), label.new(), table.new(), box.new(). These are invisible to normal data tools. Use:
data_get_pine_lines→ horizontal price levels drawn by indicators (deduplicated, sorted high→low)data_get_pine_labels→ text annotations with prices (e.g., "PDH 24550", "Bias Long ✓")data_get_pine_tables→ table data formatted as rows (e.g., session stats, analytics dashboards)data_get_pine_boxes→ price zones / ranges as {high, low} pairs
Use study_filter parameter to target a specific indicator by name substring (e.g., study_filter: "Profiler").
data_get_ohlcvwithsummary: true→ compact stats (high, low, range, change%, avg volume, last 5 bars)data_get_ohlcvwithout summary → all bars (usecountto limit, default 100)quote_get→ single latest price snapshot
quote_get→ current pricedata_get_study_values→ all indicator readingsdata_get_pine_lines→ key price levels from custom indicatorsdata_get_pine_labels→ labeled levels with context (e.g., "Settlement", "ASN O/U")data_get_pine_tables→ session stats, analytics tablesdata_get_ohlcvwithsummary: true→ price action summarycapture_screenshot→ visual confirmation
chart_set_symbol→ switch ticker (e.g., "AAPL", "ES1!", "NYMEX:CL1!")chart_set_timeframe→ switch resolution (e.g., "1", "5", "15", "60", "D", "W")chart_set_type→ switch chart style (Candles, HeikinAshi, Line, Area, Renko, etc.)chart_manage_indicator→ add or remove studies (use full name: "Relative Strength Index", not "RSI")chart_scroll_to_date→ jump to a date (ISO format: "2025-01-15")chart_set_visible_range→ zoom to exact date range (unix timestamps)
pine_set_source→ inject code into editorpine_smart_compile→ compile with auto-detection + error checkpine_get_errors→ read compilation errorspine_get_console→ read log.info() outputpine_get_source→ read current code back (WARNING: can be very large for complex scripts)pine_save→ save to TradingView cloudpine_new→ create blank indicator/strategy/librarypine_open→ load a saved script by name
replay_startwithdate: "2025-03-01"→ enter replay modereplay_step→ advance one barreplay_autoplay→ auto-advance (set speed withspeedparam in ms)replay_tradewithaction: "buy"/"sell"/"close"→ execute tradesreplay_status→ check position, P&L, current datereplay_stop→ return to realtime
batch_runwithsymbols: ["ES1!", "NQ1!", "YM1!"]andaction: "screenshot"or"get_ohlcv"
draw_shape→ horizontal_line, trend_line, rectangle, text (pass point + optional point2)draw_list→ see what's drawndraw_remove_one→ remove by IDdraw_clear→ remove all
alert_create→ set price alert (condition: "crossing", "greater_than", "less_than")alert_list→ view active alertsalert_delete→ remove alerts
ui_open_panel→ open/close pine-editor, strategy-tester, watchlist, alerts, tradingui_click→ click buttons by aria-label, text, or data-namelayout_switch→ load a saved layout by nameui_fullscreen→ toggle fullscreencapture_screenshot→ take a screenshot (regions: "full", "chart", "strategy_tester")
tv_launch→ auto-detect and launch TradingView with CDP on Mac/Win/Linuxtv_health_check→ verify connection is working
These tools can return large payloads. Follow these rules to avoid context bloat:
- Always use
summary: trueondata_get_ohlcvunless you specifically need individual bars - Always use
study_filteron pine tools when you know which indicator you want — don't scan all studies unnecessarily - Never use
verbose: trueon pine tools unless the user specifically asks for raw drawing data with IDs/colors - Avoid calling
pine_get_sourceon complex scripts — it can return 200KB+. Only read if you need to edit the code. - Avoid calling
data_get_indicatoron protected/encrypted indicators — their inputs are encoded blobs. Usedata_get_study_valuesinstead for current values. - Use
capture_screenshotfor visual context instead of pulling large datasets — a screenshot is ~300KB but gives you the full visual picture - Call
chart_get_stateonce at the start to get entity IDs, then reference them — don't re-call repeatedly - Cap your OHLCV requests —
count: 20for quick analysis,count: 100for deeper work,count: 500only when specifically needed
| Tool | Typical Output |
|---|---|
quote_get |
~200 bytes |
data_get_study_values |
~500 bytes (all indicators) |
data_get_pine_lines |
~1-3 KB per study (deduplicated levels) |
data_get_pine_labels |
~2-5 KB per study (capped at 50) |
data_get_pine_tables |
~1-4 KB per study (formatted rows) |
data_get_pine_boxes |
~1-2 KB per study (deduplicated zones) |
data_get_ohlcv (summary) |
~500 bytes |
data_get_ohlcv (100 bars) |
~8 KB |
capture_screenshot |
~300 bytes (returns file path, not image data) |
- All tools return
{ success: true/false, ... } - Entity IDs (from
chart_get_state) are session-specific — don't cache across sessions - Pine indicators must be visible on chart for pine graphics tools to read their data
chart_manage_indicatorrequires full indicator names: "Relative Strength Index" not "RSI", "Moving Average Exponential" not "EMA", "Bollinger Bands" not "BB"- Screenshots save to
screenshots/directory with timestamps - OHLCV capped at 500 bars, trades at 20 per request
- Pine labels capped at 50 per study by default (pass
max_labelsto override)
Claude Code ←→ MCP Server (stdio) ←→ CDP (localhost:9222) ←→ TradingView Desktop (Electron)
Pine graphics path: study._graphics._primitivesCollection.dwglines.get('lines').get(false)._primitivesDataById