Tradingview-Premium-Claude-MCP-Setup
Analysis-only intraday trading dashboard for TradingView Premium Desktop, driven through Claude Code + MCP over the Chrome DevTools Protocol (CDP).
- Intraday-only. 🇮🇳 India + 🇺🇸 USA TPO scanners (Market-Profile-informed, full-universe) and a 🇮🇳 India-intraday dashboard panel.
- One dashboard: Signal Summary with intraday decision metrics (bias, strength, trend, volume, risk, entry readiness…), the India-intraday fast-scan + checklist, and MCP/CDP health.
- Stable entries: every TPO signal anchors its entry to a fixed session level (today's Open / prior-day close) and freezes the whole plan per symbol per day — the entry does not drift with each LTP tick. A signal State (ARMED / VALID / EXTENDED / INVALID / EXPIRED) says when to act.
- Circuit-aware (India): targets never exceed the NSE upper circuit and stops never sit below the lower circuit — Stage-1 uses an assumed band, and Confirm fetches the real per-stock circuit from the NSE data provider.
- No live trade execution. No order endpoints exist in this codebase.
Zero npm dependencies (Node built-ins only). Reuses the verified CDP bridge from the
previous setup (lib/tv.mjs).
New here? Start with the Start Here tab
The dashboard opens on a Start Here tab that, in plain English, explains what every tab does (grouped into live signals, analysis, idea scans and journal/stats), shows your live setup status (what is actually configured on your machine), lists a 5-minute path, and defines the jargon. If you read nothing else here, read that tab.
What works without any API keys?
Most of the dashboard runs with no keys at all — the two optional tokens only unlock the tabs that need historical price data or the real NSE circuit.
First 5 minutes
npm run tv:debug— relaunch TradingView so the dashboard can read it.npm start, open http://localhost:4178, and keep a TradingView chart tab active.- On Start Here, check Your setup status — green means ready (the NSE and US data feeds are optional).
- Open Dashboard, type a symbol (e.g.
RELIANCEorAAPL) and press Load for a live read. - Try the India TPO Scanner — auto-found intraday setups, no API keys needed.
Requirements
- macOS, Node ≥ 20 (uses the built-in
WebSocket; verified on Node 22) - TradingView Desktop installed (
/Applications/TradingView.app), logged in - Optional: Claude Code, for the MCP bridge (
chrome-devtools-mcp, wired in.mcp.json)
Setup
git clone [email protected]:saket3395/Tradingview-Premium-Claude-MCP-Setup.git
cd Tradingview-Premium-Claude-MCP-Setup
cp .env.example .env # optional; defaults work
No npm install needed (no dependencies).
Run
Easiest: double-click scripts/start.command in Finder — it ensures CDP, starts the
dashboard, and opens it in your browser. Close that Terminal window to stop the server.
Or from a terminal:
npm run tv:debug # quits + relaunches TradingView with CDP on :9222
npm start # dashboard at http://localhost:4178
Open http://localhost:4178. Keep a TradingView chart tab active (ideally on a second monitor) — the dashboard reads whichever chart tab is currently active.
Why
tv:debug? TradingView only exposes CDP when launched with--remote-debugging-port. The script quits any running instance and relaunches with the flag (layouts are cloud-synced, so nothing is lost) and waits out the auto-updater.
Dashboard sections
Pre-expansion scanner logic (v2)
Each signal now carries a Setup archetype — OPEN-DRIVE (early one-sided auction, gap-aligned),
IB-COIL (range still compressed vs ATR but price holding the directional third on volume — the
pre-breakout state), VALUE-EDGE (opened beyond prior close, pullback being accepted — 80%-rule style),
or EXPANSION (move already happened; kept but score-penalized) — plus an EQ (Entry Quality, 0–100)
column combining an anti-chase penalty (day range vs ATR), time-of-day decay (post-IB structure fades),
and volume. Extension no longer earns entry points: an extended day proves direction, not entry.
The Signal Summary adds Conviction, Location vs value (VWAP), Session phase and a one-line verdict.
- Fast scan: your TradingView watchlist split by market (exchange prefix). Click a symbol to load it on the active chart (best-effort switch).
- Checklists: defined in
config/markets.json; tick-state saved in the browser. - Signal State:
VALID= in the entry zone now ·ARMED= waiting for the level ·EXTENDED= ran past entry, don't chase ·INVALID= stop reached ·EXPIRED= closed / late-session cutoff (tpo.noNewEntryBeforeCloseMin).
CLI (same bridge, no server)
npm run tv -- status # CDP health
npm run tv -- chart # active symbol + interval
npm run tv -- indicators # raw indicator legend rows
npm run tv -- pine:read
npm run tv -- pine:write pine/example-ema.pine
npm run tv -- pine:compile
Configuration
config/markets.json— India-intraday labels/exchanges/timeframes/checklist;tpoblock:refreshSeconds,noNewEntryBeforeCloseMin,testing.backtestLimit(how many recent plans the 1-minute backtest replays — each costs one NSE-provider request), and per-market thresholds (minScore/minRR/minRVol/…).tpo.india.circuitBandPctis the assumed Stage-1 circuit band (default 10%); Confirm replaces it with the real NSE circuit..env—PORT,TV_CDP,TV_NO_ACTIVATE, and the NSE data token file (path to a JSON{"access_token":"…"}; used only for the real NSE circuit at Confirm). Recommended: a read-only, long-lived analytics token — ~1-year validity, supports the market-quote endpoint, and needs no daily refresh. A normal daily OAuth access token also works but expires each day. Absent/expired ⇒ Confirm falls back to the assumed band and says so. The US market-data keys (key id / secret / feed, defaultiex) are market-data only credentials used solely by the Pattern Analysis tab to fetch real 4H/1D/1W/1M bars for US symbols — no trading endpoint is ever called. Absent ⇒ US symbols report "no history source" instead of showing invented data. See.env.examplefor the exact variable names and provider-specific setup.
Use with Claude Code (MCP)
.mcp.json wires Google's chrome-devtools-mcp to the same CDP endpoint, so Claude can read
the chart / run JS / read console live. For Pine writes, use the CLI
npm run tv -- pine:* (robust Monaco handling; the dashboard is intraday-only now). Open the chart page with
select_page { pageId, bringToFront: true } before evaluate_script (TradingView suspends
hidden tabs' DOM).
Limits / honest notes
- Reads need the chart tab active in TradingView (hidden tabs are suspended). Best with TV on a second monitor while you watch the dashboard.
- Chart symbol switch is best-effort (drives the symbol-search dialog); if it misfires, switch in TradingView directly. Timeframe chips are reference labels (no auto-switch yet).
- Indicator parsing is heuristic from the on-chart legend; it reads what you already have on
the chart (add EMA9/21, RSI, VWAP, a volume study for full Signal-Summary metrics — missing ones
show
n/a), it does not compute new studies. - TPO Stage-1 is profile-informed from day-level scanner data (full letter-by-letter TPO
needs intraday time-at-price). The scanner's "VWAP" field is the pivot
(H+L+C)/3, used for scoring only — never for entry. Use Confirm for true on-chart levels. - Real NSE circuit needs a valid NSE data token (a long-lived analytics token lasts ~1 year — no daily refresh); without one, Stage-1's assumed band applies and Confirm labels it honestly. NSE's own API is Akamai/bot-blocked server-side, hence a third-party data provider.
Project layout
lib/tv.mjs reused CDP bridge (importable module + CLI; Pine fns kept for the CLI)
lib/signals.mjs pure legend -> signals + intraday decision metrics
lib/tpo.mjs TPO scanner engine (India+USA): scoring, fixed entries, freeze, state, circuit
lib/upstox.mjs real NSE circuit at Confirm (instrument map + market-quote)
lib/history.mjs multi-timeframe OHLC for Pattern Analysis (NSE / US data feeds)
lib/patterns.mjs rule-based stage + pattern detection and the top-down report builder
lib/indicators.mjs shared primitives (SMA/ATR/pivots/line fit/ZigZag/RSI) used by every engine
lib/minervini.mjs Minervini SEPA: Trend Template, VCP contractions, pivot/stop trade plan
lib/rs.mjs percentile RS Rating from the reused TradingView universe scanner
lib/ratelimit.mjs ONE process-wide throttle + circuit breaker per upstream provider
data/history_cache.json persisted OHLC windows (gitignored) — survives restarts so a
symbol analysed yesterday needs no requests the next morning
lib/elliott.mjs Elliott Wave counting: impulse + simple corrections, alternates, invalidation
lib/breakouts.mjs "closest to breakout" scanners: full-universe screen, then the real
pattern / VCP / Elliott engines on a rate-limit-bounded shortlist
server/server.mjs zero-dep HTTP server + JSON API
public/ index.html, app.js, style.css (the dashboard)
config/markets.json India-intraday config + tpo thresholds
scripts/tv-debug.sh launch TradingView with CDP
pine/ example Pine scripts (CLI only)
.mcp.json chrome-devtools-mcp wiring for Claude Code
Disclaimer
This software is for analysis and education only. It is not financial advice, and it contains no order-execution code by design. Trading involves substantial risk of loss; nothing produced by this tool (signals, states, backtests, analytics) is a recommendation to buy or sell any security. Use entirely at your own risk.
This project is not affiliated with, endorsed by, or sponsored by TradingView, its data providers, or Anthropic. It reads your own logged-in TradingView Desktop session locally via the Chrome DevTools Protocol — you are responsible for complying with the terms of service of TradingView, your broker, and your data providers. It does not scrape, store, or redistribute market data.
License
MIT © Saket Tulsan. See also CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md.