How to automate trading strategy backtests with AI agents

6 real setups for trading strategy backtests, most-discussed first. Steps come from each source; the full prompt is one click away.

Quick answer

6 real setups on agentsetups show how people automate trading strategy backtests with AI agents. Agents used: Claude (4), Grok Bot (2), Perplexity Computer (1), Codex (1).

Fastest start (from Build a strategy backtesting engine with Claude Code by Miles Deutscher):

  1. Open Claude Code and send the backtesting prompt (attached to the post).
  2. Describe your strategy in plain English: entry, exit, stop, position size.
  3. Tell it to include fees and slippage.

+3 more steps in the copyable prompt.

Last updated · based on 336 use cases on agentsetups, each credited to its author.

1. Build and backtest a trading bot with no coding background

Non-developers have an agent build, backtest and run a trading strategy; claimed results are unverified.

  1. Explain the market and the strategy idea in plain language; the author started with zero technical background.
  2. Have the agent backtest the strategy (Fable 5 was used for backtesting and building).
  3. Check the backtest for bugs. A separate dev.to write-up found its own backtest had bugs that inflated results.
  4. Run the bot from an agent you can talk to from your phone (GrokBot in the step-by-step source).

Claude, Grok Bot · by Davidd Tech (X post, 12 Oct 2026) · source

2. Build a strategy backtesting engine with Claude Code

Describe entry, exit, stop and size in plain English; include fees and slippage; get win rate, max drawdown and a dashboard.

  1. Open Claude Code and send the backtesting prompt (attached to the post).
  2. Describe your strategy in plain English: entry, exit, stop, position size.
  3. Tell it to include fees and slippage.
  4. Run it and ask for win rate, max drawdown and average R per trade.
  5. Ask for a dashboard to visualise the results.
  6. Quality-check: import the source into TradingView and compare.

Claude · tools: TradingView · by Miles Deutscher (X post, 8 Oct 2026) · source

3. Give your trading bot an Obsidian second brain

Grok Bot and Claude Code built a 28,728-file vault from scattered charts, screenshots and notes; it then refused a trade.

  1. Gather charts, screenshots and notes from their separate places.
  2. Have the agents build an Obsidian vault from them.
  3. Have the trading bot check the vault before acting.

Claude, Grok Bot · tools: Obsidian · by Spike 1% (X post, 4 Sep 2026) · source

4. Build an MCP server for live stock data

Tired of pasting numbers, a builder made an MCP server for ~8,200 NSE and BSE stocks so Claude stops inventing P/Es.

  1. Build an MCP server over the exchange data you need (here all NSE + BSE stocks).
  2. Connect it to Claude so it pulls numbers instead of recalling them.

Claude · tools: MCP · by hit (X post, 20 Sep 2026) · source

5. Build a stock analysis terminal with Perplexity Computer

One instruction: a terminal for analysing $NVDA with real-time data from Perplexity Finance; no code written by hand.

  1. Give Computer one instruction: build a terminal to analyse a ticker using real-time Perplexity Finance data.
  2. Review what it builds.

Perplexity Computer · tools: Perplexity Finance · by Quant Science (X post, 13 Oct 2026) · source

6. Let Codex run hours of strategy backtests on screen

Codex operated the computer for 12 hours of iterative backtesting of an old Pine Script algo on LuxAlgo.

  1. Open the backtesting tool (here LuxAlgo, free).
  2. Have Codex operate the computer to run iterative backtests on the Pine Script algo.
  3. Let it run for hours and review the results.

Codex · tools: Pine Script, LuxAlgo · by TargetAcquired (X post, 7 Oct 2026) · source

Questions people ask

Which AI agent is best for automating trading strategy backtests?

In the 6 setups here, the agents named are Claude (4), Grok Bot (2), Perplexity Computer (1), Codex (1). That is what people used, not a quality ranking.

What do I need to automate trading strategy backtests with an AI agent?

An agent (Claude, Grok Bot, Perplexity Computer are the most common here). Each setup lists only the tools its source states.

Is there a prompt I can copy?

Yes. Every use-case page has a copyable prompt with the steps embedded and a “Based on” credit line, for example Build a strategy backtesting engine with Claude Code.

Related guides