Plugging DeepSeek, Claude or Codex into a Backtester over MCP: the Real Path
"Which AI should I use for trading?" The question keeps coming back, and the usual answer is an opinion. Here we describe something else: how to plug an AI (DeepSeek, Claude, Codex or a local model) into a real backtester over MCP, the protocol that lets an AI use a piece of software, and what actually happened when DeepSeek drove our Lab for four research sessions, from October 10 to 12, 2026.
This is not a ranking. It is a path, mistakes included.
Plugging in the AI
The Lab is a free application (Windows and Linux) that runs on your PC. It only listens on 127.0.0.1, with a private token; everything is computed locally. The Lab's "Connect my AI" button gives a ready-made configuration for your client, with the real path and port, and can write it into the client's file itself.
The formats, as the Lab generates them (replace PATH, PORT and TOKEN with what it shows):
Claude Code, over stdio:
claude mcp add strategyarena-lab -- node "PATH"
opencode with DeepSeek, file ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"strategyarena-lab": {
"type": "remote",
"url": "http://127.0.0.1:PORT/mcp",
"headers": { "Authorization": "Bearer TOKEN" },
"enabled": true
}
}
}
Codex, file ~/.codex/config.toml (a proof can take several minutes, hence the long tool timeout):
[mcp_servers.strategyarena_lab]
command = "node"
args = ["PATH"]
startup_timeout_sec = 20.0
tool_timeout_sec = 630.0
Claude Desktop, Cursor and LM Studio have their own formats; everything is on the Lab MCP page. The Lab does not look at which model sits behind the client: the judge is the same for every AI.
The path
Once connected, the AI calls start_here. The Lab answers with the path and ready-to-send arguments:
list_sandbox_datasets: pick a market from the local data store;validate_sandbox_strategy: have the script checked (an invalid script gets a named error and a minimal example; it costs nothing);prove_sandbox_script: the proof. The judge selects on the training part, opens the sealed period once, counts every declared trial, and answers "survives", "mirage" or "inconclusive";export_sandbox_pine: the Pine export of the judged strategy, to paste into TradingView.
Backtests and GPU sweeps are for exploring. They describe the past; only the proof judges.
Session 1: a spectacular number, an "inconclusive" verdict
DeepSeek swept 2,000 variants of a moving-average crossover on BTC 4h (under a second on GPU), kept the best one, then submitted it to a proof on a sealed period of 1,800 candles. On that period, the rule made +35.8% while buy-and-hold made −8.8%.
The judge answered "inconclusive": a single setting was submitted, so PBO, SPA and CPCV could not be computed. A counter-test later showed two method errors in that session: the sweep's "holdout" column overlapped the test period, and the 2,000 trials had not been declared. Re-judged on ETH and SOL 4h with its 2,004 trials declared, the same family got a deflated Sharpe of 0.7%: mirage.
Session 2: preregistering, and over-counting
DeepSeek changed method: hypothesis written before any computation (a multi-scale Donchian channel), settings frozen in advance, no sweep, one proof on markets this family had never opened (ADA and ATOM 4h). But it declared the previous session's 2,004 trials as prior trials. The deflated Sharpe fell from 98.6% to 3.3%.
That was an error in the other direction. The trials to declare are those used to choose this rule, not the project's history. For a rule written in advance, with no selection, that is 0 (the judge itself adds the rules recently fixed in the Lab). Counting trials is simple to say and trickier to do.
Session 3: four preregistered families, none with an absolute gain
With the right counting rule, DeepSeek preregistered and judged four classic families (Donchian channel, long-short EMA regime, a short-selling module, Moskowitz-Ooi-Pedersen time-series momentum), each on a fresh pair of markets. The test window shared by all available data was bearish.
Measurement: all four families limited the drawdown against buy-and-hold (a gap of +19.7 to +38.9 points), but none finished with an absolute gain over the test period. The judge requires an absolute gain on top of the gap: a "mirage" verdict for each. The only family with an absolute gain on these data was session 1's crossover, selected among 2,000 trials and therefore already judged a mirage. One momentum rule could not be exported to Pine (the CHANGE indicator is outside the exportable subset): the Lab refused it with a named message.
Session 4: a documented failure
The mission: improve an existing long-term strategy, "V3", judged as a walk-forward (4 folds of about 2 years) on daily BTC, 2018-2026. The preregistration and both candidate scripts were frozen and versioned before any computation, with a frozen criterion: a better Calmar ratio on every fold.
- Variant A (a brake when price falls 25% below its 180-day high): worse on all 4 folds.
- Variant B (buying back on RSI(3) < 15): never strictly better.
- The proof comparator (paired block bootstrap): p = 6.5% for V3 vs A, p = 88.9% for V3 vs B. No significant difference.
- ETH control, same scripts untouched: an isolated risk effect on one fold for variant A, not confirmed elsewhere.
- V3 rerun identically: same numbers to the bit.
Neither variant improves V3. The negative result is published as is. DeepSeek also tried to judge the two most recent months: the Lab refused a formal proof (minimum 300 candles, only 54 were left) and gave a descriptive reading only, labelled as such. That refusal produced a feature request: telling the user "X more weeks of data are needed to conclude".
What these four sessions show
- An AI connected to a judge learns the method. From session 1 to 4, DeepSeek went from an undeclared sweep to a preregistration versioned before computation.
- Method errors are visible. Test-period overlap, undeclared trials, then over-declared trials: each left a trace in the reports and was corrected.
- The judge could not be talked round. A +35.8% on a single setting stays "inconclusive". Four families that limit the drawdown stay mirages without an absolute gain.
- A well-run failure is a result. Session 4 answers its question: no.
Limits: these sessions ran on a working version of the Lab (245), on crypto data covering the same recent window, and a language model may have memorized market history before its knowledge cutoff: the test that counts is a future period. These results describe a method and its verdicts, not a strategy to follow.
What about Claude and Codex?
The setup is the same. Codex used the Lab over MCP to audit it: 25 defects confirmed out of 27. For the loop that lets an AI search all night, measured on noise: can an AI find a trading strategy?. For comparisons between AIs: Claude vs ChatGPT vs Grok for trading and which AI to use for trading.
To plug in yours: the Lab MCP guide, then download the Lab (free). The download page currently serves version 243; the start_here path that goes through the judge first ships with 246, under verification.
Key takeaways
- Claude Code, Codex and opencode with DeepSeek connect to the Lab over MCP in a few lines; the judge is the same for all.
- Path:
start_here, data, validation, sealed proof, Pine export. - Four DeepSeek sessions: a single setting "inconclusive", trial counting corrected in both directions, four preregistered families without an absolute gain, a preregistered improvement that fails.
- An AI that searches needs a judge it cannot talk round.
Research on past data, not investment advice. The figures quoted are research measurements on past data, with the limits stated.
⚠️ Disclaimer — This article is for informational and educational purposes only. It does not constitute investment advice or a buy/sell recommendation. Past performance does not guarantee future results. Strategy Arena is an educational simulator with virtual capital. Always do your own research before making investment decisions.