| name | tradingview-desktop-control |
| description | Control the local TradingView Desktop app on macOS through UI automation (AppleScript/System Events) using the user's already logged-in desktop session. Use when Codex needs to automate TradingView actions such as focusing the app, sending hotkeys, typing into UI fields, clicking menu items, switching symbols/timeframes/layouts, or running repeatable charting workflows in the desktop app rather than the browser. This skill uses visible UI access only and does not bypass TradingView subscription restrictions, account permissions, or broker protections. |
TradingView Desktop Control
Overview
Automate the running macOS TradingView desktop app via Accessibility-enabled UI scripting.
Use the bundled scripts/tvctl.py tool for deterministic actions instead of hand-writing AppleScript each turn.
Use scripts/tv_inventory.py, scripts/tv_web_inventory.py, scripts/tv_registry_merge.py, scripts/tv_resolve_capability.py, scripts/tv_plan_intent.py, and scripts/tv_execute_plan.py to enumerate capabilities, build/query a merged registry, plan actions, and execute them with risk gates/verification hooks.
Quick Start
- Verify the app is reachable:
python3 scripts/tvctl.py status
python3 scripts/tvctl.py list-menus
- Bring TradingView to the front:
python3 scripts/tvctl.py activate --launch
- Send UI actions (hotkeys, typing, menu clicks):
python3 scripts/tvctl.py hotkey "cmd+k"
python3 scripts/tvctl.py type "AAPL"
python3 scripts/tvctl.py press return
- Use higher-level chart/indicator workflows:
python3 scripts/tvctl.py set-symbol "AAPL"
python3 scripts/tvctl.py add-indicator "RSI"
- Calibrate watchlist field coordinates (for watchlist editing/search):
python3 scripts/tvctl.py config-init config/layouts/my-layout.json --layout-name my-layout
python3 scripts/tvctl.py window-bounds
python3 scripts/tvctl.py mouse-location
python3 scripts/tvctl.py watchlist-search "TSLA" 0.90 0.10 --normalized-window
python3 scripts/tvctl.py calibrate-watchlist config/layouts/my-layout.json --delay-per-point 8
- For repeatable workflows, run a JSON sequence:
python3 scripts/tvctl.py run-sequence references/examples/change-symbol.json
- Build and merge capability inventories (desktop + web):
python3 scripts/tv_inventory.py --pretty --write-default-registry
python3 scripts/tv_web_inventory.py --url https://www.tradingview.com/chart/ --headed --write-default-output
python3 scripts/tv_registry_merge.py \
references/examples/capability-registry.seed.json \
output/tv-web-inventory.json \
--write-default-output
- Enumerate targeted TradingView Web contexts (dialogs/menus) using label-based action plans:
python3 scripts/tv_web_inventory.py \
--url https://www.tradingview.com/chart/ \
--actions-file references/examples/web-inventory-plans/open-indicators-dialog.json \
--capture-label indicators-dialog \
--output output/tv-web-inventory.indicators.json
- Resolve intents against the merged registry:
python3 scripts/tv_resolve_capability.py "open indicators" --registry output/capability-registry.merged.latest.json
python3 scripts/tv_resolve_capability.py "settings" --prefer-surface-family web_ui
python3 scripts/tv_resolve_capability.py "watchlist add symbol" --only-actionable
- Produce an executable plan (with parameter extraction + risk gating):
python3 scripts/tv_plan_intent.py 'set chart symbol AAPL'
python3 scripts/tv_plan_intent.py 'add indicator "RSI"'
python3 scripts/tv_plan_intent.py 'remove watchlist row' --max-risk low
- Execute a planned action with confirmation + verification hooks:
python3 scripts/tv_execute_plan.py 'open settings' --prefer-surface-family web_ui --yes
python3 scripts/tv_execute_plan.py 'add indicator "RSI"' --dry-run
python3 scripts/tv_execute_plan.py 'remove watchlist row' --max-risk low --yes
Workflow
- Probe current UI state with
status, list-menus, and optionally window-titles.
- Prefer keyboard shortcuts and menu clicks over coordinate-based clicking.
- Use built-in high-level commands (
set-symbol, add-indicator) for common chart workflows.
- For watchlist editing/search, calibrate a watchlist input point and use normalized window coordinates.
- Prefer config-backed watchlist macros after calibration (
watchlist-*-config) to avoid retyping coordinates.
- Type symbols/values only after focusing the intended field/panel.
- Insert short delays between dependent UI steps (
wait action or separate command).
- Re-check state after important steps (menu presence, window title, screenshot if needed).
Commands
Use python3 scripts/tvctl.py --help and python3 scripts/tvctl.py <subcommand> --help.
Core subcommands:
status: print JSON with running/frontmost/menu discovery info
activate [--launch]: focus TradingView; optionally launch it first
list-menus: list top-level menu bar items visible to macOS UI scripting
window-titles: list accessible window names (may be empty for some Electron states)
window-bounds: return front window bounds for coordinate calibration
mouse-location: return current pointer coordinates
config-init <file>: create a per-layout config JSON (points + shortcuts)
config-show <file>: print config JSON
config-set-shortcut <file> <key> <combo>: store shortcut overrides (symbol_search, indicator_search)
config-set-point <file> <name> <x> <y>: store a named point manually
config-capture-point <file> <name>: capture current mouse position into config (supports delay + normalized coords)
calibrate-watchlist <file>: timed capture of common watchlist points (search, add, rows, remove menu item)
config-bind-watchlist <file>: remap watchlist point names in config
hotkey "<combo>": send combo like cmd+k, shift+cmd+p, esc
press <key> [--mods ...] [--times N]: send special keys (return, tab, esc, arrows, etc.)
type "<text>" [--interval 0.02]: type text into the focused UI element
click-menu "Top > Item > Subitem": click a menu path
move-mouse <x> <y>: move pointer (supports --relative-window and --normalized-window)
click <x> <y>: click pointer target (supports left/right, repeated clicks, window-relative coords)
drag <x1> <y1> <x2> <y2>: drag rows/panes (useful for watchlist reorder)
search "<query>": generic shortcut-opened search flow (--open-combo overrideable)
set-symbol "<symbol>": open symbol search and switch chart symbol (default cmd+k)
add-indicator "<query>": open indicators search and add/select indicator (default /, overrideable)
watchlist-search "<query>" <x> <y>: click watchlist search/input field by coordinate and type query
watchlist-open "<symbol>" <x> <y>: click watchlist field, type symbol, confirm
watchlist-open-config <config> "<symbol>": open/switch symbol using the configured watchlist search point
watchlist-add-config <config> "<symbol>": add symbol using configured add/search point
watchlist-remove-config <config>: right-click configured row point, click configured remove menu point
watchlist-reorder-config <config>: drag between configured row points
tv_inventory.py: export desktop/menu/config inventory and a capability-registry seed
tv_web_inventory.py: enumerate visible TradingView Web controls via Playwright CLI snapshot + DOM extraction
tv_web_inventory.py now also emits executable web action_recipes for many interactive controls (buttons/tabs/menuitems) plus curated multi-step web flows (indicators search, alerts, layout/settings, quick search), with declarative post-capture verification assertions
tv_registry_merge.py: merge desktop/web inventories and registries into a canonical merged registry + clusters
tv_resolve_capability.py: rank the best capability/action candidates for a user intent using the merged registry
tv_plan_intent.py: choose an executable action recipe from the merged registry, infer parameters, and emit a command preview for supported runners (tvctl.py, tv_web_inventory.py)
tv_execute_plan.py: execute the selected recipe (desktop or web) with confirmation/risk gates and optional pre/post verification hooks; web recipes can return verification_failed when post-capture assertions do not match
wait <seconds>: sleep between steps
run-sequence <file.json>: execute a JSON list of actions
Coordinate notes:
--normalized-window treats x and y as 0..1 fractions of the front TradingView window.
- This is usually the most stable way to target watchlist inputs/buttons across window moves/resizes.
Sequence Format
Pass a JSON file containing a list of action objects:
[
{ "action": "set-symbol", "symbol": "AAPL", "launch": true },
{ "action": "wait", "seconds": 0.3 },
{ "action": "add-indicator", "query": "RSI" },
{
"action": "config-watchlist-open",
"config": "config/layouts/aribs-main.json",
"symbol": "BTCUSDT"
}
]
Supported actions:
activate, wait, hotkey, press, type, click-menu
move-mouse, click, drag
search, set-symbol, add-indicator
watchlist-search, watchlist-open
config-watchlist-open, config-watchlist-add, config-watchlist-remove, config-watchlist-reorder
Example watchlist step using normalized coordinates:
{ "action": "watchlist-search", "query": "ETH", "x": 0.90, "y": 0.10, "normalized_window": true }
Safety Rules
- Treat broker/order entry, order modification, and order cancellation as high risk.
- Require explicit user confirmation before any live trading action, even if the UI is accessible.
- Stop if an unexpected modal, login prompt, CAPTCHA, or broker confirmation appears.
- Use visible UI only; do not claim unsupported API-level or hidden internal access.
- Keep automation scoped and reversible; avoid long unattended loops.
Limitations
- Premium features are available only through the currently signed-in TradingView desktop session.
- This skill cannot bypass TradingView paywalls, broker permissions, or platform restrictions.
- Electron UI elements may not expose a full accessibility tree; use hotkeys and menus first.
- Watchlist controls may require coordinate-based targeting because TradingView exposes sparse AX metadata.
- Window titles may be unavailable in some app states.
Troubleshooting
- If commands fail with assistive access errors, grant Accessibility access to Codex/Terminal.
- If the app is running but not responding, call
activate and retry with a short wait.
- If a shortcut differs from expectations, inspect TradingView menus and use
click-menu.
- If watchlist automation misses the target, recalibrate using
window-bounds + mouse-location and switch to --normalized-window.
- If UI focus is wrong, send
esc and re-open the intended panel before typing.
References
- Read
references/usage-notes.md for permissions, patterns, and example automation recipes.
- Read
references/layout-config.md for the config schema and a one-pass calibration workflow.
- Read
references/capability-registry-schema.json for the capability registry format used by inventory scripts.
- Read
references/web-inventory-workflow.md for web inventory action-plan syntax and targeted context capture workflow.
- Read
references/resolver-workflow.md for merged-registry intent resolution and scoring usage.
- Read
references/planner-workflow.md for intent-to-recipe planning, parameter extraction, and risk gating.
- Read
references/executor-workflow.md for recipe execution, risk gates, and verification hooks.