Jul 9, 2026 · Free Guide

Backtest Any Trading Strategy With Zero Code, Using Claude + TradingView

You don't need to code. You don't need to know Pine Script. You don't even need a strategy. Describe how you trade in plain English and Claude does the rest, launches TradingView, writes the strategy, runs it against decades of real price data, and shows you in black and white whether it actually makes money, or if you'd have been better off doing nothing. Here's the whole setup, beginner proof.

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:

  1. TradingView Desktop app — free account, works forever. (Not sponsored, no affiliate link anywhere in this guide.)
  2. Claude Code— Anthropic's terminal tool, at claude.com/claude-code.
  3. 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.

STEP 1

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.

STEP 2

Connect Claude to the TradingView repo

This is the connector that lets Claude drive TradingView. It's an open-source repo:

github.com/LewisWJackson/tradingview-mcp-jackson

The beginner-proof way (recommended): open Claude Code and paste this:

Install the TradingView MCP for me from https://github.com/LewisWJackson/tradingview-mcp-jackson Clone it to my home folder, run npm install, then register it with Claude Code using the "claude mcp add" command so it loads globally. Then tell me to restart Claude Code, and after I do, verify the connection with the tv_health_check tool.

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:

git clone https://github.com/LewisWJackson/tradingview-mcp-jackson.git ~/tradingview-mcp-jackson
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.

STEP 3 · THE PROMPT

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.

You have access to the TradingView MCP. Backtest a trading strategy for me, end to end. First, ask me which strategy I want to test: ticker, timeframe, entry rule, exit rule, and starting capital. If I say I don't have a specific strategy, do NOT invent one. Instead ask me: 1. What do you typically trade? (stocks, ETFs, crypto, futures, forex, and any tickers) 2. What outcome do you want? (steady growth, beat buy-and-hold, income, aggressive growth) 3. What's your risk tolerance? (low / medium / high, and the biggest drawdown you could stomach) Then propose ONE simple strategy that fits my answers, explain it in plain English, and confirm with me before running anything. Once we have a strategy, do all of this yourself: 1. Launch TradingView and connect (tv_launch, then tv_health_check). 2. Set the chart to my ticker and timeframe. 3. Write the strategy in Pine Script v6. Include realistic commission and slippage so the results aren't fantasy numbers. 4. Compile it, fix any errors yourself, and add it to my chart. 5. Open the Strategy Tester and pull the full results. Then build me a full HTML dashboard and open it in my browser, with: - Total P&L, win rate, total number of trades, profit factor, max drawdown, average trade - A line chart of portfolio growth over time: my strategy vs. buy-and-hold on the same timeline. Pull the REAL equity curve from the strategy report, not a mock-up. - A straight-talk verdict. If it loses money or underperforms buy-and-hold, tell me directly, and give me 2-3 specific tweaks to test next. Don't sugarcoat the results.

That's it. Hit enter and answer its questions. Claude does the coding, the error-fixing, and the reporting.

STEP 4 · THE LOOP

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:

Now iterate on the strategy until it beats my targets, automatically. Targets it has to beat (edit these to whatever you want): - Beat buy-and-hold total return, AND - Profit factor above 1.5, AND - Max drawdown below 20%, AND - At least 30 trades (so it's not a lucky fluke) Run a loop: 1. Start from the current strategy. 2. Each round, change ONE thing (RSI threshold, moving-average lengths, the exit rule, add a stop-loss or trailing exit, adjust position sizing). 3. Recompile, re-run the Strategy Tester, record the results in a table. 4. Keep changes that improve the targets, throw out the ones that don't. 5. Repeat until ALL targets are met, or until you've tried 10 rounds. Rules: - One variable per round, so we know what actually moved the needle. - No curve-fitting nonsense (no 90% win rate on 4 trades). Keep trade count realistic. - Keep commission and slippage on the entire time. - Show me the running scoreboard after every round. When you're done (or hit 10 rounds), build the full HTML dashboard for the BEST version, with the portfolio-growth-over-time chart vs buy-and-hold, open it in my browser, and give me: - The winning rules in plain English and the final Pine Script - The before/after metrics - Whether it beat every target, and if not, which one it couldn't crack and why.

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.

All Resources

TradingView Connector (GitHub)The free open-source bridge
Original ProjectWhat the fork is built on
TradingViewFree account + desktop app
Claude CodeYou need this installed

The Next Step

Guides show you what. AI Builders shows you how.

Inside the community, I walk through every build live — including the stuff that doesn't make it into guides. Regular people (not developers) figuring out AI together, shipping real projects, asking me anything. No fluff, no theory, just the actual work.

Join AI Builders

skool.com/ten-fold