← FXAbsolute Coding agents

How to Backtest Forex From Claude Code

Published 2026-08-17 · Updated 2026-08-28 · FXAbsolute

Claude Code cannot see a chart. What it can do — once you give it the data — is answer questions over 28.4 million real candles in seconds that would take you a week of clicking. This is the setup, a real transcript, and an honest account of where the agent stops being useful.

What this actually gets you

Two different things, worth separating because people conflate them.

Statistical research — "how often did price gap more than 20 pips over a weekend", "which hour has the widest range", "how often did this level hold". These are counting problems over a large sample, and an agent with tool access answers them properly. This works well.

Strategy judgement — "is this a good setup", "should I take this trade". The agent will answer confidently and the answer is generated prose, not measurement. This does not work, and no amount of data changes it.

The setup below is worth doing for the first. Treat the second with suspicion.

Setup, three commands

You need Node 18 or newer and Claude Code installed.

git clone --depth 1 --filter=blob:none --sparse https://github.com/varsansri/fxabsolute
cd fxabsolute && git sparse-checkout set mcp
cd mcp && npm install

claude mcp add fxabsolute -- node "$PWD/src/index.js"

Confirm it registered, and check the data is sound:

claude mcp list
npm run smoke

The smoke suite runs 18 assertions against live data in under two seconds — H1 bars landing on exact hour boundaries, timestamps strictly increasing, no bar with a high below its own low. If it passes, you are ready.

Why a clone rather than a one-line install: the package is not on npm yet. The server fetches candles over HTTPS at runtime, so it does not need the repository's data files — the clone is simply the current distribution route.

A real session

Here is an actual exchange, with the figures the tools returned. Run the same prompts and you will get the same numbers.

Ask what exists

> what forex data do you have access to?

fxa_instruments →
  15 instruments, 28,412,683 M1 bars, 2021-01-03 to 2026-08-03
  no volume field, no bid/ask spread

Note that the tool volunteers the absences. That matters more than it looks: an agent told "there is no volume" will not quietly invent a volume-based answer.

Ask a counting question

> when is EURUSD most volatile, and by how much?

fxa_bucket_stats  EURUSD  by=hour  →
  14:00 UTC   2.83 pips avg M1 range
  13:00 UTC   2.71
  15:00 UTC   2.44
  ...
  21:00 UTC   0.73   ← quietest
  sample: 1,911,141 bars

A 3.9× spread between the busiest and quietest hour, across 1.9 million bars. That is a defensible number, and it took one call.

Ask something that should make you suspicious

> is 14:00 UTC a good time to trade EURUSD?

The agent will produce a fluent paragraph about liquidity overlap and institutional flow. Some of it is true. None of it was measured. The volatility figure above is evidence; the explanation for it is a hypothesis the model generated, and it will sound identical whether it is right or wrong.

The discipline that makes this useful: ask for the number, then ask how it was calculated. If the agent cannot point at a tool call, treat it as opinion.

Try it while you read FXAbsolute replays real historical candles bar by bar, free, in your browser. No account, no download, no card.
Start free — no account →

Questions worth asking it

Questions shaped like counting problems, where a large sample beats intuition:

Each is one tool call, and each would take hours by hand.

Where it goes wrong

Four failure modes worth knowing before you trust output.

Put this into practice Five years of real one-minute data across 15 instruments, with an automatic trade journal. Free forever.
Open the free backtester →

Does this replace manual backtesting?

No, and it is worth being clear about why.

Statistical research tells you where an edge might exist. It cannot teach you to execute one — to sit through a drawdown, to skip a setup that nearly qualifies, to take the trade when it looks uncomfortable. That skill is built by making decisions bar by bar and living with them, which is what manual replay is for.

The productive division: use the agent to narrow the search space, then practise the surviving idea by hand until execution is automatic.

Setup is now a single command

The server is on npm as fxabsolute-mcp, so there is nothing to clone, build or configure:

claude mcp add fxabsolute -- npx -y fxabsolute-mcp

Run claude mcp list and you should see fxabsolute. From there the agent has ten tools against 28,412,683 real one-minute bars.

A first question worth asking, because the answer is checkable and it demonstrates the difference between recall and measurement:

"Using the fxabsolute tools, what is the average range of a EURUSD one-minute bar for each hour of the UTC day? Show the three busiest and three quietest hours."

The agent will return roughly 2.83 pips at 14:00 UTC against 0.73 at 21:00 — a 3.9× spread measured across 1.9 million bars. It computed that from the archive. Ask the same question without the tools and you get a plausible-sounding paragraph with no number behind it.

Frequently asked questions

What do I need to install to backtest forex from Claude Code?

One command: claude mcp add fxabsolute -- npx -y fxabsolute-mcp. The package is on npm, needs no API key or account, and pulls the candle data it needs on demand.

Can Claude Code backtest forex?

Claude Code can run statistical research over historical forex data once connected to a data source such as the FXAbsolute MCP server. It can compute win rates, volatility profiles, gap distributions and correlations across millions of bars. It cannot judge whether a strategy has a genuine edge, and it cannot practise execution.

Do I need an API key?

No. The FXAbsolute MCP server requires no key and applies no rate limit, because the candle data is served as static files.

What data does the agent get?

28,412,683 one-minute OHLC bars across 15 forex, index and crypto instruments, spanning January 2021 to August 2026, aggregated on demand to any timeframe from M1 to W1. There is no volume field and no bid/ask spread.

Does this work with Cursor or other agents?

Yes. The server implements the Model Context Protocol, so any MCP-compatible client works — Claude Code, Claude Desktop, Cursor and others. Only the registration command differs.

Can the agent see my live chart?

Yes, if you pair it. The fxa_connect_chart tool joins the agent to a running browser session using a short code you read out, after which it can read your chart state and reply into the interface.

Should I trust the agent’s trading advice?

Treat its numbers as evidence and its explanations as hypotheses. Statistics come from tool calls and are reproducible; the reasoning around them is generated text that sounds equally confident whether it is correct or not. Always ask which tool call produced a figure.

Practise the idea your agent found

Statistical research narrows the search. Bar-by-bar replay is where execution is learned. Free, no account.

Open FXAbsolute →