Miles Free AI Library
← Back to resources
GuideMiles FinanceSep 11, 2026

Control TradingView Charts with Codex and a Local MCP Bridge

Connect and verify a protected desktop workspace, then use six ready-to-run workflows for chart analysis, Pine indicators, strategy testing, watchlist scans, and zone monitoring.

Get the full MD

Download the complete TradingView MCP workspace guide

Free
Download MD

Control TradingView Charts with Codex and a Local MCP Bridge

Connect TradingView Desktop through a local MCP bridge, then analyze charts, build indicators, test strategies, scan watchlists, and monitor marked zones.

What you will achieve

You will create a verified Codex connection to TradingView, preserve your primary layout, and gain six copy-ready workflows for chart analysis and monitoring.

Who this is for

TradingView users who want an AI charting copilot for research, strategy testing, and setup monitoring. No Pine Script experience is required.

Difficulty: Intermediate

Short tutorial

Connect TradingView Desktop through a local MCP bridge, then analyze charts, build indicators, test strategies, scan watchlists, and monitor marked zones.

Guide: Build a Prompt Controlled TradingView Workspace with Codex

Time: 30 to 45 minutes for setup and initial t

What you will build

This tutorial turns Codex and TradingView Desktop into a prompt controlled charting workspace. After connecting them through a local MCP bridge, you will be able to ask Codex to modify charts, inspect indicators, create Pine tools, run Strategy Tester, scan a watchlist, and monitor zones you draw.

Use the implementation path in order. Complete the connection first, run the first two chart prompts sequentially, then use the remaining prompts independently. Keep your normal trading layout separate from the demo layout until you have verified that the bridge behaves as expected.

A backtest or chart interpretation is not proof that a strategy will remain profitable. Treat these workflows as research, organization, and decision support. The monitoring workflow explicitly prohibits trade placement.

Requirements

Before starting, prepare the following:

  • TradingView Desktop, installed and signed in.
  • Codex running on the same computer.
  • Node and any other dependencies required by the bridge's current installation instructions.
  • A TradingView plan that includes the native features you intend to use, such as Visible Range Volume Profile.
  • An open TradingView chart.
  • A backup or saved copy of any important chart layout.

This tutorial uses the public TradingView MCP Bridge project:

https://github.com/tradesdontlie/tradingview-mcp

The bridge runs locally and controls your TradingView Desktop chart. A hosted market data connector does not provide the same desktop chart control.

1. Connect Codex to TradingView Desktop

Paste the following setup prompt into Codex on the computer where TradingView Desktop is installed.

TEXT
Set up the dedicated TradingView MCP Bridge so I can control my TradingView charts by prompting you here.

Use https://github.com/tradesdontlie/tradingview-mcp. Read its current installation instructions, detect my operating system, and complete the setup for Codex. Reuse an existing working installation if present; otherwise clone the repository, install its Node dependencies and register src/server.js as a local MCP server in Codex using absolute paths. Preserve my existing MCP configuration.

Find TradingView Desktop and launch it with local debugging enabled. Use an available localhost port and configure the bridge to use the same port. Preserve my saved layouts and unsaved work before any restart. Keep the debug connection local to this computer; do not expose it online. Let me handle sign-in if required.

Verify the connection through the actual MCP tools: run the health check, read the open chart's exchange, symbol, timeframe and current price, then take a screenshot and inspect it. Create or reuse a separate layout called "Astra TradingView Demo." In that layout, switch to BINANCE:BTCUSDT on the four-hour chart and verify the change. Preserve my original layout.

Finish with a short connection result and tell me how to reconnect next time. If I need to restart Codex, approve a permission or sign in, state the exact remaining step. Do not call the setup complete until MCP chart reads and a chart change have both been verified.

Reference sections supplied with the bridge and Codex documentation:

  • Bridge installation: https://github.com/tradesdontlie/tradingview-mcp#quick-start
  • Codex MCP configuration: https://learn.chatgpt.com/docs/extend/mcp?surface=cli

Verify the connection

Do not continue until all of these checks pass:

  • The bridge health check succeeds.
  • Codex reads the chart's exchange, symbol, timeframe, and current price.
  • Codex captures and inspects a screenshot.
  • The demo layout opens BINANCE:BTCUSDT on the four-hour timeframe.
  • Your original layout remains intact.
  • Codex tells you how to reconnect after a restart.

If TradingView requests sign-in, Codex requests permission, or Codex itself must restart, complete that step and ask it to repeat the full verification.

2. Map support and resistance

Start with a clean structural analysis. This prompt reviews six months of daily price action, finishes on a four-hour view, and draws three defensible zones.

TEXT
Use the TradingView MCP bridge to open BINANCE:BTCUSDT in a separate layout called "Astra TradingView Demo." Preserve my original layout.

Review six months of daily price action, then finish on the four-hour chart showing the last 60 days. Draw the three strongest support/resistance zones based on repeated reactions and meaningful swing points. Use narrow, translucent zones: teal for support, muted red for resistance and amber for a pivotal level. Label each with its prices and supporting timeframe.

Keep the chart clean and readable. Inspect the finished result and fix any clutter. Explain the most important level, why it matters and what would invalidate your reading in three sentences.

Keep this focused: aim for three minutes and make the changes directly in TradingView.

Review the result

Confirm that the chart contains:

  • Three narrow zones rather than numerous arbitrary lines.
  • Labels with prices and supporting timeframes.
  • Evidence based on repeated reactions or meaningful swing points.
  • A concise invalidation condition.
  • No modifications to your original layout.

The model can still misread a chart. Inspect every zone before using it in a trading plan.

3. Challenge the levels with volume

Run this after the support and resistance prompt. It adds TradingView's native Visible Range Volume Profile and checks whether volume confirms or contradicts the structural levels.

TEXT
On our BTC four-hour demo chart, add TradingView's native Visible Range Volume Profile for the last 60 days, using a 70% value area.

Put the profile on the right with subdued colours, a gold point of control (POC), and distinct value-area high (VAH) and low (VAL) lines. Read their actual prices from the native indicator and add clear labels without covering the candles. Record the profile settings.

Explain whether volume supports or challenges our original zones, and whether price is above, inside or below value. Leave the profile visible and the date range unchanged.

Aim for three minutes. If the native indicator or exact values aren't accessible, state the limitation; don't estimate them or build a replacement.

Interpret the volume profile

Use the output to compare three pieces of information:

ReadingMeaning in this workflow
POCThe price level with the most traded volume in the visible profile
VAHThe upper boundary of the configured value area
VALThe lower boundary of the configured value area

Look for alignment between these readings and your original zones. For example, a structural pivot near VAH may become a more important reclaim level. A support zone near POC may have volume based relevance, but it is not automatically a valid entry.

4. Build a non-repainting Bitcoin context dashboard

The next prompt asks Codex to write, compile, apply, and validate a private Pine indicator. It creates a compact market context dashboard rather than a trade signal.

TEXT
Use the TradingView MCP bridge to create and privately save a new Pine indicator called "Astra Bitcoin Lens" in "Astra TradingView Demo." Preserve my existing indicators and hide old demo annotations where necessary.

Build a polished, compact top-right dashboard with four modules, all using completed daily candles regardless of the chart timeframe:

- Trend: daily 50- and 200-day simple moving averages; price above both, between them or below both; and whether the 200-day average rose or fell over 20 daily bars.
- Extension: signed percentage distance from the 200-day average and distance from the 50-day average in daily ATR(14).
- Volatility: 30-day realized volatility, calculated as the population standard deviation of daily log returns × square root of 365 × 100. Show its percentile against 365 completed daily readings: below 20th = Quiet, above 80th = Elevated, otherwise Typical.
- Drawdown: percentage below the highest daily high over the last 365 completed days, with the reference high shown.

Use a dark translucent dashboard, teal/amber/muted-red accents, an "As of" timestamp, and subtle moving-average plots and ribbon. Include dashboard-size and overlay-visibility controls. Keep candles readable. No trade signals or confidence score.

Use TradingView's documented non-repainting daily-data method and expose numeric values in the Data Window. Compile, fix errors, and independently spot-check one completed day's metrics against the same source data; verify they match on daily and four-hour charts at the same evaluation time. Show missing history honestly.

Finish on BINANCE:BTCUSDT daily with roughly 12 months visible, close the editor, save the demo layout and deliver the Pine source. Briefly explain the modules. Keep to these four modules; this is a context tool, not a claim of predictive power.

Validate the indicator

Before accepting the script, check that:

  • It compiles without errors.
  • It uses completed daily candles on every chart timeframe.
  • The daily and four-hour readings match at the same evaluation time.
  • Numeric values appear in the Data Window.
  • Missing history is shown as missing rather than fabricated.
  • The delivered Pine source matches the indicator applied to the chart.
  • It contains no trade signals or confidence score.

Once the base dashboard works, you can request focused amendments. Change one feature at a time so errors are easier to isolate.

5. Test a Donchian breakout strategy

This workflow uses TradingView's native Strategy Tester to examine an existing public Donchian breakout strategy. It fixes the capital, costs, date range, and test settings so the result can be interpreted consistently.

TEXT
Use the TradingView MCP bridge and native Strategy Tester to test this existing public strategy on BINANCE:BTCUSDT daily in "Astra TradingView Demo":
https://www.tradingview.com/script/fF9nC8iP-Donchain-Breakout/

Inspect the source for obvious future-data leakage and briefly explain its entry and exit rules. Use a 20-bar channel and Exit Option 1. Test from the earliest available Binance data in 2017 through the latest completed daily candle. Use 10,000 USDT starting capital, 100% equity sizing without leverage, 0.1% commission per side and 5 USDT slippage per fill, converted to the correct number of ticks.

Report the actual tested dates and settings, net return, maximum drawdown, closed trades, win rate and profit factor. Include buy-and-hold if available and distinguish closed profit from any open position.

Answer plainly: was it profitable after these costs, did it beat buy-and-hold, and what is the main caveat? Leave the Strategy Tester and equity curve visible, preserving my saved indicators.

Aim for five minutes: one strategy, one test, no optimization or new code. If the script or requested history is unavailable, report the blocker. A losing result is valid; a profitable backtest is not proof of future performance.

Read the result critically

A basic 20-bar Donchian system buys after a breakout above the preceding upper boundary and exits after a break below the lower boundary, subject to the exact implementation in the inspected script. Such a trend following structure can capture sustained rallies, but sideways conditions may produce repeated false breakouts and slow exits.

Review more than net return:

  • Compare the strategy with buy-and-hold over the same period.
  • Examine maximum drawdown and the equity curve.
  • Check whether a small number of large winners produced most of the return.
  • Confirm that commission and slippage were applied.
  • Distinguish realized results from an open position.
  • Note the actual available test dates rather than assuming all requested history loaded.

Do not optimize parameters during this first test. A single historical run is useful for understanding behavior, not for establishing durable profitability. Forward testing and broader validation are still needed.

6. Scan your selected watchlist

Copy
Select the watchlist you want TradingView to inspect before running this prompt. The scan makes one four-hour pass and ranks no more than three long-side candidates.
TEXT
Use the TradingView MCP bridge to scan my currently selected watchlist on the four-hour timeframe. Shortlist up to three clean long-side candidates with an upward trend, an orderly pullback toward support or consolidation below repeatedly tested resistance, and room before the next resistance. Avoid charts already stretched away from their setup area.

Make one pass using actual chart data. Return a ranked table: Coin | Why it stands out | Key price level | Confirmation needed | Invalidation. Identify the exchange and whether the symbol is spot or perpetual. If fewer than three qualify, say so.

State how many symbols you reviewed and any you couldn't inspect. Leave the strongest candidate's four-hour chart open in "Astra TradingView Demo," preserving my original layout and saved indicators.

Aim for three minutes. No research, backtesting, new indicators, drawings or alerts. These are watchlist candidates, not proven signals.

A useful response should report the number of inspected symbols, disclose any inaccessible charts, and return fewer than three candidates when the watchlist does not contain enough qualifying setups.

7. Monitor zones drawn on your charts

This final workflow combines your own chart work with scheduled analysis. Before using it:

  1. Select the intended watchlist.
  2. Open your normal chart layout.
  3. Draw red rectangles around every area you want monitored.
  4. Make each rectangle's upper and lower bounds precise.
  5. Keep your existing confirmation indicators visible.

Red identifies a monitored zone. It does not define direction. The analysis must separately decide whether the context supports a possible long or short candidate.

TEXT
Use the TradingView MCP bridge to monitor my currently selected watchlist and the red rectangles in my normal chart layout. Identify that layout first. Read the rectangles' stored price bounds, including off-screen zones, and preserve my drawings and indicators.

Set up a daily report at 9:00 am Dubai time (Asia/Dubai), plus checks every 15 minutes throughout the day and night. Assess both long and short candidates using price structure, actual readings from my existing indicators, and relevant verified market context. Red marks a zone; it does not automatically mean short.

Alert when price is within 0.5 four-hour ATR(14) of a zone, enters it, or a setup gains confirmation or becomes invalidated. Distinguish "approaching," "inside, waiting for confirmation," and "confirmed candidate." Include the symbol, direction, current price, zone, supporting/conflicting evidence and invalidation. Use completed candles for confirmation; a zone touch alone is not a trade signal.

Use native TradingView price alerts for immediate zone-entry notifications and scheduled checks for the fuller analysis. Avoid repeat notifications, track edits to my zones and rearm entry alerts after price exits. Manage only alerts you create. Never place trades.

Verify the schedules and native alerts, report anything already inside a zone, and tell me what must stay running or needs activation. Don't claim continuous monitoring if only periodic checks are available. Keep reports short and stay quiet between meaningful changes, except for the daily summary or a monitoring failure.

Understand the runtime requirement

Local monitoring only works while the required computer, TradingView Desktop, bridge, and automation process remain available. If your computer is offline, a local agent cannot continue checking the charts.

The transcript describes persistent hardware, such as an old laptop or small computer, and a virtual private server as possible approaches for workflows that must remain running. Whichever method you use, require Codex to report exactly what must stay active. Do not accept a claim of continuous monitoring when the configured system only performs periodic checks.

Verify alerts safely

After setup, confirm:

  • The 9:00 am schedule uses Asia/Dubai.
  • The periodic checks are configured for every 15 minutes.
  • Existing zones were read from stored rectangle bounds, including off-screen zones.
  • Symbols already inside a zone were reported.
  • Native alerts and scheduled analysis are clearly distinguished.
  • Duplicate notifications are suppressed.
  • Alerts can rearm after price leaves a zone.
  • Only alerts created by this workflow are managed.
  • No trade execution permission was granted.

Operating pattern

Use the workspace as a charting copilot rather than an unquestioned signal generator:

  1. Draw or review the market structure.
  2. Challenge it with native indicator readings.
  3. Ask for exact confirmation and invalidation conditions.
  4. Test strategy logic with realistic costs.
  5. Compare results with buy-and-hold and inspect drawdown.
  6. Mark your own actionable areas precisely.
  7. Let the scanner and alerts organize what deserves attention.
  8. Verify every important value directly in TradingView.

For quick chart changes, prioritize a responsive model setting. For Pine development or careful strategy analysis, use a higher reasoning setting if available. More reasoning may improve complex work, but it can also increase completion time.

Final implementation checklist

  • [ ] TradingView Desktop is connected through the local MCP bridge.
  • [ ] The bridge is restricted to localhost.
  • [ ] Codex can read and change the active chart.
  • [ ] A separate Astra TradingView Demo layout protects the original layout.
  • [ ] Support and resistance zones have been inspected manually.
  • [ ] POC, VAH, and VAL came from the native indicator rather than estimates.
  • [ ] The custom indicator compiles and matches across daily and four-hour charts.
  • [ ] Strategy Tester includes capital, commission, slippage, and actual test dates.
  • [ ] Watchlist scans disclose skipped symbols and return only qualifying candidates.
  • [ ] Monitoring distinguishes proximity, entry, confirmation, and invalidation.
  • [ ] The monitoring runtime and any activation requirements are understood.
  • [ ] No workflow is authorized to place trades.
Continue exploring

What to watch next