How to Build an Automated Day Trading Scanner with Claude AI + TradingView

Step 1 — Install Claude Code

If you’re new to Claude, install Claude Code (the command-line version) — it’s what the scanners run on top of. The Claude chat app on your phone or browser is great for back-and-forth conversations, but for automation, scheduling, and connecting to other apps, you need the command-line version called Claude Code.

  1. Open Terminal on your Mac and paste this:
curl -fsSL https://claude.ai/install.sh | bash
  1. Sign in with a paid Claude account. You’ll need a paid plan to use Claude Code (no free tier). The $20/month Pro plan is fine to follow this tutorial and run scanners manually. I personally run Max 20x ($200/month) because I’m using Claude for trading, content, and a bunch of other projects, and I needed the headroom.
  2. Open Terminal and confirm it’s working:
claude --version

If you see a version number, you’re good.

💡 Heads up on plans: Pro $20 is enough to follow this tutorial step by step. If you want to run the FULL automated daily setup like I do (Scanner B firing 9 times a day from 10am to 2pm), you’ll hit Pro’s usage caps before lunch. For ongoing daily production use, you’ll need at least Max 5x at $100/month. Start on Pro to learn it, upgrade to Max when you’re ready to deploy.


Step 2 — Install TradingView Desktop

  1. Click here for $15 off TradingView → (this is my affiliate link — same price for you, helps support the channel)
  2. Pick any paid plan. The lowest tier (Essential, $12.95/month billed annually, or $14.95 month-to-month) is enough for the scanner workflow. If you want PineScript backtesting with bar replay, you’ll need Pro+ or higher.
  3. Download the Desktop app from your TradingView account page. Don’t skip this step — the browser version will not work with the MCP.
  4. Sign in to the desktop app and pin a starter chart (any ticker, any timeframe).

Step 3 — Install the TradingView MCP

This is the bridge that lets Claude read your live charts. Credit to the developer who built it: @Tradesdontlie on X — full technical breakdown of how it works in his post.

The install needs two prompts with a quick Claude restart in between.

Prompt 1 — paste this into Claude Code:

Install the TradingView MCP server from https://github.com/tradesdontlie/tradingview-mcp. Clone it to ~/tradingview-mcp, run npm install, and register it in my Claude MCP config at user scope. Then launch TradingView with the remote debugging port enabled (port 9222). Tell me when you're done.

Claude will ask permission to run a few shell commands (git clone, npm install, claude mcp add, the TradingView launch). Just hit Approve on each one.

Then: quit Claude Code (Ctrl+C or close the window) and re-launch it. This restart is what loads the new MCP into your session.

Prompt 2 — paste this in the new session:

Run tv_health_check and tell me if TradingView is connected.

If you see cdp_connected: true and api_available: true, you’re done.

If something breaks, the most common fixes:

  • TradingView wasn’t fully closed before launch. Quit it completely, then re-run the prompt.
  • Port 9222 is in use. Tell Claude: Change the MCP debug port to 9223. Update both the MCP config and re-launch TradingView with the new port.
  • You’re on the browser version. Re-read Step 2.

💡 Important: TradingView Desktop has to be running with an active chart tab any time you use these scanners. The “New Tab” welcome screen doesn’t count — open a real chart first.


Step 4 — Try a few basic prompts

Before building the scanners, get a feel for what the MCP can do. Paste these one at a time:

Switch the chart to NVDA on a 5-minute timeframe and add the 200 SMA and RSI.

First, make sure your watchlist panel is open in TradingView (click the watchlist icon on the right side of the chart). Then paste:

Read my TradingView watchlist and tell me which names are up the most today.

Look at NVDA on the daily and draw the most important support and resistance levels you see, plus today's premarket high.

Give me a quick end-of-day briefing on NVDA — what happened today, key levels respected or broken, and what to watch tomorrow.

If those all work, you’re ready for the real workflow.


Step 5 — Build your premarket gap scanner (Scanner A)

This is the foundation. Every morning before the open, this scanner pulls the biggest premarket movers, filters out junk, and tells you the news catalyst behind each gap.

Paste into Claude:

I scan premarket gappers every morning before the open. Build me something that does this automatically.

Show me the big movers:
- Stocks that gap up more than 5% from previous day's close
- Price above $3
- Over 50K premarket volume

The important part: tell me the news catalyst behind each gap-up.

Save the results to a JSON file with today's date and notify me on macOS when it's done.

💡 Volume filter tip: I run mine at 50K shares because below that the names are too illiquid for my account size. Start at 50K, drop to 20K if you want a wider net, raise to 100K+ if you trade larger size.

Claude will build a scanner script, fetch the data from a free source (Yahoo Finance gainers feed or similar), apply your filters, pull the news headlines, and save the output. First run takes about 1-2 minutes — most of that is fetching the news catalyst for each name. You’ll get a file like premarket_gappers_2026-05-15.json with the full list.

What the output looks like (real example from a recent run):

#1  POET  $20.75  +44.34%
#2  ONDS  $11.21  +26.52%
#3  FRMI  $7.37   +22.83%
#4  RDW   $13.99  +22.12%
#5  PCT   $12.39  +21.47%
... (top 30)

Each ticker comes with the news catalyst (earnings, FDA approval, partnership, etc.) so you can decide in 30 seconds whether it’s worth charting.


Step 6 — Automate the premarket scanner

Now you don’t want to run that manually every morning. Paste this:

This works great. Now I don't want to run it manually every morning. Schedule it to fire on its own every weekday at 8:30am New York time.

My laptop is sometimes asleep at that time. Don't try to keep my Mac awake — instead, if I open the laptop later in the morning (anytime before market close), have it run a catch-up scan automatically. Skip weekends, don't run twice in the same day, and don't fire if the premarket data is already stale.

Claude sets up a launchd job (Mac’s version of a cron) and adds a smart catchup layer so the scanner fires whenever you open your Mac in the valid window. Better than keeping the laptop awake all night — saves your battery and works whether you’re at the desk or not.

Verify it’s scheduled:

launchctl list | grep -i premarket

You should see your scanner job listed.


Step 7 — Build your strategy scanner (Scanner B)

Premarket Scanner gives you the candidates. Strategy Scanner tells you which ones actually meet your trading setup.

The strategy I demo in the video is my Trend Join Long setup — I’m looking for a stock that’s gapped up with positive news, broken above premarket high intraday, and showing strength above prior-day high. (Full setup walkthrough is in my YouTube playlist.)

Paste into Claude:

Now I want a second scanner that takes Scanner A's gapper list and filters it down to which ones actually meet my day trading strategy — the Trend Join Long.

Criteria:
- Run after 10am New York time
- Current price above yesterday's daily high
- Yesterday's close above the 200-day SMA
- Current price above today's premarket high
- Current price above today's high of day so far

If all five pass, it's a hit. Pull the live data from TradingView via the MCP.

Save the results to a JSON file with today's date and the run time.

Important: For this scanner to run, you need TradingView Desktop running with an active chart tab. The MCP needs a live chart to read from.

⏱️ Heads up — this one’s slow. Each per-ticker check takes 3-5 minutes (Claude loads the chart, reads daily and 1-min data, computes the SMA200, checks intraday levels). For a 10-ticker list that’s 30+ minutes of waiting. You don’t want to run it by hand — that’s exactly why we automate it in the next step.


Step 8 — Automate the strategy scanner every 30 minutes

The 10am snapshot misses setups that develop later in the day. Real Trend Join Long entries happen at 10:45, 11:30, sometimes after lunch. Fix it:

10am is too early to only run this once. Setups happen at 10:45, 11:30, sometimes after lunch.

Fire this strategy scanner every 30 minutes from 10am to 2pm New York time.

But don't blow up my phone with 9 messages a day. Only ping me if it's the first run of the day, or if there's a new hit. Otherwise stay quiet.

Claude updates your launchd schedule, adds a “first-run-of-day” tracker, and gates notifications so you only hear from the bot when something new actually happens.


Step 9 — Backtest your strategy with PineScript

Now the question every trader asks: does this actually make money?

Time to backtest in TradingView. Paste:

Scanner B is firing live but I want to make sure this strategy actually has an edge before I rely on it.

Build me a PineScript strategy in TradingView using the same entry rules:
- 5-minute chart, after 10am New York time
- Current price above yesterday's daily high
- Yesterday's close above the 200-day SMA
- Current price above today's premarket high and above today's HOD

On top of the entry, add the trade management:
- Initial stop is the lower of premarket high or the entry bar low, minus 1%
- Sell a third at +1R and move stop to entry
- Sell another third at +2R and move stop to entry plus half R
- Trail the final third with a 21-EMA or exit at the next daily pivot high
- Force close everything at 3:51pm

Run it on AMD and a handful of other names. Show me the win rate, total P&L, and profit factor.

Claude writes the PineScript, injects it into TradingView’s Pine editor, compiles it, fixes any errors, applies it to your chart, and reads the Strategy Tester results back to you.

🔁 This is iterative — don’t panic. Pine usually takes 2-3 compile cycles before it’s clean. Claude will write code, hit a syntax or type error, read the error back from TradingView, fix it, recompile. That back-and-forth is normal — let it run, don’t interrupt.

💡 Reading the results sometimes takes a couple of tries. There’s a known quirk in the MCP where the dedicated “read strategy results” tool returns empty even when the numbers are clearly on screen. Claude usually screenshots the Strategy Tester panel and reads the numbers from the image instead. Either way you’ll get the metrics — just don’t be surprised if you see Claude take a screenshot mid-flow.

Real results from my own run (on MU 5-min, ~60-day window):

  • 21 trades
  • 66.67% win rate
  • +$49.24 P&L
  • Profit factor 1.57
  • Max drawdown 0.74%

That’s a tradeable edge on a single ticker. Multi-symbol sweep across a watchlist of 32 momentum names over 30 days: 280 trades, 54.6% win rate, +$1,167 P&L, profit factor 1.59.

⚠️ About the watchlist: those sweep numbers are on a curated list of momentum names — semis, AI, energy infrastructure, high-beta consumer. I stress-tested the strategy on utilities and staples and it loses money there. This setup is designed for stocks that move, not for defensives. Run the prompt above on momentum names and you’ll get results that look like mine. Run it on a utility like SO or a staple like PG and you’ll get bad results — that’s not the strategy being broken, it’s just the wrong universe.

🎬 Want to see the strategy fire bar-by-bar? TradingView’s bar replay feature is incredible for this. Step through a historical day and watch each entry, partial exit, and trail trigger in real time.


Step 10 — Test an “obvious” filter (and learn from it)

Most traders’ instinct: “the strategy probably works better when SPY and QQQ are also up.” Let’s test that:

Add a regime check on top of the strategy. At the first 5-minute bar at or after 10am ET, check if SPY is above its previous daily close AND QQQ is above its previous daily close.

If yes, allow entries the rest of the day.
If no, no entries at all today.

Re-run the backtest with the regime filter on. Show me both versions side by side: trades, win rate, P&L, profit factor.

My results (30-day backtest, 32 watchlist tickers):

MetricWith Regime FilterWithout Regime Filter
Trades157280
Win rate54.1%54.6%
Total P&L+$381+$1,167
Profit factor1.281.59

The regime filter actually hurt. April was a net LOSS with the filter on (-$123) vs +$593 without. The “obvious” addition kills more winners than losers, because momentum names that break out on red-tape days are exhibiting relative strength — exactly what we want.

This is the lesson: test everything, even the obvious stuff. Half the things you’d assume help your strategy are actually hurting it.


Step 11 — Send results straight to your phone with Telegram

You don’t want to sit at your laptop refreshing JSON files. Get the alerts on your phone.

Pre-step — get your bot token and chat ID:

  1. Open Telegram and message @BotFather. Send /newbot, follow the prompts, and copy the bot token it gives you (looks like 123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ).
  2. BotFather will give you a t.me/<your_bot_name> link. Click it to open your new bot in Telegram, then send /start so the bot is allowed to message you back.
  3. In your browser, visit https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates (paste your token in place of <YOUR_TOKEN>). Look for "chat":{"id": — that number is your chat ID.

🔒 Security: your bot token is a password — anyone who has it can send messages as your bot. Don’t paste it into shared Claude chats, don’t commit it to GitHub, don’t post it in screenshots. Store it in a password manager.

Then paste this into Claude:

Send Scanner A and Scanner B results to my Telegram automatically.

My bot token is: YOUR_BOT_TOKEN_HERE
My chat ID is: YOUR_CHAT_ID_HERE

Update both Scanner A's and Scanner B's runner scripts and prompt files to send via Telegram. Make sure both source the same .env file for the credentials. Store the token in a local .env file or environment variable — don't hardcode it into any committed script.

Format Scanner A messages as a ranked list with ticker, gap %, and news catalyst.
Format Scanner B messages as the list of hits with the price levels they passed at.

Stay quiet on no-hit runs. Only ping me when there's something to look at.

You can also use email, Discord, Slack, or SMS instead of Telegram. The setup pattern is the same — give Claude the credentials, tell it the format, and it wires the rest. (WhatsApp is technically possible but requires the WhatsApp Business API, which means business verification through Meta and a paid carrier like Twilio. Way more friction than Telegram. Skip WhatsApp unless you really need it.)

💡 Bonus: Have Claude also send a one-line market summary at the same time so you can check the broader tape at a glance.


Step 12 — (Coming soon) Connect to a paper trading account

The next step is connecting this to a broker so the AI can actually execute paper trades — no manual order entry. I’ve been forward-testing with Interactive Brokers (IBKR) paper for the past few weeks, and it’s working but it’s far from plug-and-play. There’s a whole layer of safety checks, position sizing rules, and daily limits to wire up first.

Full walkthrough is in the next video — subscribe on YouTube so you don’t miss it.

🚨 Don’t connect this to a live account until you’ve tested it on paper for at least a month. Same rule applies to any automation — if something goes wrong, you want to lose pretend money, not real money.


FAQ

Do I need to know how to code?No. Every prompt above is plain English. Claude does the coding part. You’ll need to be comfortable copying commands into a terminal and approving permission prompts, but that’s it.

Will this work on Windows?The MCP itself works on Windows — TradingView Desktop and the debug port are cross-platform. What’s Mac-specific in this setup is the auto-scheduling layer (I use macOS launchd; on Windows you’d use Task Scheduler instead). Manual runs would work fine on Windows. I’ll cover the Windows version in a follow-up video.

Does this place trades for me?No. Reading and analyzing only. Execution is a separate setup (covered in the next video).

Is my data safe?Mostly yes. The MCP runs locally — it talks to TradingView Desktop on your own machine over port 9222. Your TradingView account credentials are never shared with Claude or Anthropic. Chart screenshots, strategy code, and watchlists stay on your machine.

One thing to know: anything Claude reasons over (like “analyze this OHLCV data”) passes through Anthropic’s API, same as any normal Claude prompt. That’s how the AI works at all — your conversation with Claude is sent to Anthropic, not run locally. If you’re handling sensitive trade signals you don’t want a cloud LLM to see, that matters.

How much does the whole stack cost?Two costs to think about:

  • To follow this tutorial and run scanners manually: TradingView Essential ($12.95/mo annually) + Claude Pro ($20/mo) = ~$33/mo. Good for testing.
  • To run the full automated daily setup like I do: TradingView Essential ($12.95/mo) + Claude Max 5x ($100/mo) = ~$113/mo. The Max plan is needed because Scanner B fires 9 times a day and Pro hits its usage caps before lunch.

If you want deep historical PineScript backtesting (multi-year), TradingView Premium is ~$50/mo instead of Essential.

The MCP server itself is free and open source.

Can I use ChatGPT or Gemini instead?I built this with Claude Code. OpenAI’s Codex CLI also supports MCP servers and could probably run a similar setup, but I haven’t tested it for this exact stack. The consumer chat apps (ChatGPT.com, claude.ai, gemini.google.com) don’t support local MCP servers yet — you need a coding agent that runs on your machine.

Will TradingView updates break this?Possibly. The MCP uses TradingView’s internal debug interface, which isn’t an officially supported API. If you want stability, pin your TradingView Desktop version once it’s working.

Can I use a different strategy than Trend Join Long?Absolutely. Replace the criteria in the Scanner B prompt and the PineScript prompt with your own setup. The whole pipeline is the same.

Is this allowed under TradingView’s terms of service?Reading data from your own paid TradingView Desktop app on your own machine for personal use is fine — the MCP is doing what you’d be doing manually (looking at your charts, copying numbers), just automated. What’s NOT okay: redistributing the data, running a paid signals service off it, or scraping data you haven’t paid for. If you’re building anything commercial off this, check TradingView’s TOS directly or contact their support. (I’m not a lawyer, this isn’t legal advice, etc.)

The post How to Build an Automated Day Trading Scanner with Claude AI + TradingView appeared first on Humbled Trader.

admin