What you're actually building
Here's the end state: you type a few sentences into Claude, and about a minute later a dashboard pops open in your browser showing your strategy's total profit, win rate, max drawdown, and a line chart of your portfolio growing (or shrinking) over time, right next to a plain buy-and-hold of the same ticker.
No spreadsheets. No manually clicking through charts. No "trust me bro" backtests. Real numbers, with commission and slippage baked in so it's not fantasy math.
Three pieces make it work: TradingView (the engine that runs the backtest), Claude Code (the brain that writes the code and reads the results), and a free connectorthat lets the two talk. Let's set up all three.
The shopping list
You need exactly three things, all free to start:
- TradingView Desktop app — free account, works forever. (Not sponsored, no affiliate link anywhere in this guide.)
- Claude Code— Anthropic's terminal tool, at claude.com/claude-code.
- The TradingView connector — a free open-source bridge on GitHub. It reads and controls the TradingView app already running on your machine. Everything stays local; nothing gets sent anywhere.
One prerequisite under the hood: Node.js 18 or newer(the connector runs on it). Don't have it? Claude will tell you and can walk you through installing it.
Get TradingView (free, not sponsored)
Go to tradingview.com, create a free account, and download the Desktop app (not just the website, the connector needs the actual app installed). The free Basicplan is free forever, no credit card, and it's enough to start backtesting.
Two honest notes so you're not surprised:
Free Basic plan caps you at 2 indicators per chart and limited history. Fine for kicking the tires.
Want the deep stuff?Full history and TradingView's Deep Backtesting engine live on the Premium tier. Every paid plan (Essential, Plus, Premium) comes with a 30-day free trial— cancel before it ends and you're not charged. Run your whole setup inside the trial, then decide. Again, I get nothing if you do.
Open the Desktop app once and sign in so it's ready.
Connect Claude to the TradingView repo
This is the connector that lets Claude drive TradingView. It's an open-source repo:
The beginner-proof way (recommended): open Claude Code and paste this:
Claude handles the whole install. When it's done, fully quit and reopen Claude Code (the connector only loads on startup), then ask it to run tv_health_check.
Prefer to do it manually? Paste this into your terminal:
cd ~/tradingview-mcp-jackson
npm install
claude mcp add tradingview -s user -- node /Users/YOUR_USERNAME/tradingview-mcp-jackson/src/server.js
Replace YOUR_USERNAMEwith your computer's username (run echo $USER to find it). Then restart Claude Code.
You're connected when tv_health_check returns cdp_connected: true. If it says false, your TradingView Desktop app just isn't open yet, or ask Claude to run the tv_launch tool and it'll open it for you automatically.
The Backtest Prompt (copy, paste, go)
This is the exact prompt. It's built so that if you have a strategy, it runs it, and if you don't, it interviews you first and proposes one instead of making something up.
That's it. Hit enter and answer its questions. Claude does the coding, the error-fixing, and the reporting.
Hunt for a strategy that beats your targets
A single backtest tells you if one idea works. The real power is telling Claude to keep iterating until it finds a version that beats the numbers you care about. Paste this next:
Change the targets to match how you trade. Want lower risk? Drop the max drawdown to 10%. Want more action? Raise the trade count. Claude treats it like a science experiment, one change at a time, and shows its work.
How to read the dashboard (don't fool yourself)
The dashboard hands you six numbers and one chart. The chart is the one that keeps you honest: your strategy's equity curve laid over a plain buy-and-hold of the same ticker, on the same timeline. Flip it to a linear scale and the gap between the two lines is the money your strategy made or missed.
Watch for the classic trap: a strategy with a beautiful 75% win rate that still loses to buy-and-hold because it sits in cash while the market runs. High win rate feels good. Beating buy-and-hold is what pays. The two numbers that actually matter are profit factor (above 1.5 is respectable) and whether the strategy line finishes above the buy-and-hold line. Everything else is context.
The fine print (read it)
This is a tool for testing ideas, not a money printer. Straight talk:
- A backtest is not a prediction. It tells you what would have happened, not what will. Markets change.
- Keep commission and slippage on. A strategy that only works with zero costs doesn't work.
- Watch for curve-fitting. If it takes 8 hyper-specific rules to look good, it memorized the past, it didn't learn an edge.
- Not financial advice. This guide is educational. The connector is open-source and not affiliated with or sponsored by TradingView or Anthropic. Trade your own money at your own risk.