CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. Trade only with money you can afford to lose.
Open TopFX Account →

Educational guide · demo account

Claude + cTrader: test a trading idea before you trust it

You have an idea for a trade. Before money goes behind it, you want to know whether it survives a real test: the broker's costs, a period it has never seen, and the number of attempts you have already spent on it. This page shows how to run that test with Claude on cTrader's own tools, in four skills, on a demo account. Nothing on this page sends an order.

A demo account is enough for everything below.

The point is speed of verification

The cycle from an idea to a tested hypothesis used to cost weeks of a programmer's time. Here it takes hours, and a person with no development experience goes through it.

  • Claude writes the algorithm in C# or Python. The vendor documents AI agents drafting cTrader CLI commands on a page of its own: the model drafts, you review, the CLI runs.
  • The history run is one command, backtest; the parameter sweep is another, optimize. optimize is documented for cTrader CLI 5.10; until it reaches your build, a series of backtest runs with different parameter files does the sweep and makes the number of attempts explicit.
  • The cycle ends in an acceptance report, not in an opinion: in-sample and out-of-sample runs with the broker's costs, a binary verdict, and the number of attempts written down.

Measured on our stand The first leg, from an idea in words to a compiled cBot, took 41 seconds: the model's draft 36 s, the vendor's compiler 5 s, no second iteration. The full cycle to an acceptance report is being measured on a demo account and will be published here with the date.

What this page solves

Four questions traders bring to a model, and the answer this page gives to each. Every answer runs on a demo account and ends in something you can check, not in a promise.

  • “The backtest looked great. The live account did not.” The idea is run on a period it has never seen, with the broker's spread and commission in the test, and judged against the number of attempts you already spent on it. The result is an acceptance report with one of two verdicts. Skill 1: test against overfitting ↓
  • “How much do I buy for this stop?” Balance, risk per trade, entry and stop go in; a volume in lots comes out, rounded down to the symbol's step and checked against the terminal's own Risk-reward tool. Skill 2: size for a fixed risk ↓
  • “Every morning the same routine, and I still miss things.” A scheduled pipeline pulls the data, applies the filters you declared, queues the backtests and sends one report to your messenger. It never sends an order. Skill 3: the morning pipeline ↓
  • “I want the model to see my account without handing it the keys.” The vendor's official MCP servers, a demo account, and a clear line between what the model reads and what it could change. Confirmation of trades is a setting you switch on yourself. Skill 4: connect safely ↓

The four skills

Test an idea against overfitting

  1. Write the rule in words: instrument, timeframe, entry, exit, stop-loss, the one parameter you would like to tune, and the period you will not touch until the end (the out-of-sample window).
  2. Let the model draft the cBot with the prompt below. Point it at the vendor's command reference at github.com/spotware/CLI-references so it does not invent options; that is the vendor's own advice for AI-drafted commands.
  3. Build and run the in-sample backtest with the broker's costs. The only required inputs are the dates and the data mode; add the commission and the spread yourself, and save the JSON report:
  4. Run the same cBot on the untouched period. Change nothing but --start and --end; save a second JSON report. That is a walk-forward step in its simplest form.
  5. Ask the model to write the acceptance report from the two JSON files, not from memory, with the fields listed in the checklist. Every field must quote the report it came from.
  6. Read the verdict as binary. "Not rejected" means the idea survived the filters you declared in advance. It does not mean "works".
docker pull ghcr.io/spotware/ctrader-console:latest

ctrader-cli backtest strategy.algo params.cbotset \
  --account=<account-id> --symbol=EURUSD --period=h1 \
  --start="01/01/2024" --end="31/12/2024" \
  --data-mode=m1 --commission=<per-lot> --spread=<pips> \
  --report-json=report-in-sample.json

Syntax as documented by the vendor on 2 September 2026: backtest takes the .algo file, an optional .cbotset parameter file, and the testing context. --report-json writes the machine-readable report the model will read.

Prompt: draft the cBot and the commands
You are drafting a cBot for cTrader Automate (C#) that will be backtested with cTrader CLI. Read the command reference at https://github.com/spotware/CLI-references before proposing any command. Do not invent options. Use placeholders for the account id and file paths. Never ask for a password.

Rule: <instrument, timeframe, entry, exit, stop-loss, exit rule>
Parameter to expose as a cBot parameter: <name, default, sensible range>

Deliver: (1) the cBot source; (2) a .cbotset file with the defaults; (3) the exact build and backtest commands for the in-sample window <dates> and the out-of-sample window <dates>, with --commission, --spread and --report-json; (4) your assumptions and anything that is missing.

Do not start `run`. Do not place orders. Do not estimate returns.
Prompt: write the acceptance report
Attached are two JSON backtest reports from cTrader CLI: in-sample and out-of-sample. This is attempt number N=<n> on this family of ideas (every parameter set and every rule change counts as one attempt).

Write an acceptance report with exactly these fields, each quoting the report it comes from: trades (IS / OOS); net result sign (IS / OOS); max balance drawdown (IS / OOS); ProfitFactor (IS / OOS); buy-and-hold of the same instrument over the same period; cost sensitivity (a third report with the spread doubled, if attached); N and the noise threshold for N attempts; bootstrap of trade order (drawdown distribution, if computed).

Verdict: "not rejected" or "rejected", with the reason. Do not forecast. Do not recommend a position. Do not use the word "works".
Acceptance report: the fields
  • Number of trades in each window. Too few trades out of sample, and the verdict is "inconclusive", not "not rejected".
  • Sign of the net result and the maximum balance drawdown, in-sample and out-of-sample, side by side.
  • Buy-and-hold of the same instrument over the same period. An idea that lost to holding the instrument is rejected.
  • Cost sensitivity: the same run with the spread doubled. An idea that dies on costs is rejected.
  • Declared N: how many attempts this family of ideas has consumed. With N attempts, the best result of pure noise is not zero: for ten thousand attempts over five years the expected best Sharpe ratio of noise is about 1.7 (Bailey and others, 2014). The threshold rises with N.
  • Bootstrap: shuffle the order of the trades a few hundred times and look at the distribution of drawdowns, not at the one path history happened to take.
Not on this page
  • No equity curve and no return figure. A pass through the filters is not a forecast.
  • No "strategy that works". An idea that is not rejected today can be rejected by the next window.

Why the vendor's tools. The backtester is the vendor's own command-line tool; it runs on Linux, macOS and Windows and inside the vendor's Docker image, with no third-party bridge and no paid charting plan. The parameter sweep (optimize) is documented for cTrader CLI 5.10; until it reaches your build, a series of backtest runs with different .cbotset files does the same job, and makes N explicit.

Everything above runs on a demo account. Open a TopFX demo account →

Size a position for a fixed risk

  1. Decide the risk per trade first, as a fraction of the balance, before looking at the chart. Half a per cent to one per cent is the range most textbooks use; the number is yours.
  2. Take the pip value per lot from the terminal, not from the model. In cTrader the order ticket and the Depth of Market show pip value and trade value for the volume you hover; give that number to the model as an input.
  3. Run the prompt below. It returns the stop distance, the money at risk, and the volume rounded down to the symbol's step, with the arithmetic line by line.
  4. Check against the terminal. cTrader's on-chart Risk-reward tool computes the trade volume from the amount you are willing to risk (units, a share of balance or of equity). The model's number and the tool's number must match. If they do not, the model's pip value is wrong: a misread unit is the most common way a model gets this step wrong.
volume (lots) = (balance × risk) ÷ (stop distance in pips × pip value per lot)
round DOWN to the symbol's volume step; never below the minimum volume

The formula is the standard one; the two inputs people get wrong are the pip value (take it from the terminal) and the rounding direction (down).

Prompt: position size
Compute a position size. Balance: <B> <account currency>. Risk per trade: <r> per cent of balance. Instrument: <symbol>. Entry: <price>. Stop-loss: <price>. Pip value per 1 lot for this symbol in my account currency, taken from the terminal: <value>. Minimum volume and volume step: <min>, <step>.

Return: stop distance in pips; money at risk; volume in lots rounded DOWN to the step; the arithmetic line by line. If any input is missing, stop and ask. Do not assume a pip value. Do not comment on whether the trade is a good idea.
Before the number is used
  • The stop-loss exists and is a price, not "I will watch it".
  • The pip value came from the terminal, with the account currency stated.
  • The volume was rounded down and is not below the minimum volume.
  • The terminal's Risk-reward tool gives the same volume for the same risk amount.
  • The volume respects the broker's contract: minimum, step and ceiling are on the TopFX lot size page.
Not on this page
  • No answer to "how much should I buy" without a stop-loss and a risk figure.
  • No leverage as a reason to size up. Leverage changes margin, not risk per trade.

Why the terminal is the judge. The Risk-reward tool lives on the chart in cTrader and takes the amount at risk as an input; it is the vendor's own calculator, so a mismatch with the model is a model error by definition.

Try it on a demo account with the terminal open. Open a TopFX demo account →

A morning pipeline that never sends an order

  1. Pull the data with the CLI, not with the model. One documented command per instrument, for example ctrader-cli candles --account=<account-id> --symbol=EURUSD --period=h1 --count=200; the output is JSON.
  2. Filter with code, not with opinion. A small script computes the filters you declared: session open now, spread below your cap, volatility above your floor. The model drafts the script once; the script runs every morning.
  3. Queue the backtests. For every instrument that passed, run the skill 01 backtests for each .cbotset in your hypotheses folder, with --report-json.
  4. Send one report. Instruments passed, hypotheses run, verdicts, time taken, errors. One message to a Telegram channel or an email. A cron entry inside the Docker container is enough.
  5. Keep the model off the schedule. The vendor's documentation says the agent should not start run on its own and that any command which starts a cBot must be reviewed before it runs. The pipeline's allow-list contains two commands: candles and backtest. No order or position command is on it.
# crontab inside the container (weekdays, 06:30 server time)
30 6 * * 1-5  /work/morning.sh >> /work/log/morning.log 2>&1

# morning.sh, allow-list of CLI commands: candles, backtest
# 1) candles for every symbol in symbols.txt
# 2) filters.py  -> passed.txt
# 3) backtest for every .cbotset in hypotheses/ on passed symbols
# 4) summary.py  -> one message to the channel

The shape of the pipeline, not a finished script. The model drafts the script from the prompt below; you read it before the first run.

Prompt: draft the pipeline
Draft a bash script for Linux that runs inside the cTrader CLI Docker container on a schedule. Steps: (1) pull the last 200 h1 candles for each symbol listed in symbols.txt with `ctrader-cli candles`; (2) run filters.py, which computes spread and volatility filters and writes passed.txt; (3) for each symbol in passed.txt, run `ctrader-cli backtest` for every .cbotset in hypotheses/ with --report-json; (4) run summary.py, which builds a plain-text summary and sends it to <channel>.

Stop on the first error. Allowed CLI commands: candles and backtest only. Never call run, and never call any order or position command. Use placeholders for credentials and read the password from a file with --pwd-file; never put it in the script.
Before the first scheduled run
  • The allow-list is enforced in the script, not promised in a comment.
  • The password comes from a file outside the repository; the script prints no credentials.
  • The report states how many hypotheses were run and how many failed with an error, so a silent failure is visible.
  • The pipeline ran by hand at least once with you watching the output.
Not on this page
  • No order sending. A trade, if any, is a separate step by a person, on a demo account.
  • No "the machine trades while you sleep". A cBot can run on a server; this pipeline runs a report.

Why the CLI and Docker. The vendor documents the CLI as the tool for scripted, repeatable automation on a server, with every feature available in its Docker image, including backtesting. A pipeline built on the vendor's tool needs no bridge that somebody else maintains.

The schedule runs on a demo account. Open a TopFX demo account →

Connect the model to the account without handing it the keys

  1. Local MCP server (cTrader Windows or Mac): Settings → MCP Server. Three tick boxes: Enable MCP server; Allow trading via MCP; Require confirmation for trading operations. For everything on this page, leave "Allow trading" unticked.
  2. If you ever enable trading, tick "Require confirmation" yourself and check what your build does out of the box. The vendor's page names the option; on 2 September 2026 it did not state the default. Confirmation is a setting, not a given.
  3. Remote MCP server (cTrader Web): Settings → Remote MCP issues a separate token per trading account; it works while the web session is active, and an expired session means signing in again. Treat the token as a password: configuration file only, never in a prompt, never in a repository.
  4. Install the vendor's skills package so the agent knows the tools: npx skills add https://github.com/spotware/ctrader-skills --all --global, then restart the agent.
  5. Read the vendor's list of known quirks before trusting any action that modifies an order or a position. The vendor publishes it; it is the honest part of the documentation.
  6. Check the terms of your model plan. Anthropic's consumer terms (8 October 2025) say not to rely on the services to buy or sell securities or to receive advice about derivatives. Everything on this page is tier A: reading data and running backtests. No order goes through the model.
  7. The account side is ordinary: a cTID and a demo account with the broker; the cTrader at TopFX page describes the platform as offered here, and how to open an account covers the steps.
{
  "mcpServers": {
    "ctrader": {
      "type": "http",
      "url": "http://127.0.0.1:9876/mcp/"
    }
  }
}

The local server configuration as shown in the vendor's setup page. No token, no password: the local server authenticates through the running cTrader session.

Prompt: the first session
Using the cTrader local MCP server: list the connected trading accounts and confirm that the account in use is a DEMO account. Then list the tools available to you and sort them into two groups: read-only, and tools that can change an order or a position. Do not call anything from the second group in this session.
What the model sees and what it could change
  • Local server: charts, indicators, workspace, account data, and starting or stopping cBots; trading only if "Allow trading via MCP" is ticked.
  • Remote server: sixteen tools in the vendor's reference on 2 September 2026, eleven of them read-only, five that change orders or positions.
  • Demo account confirmed in the first message of every session.
  • No flag that skips confirmation anywhere in your commands or configuration.
Not on this page
  • No password in a configuration file or a prompt.
  • No live account. A cTID with a demo account is enough for all four skills.
  • No "the model trades natively". It drafts; a person reviews; the terminal executes only what a person confirmed.

Why the official servers. Most guides connect the model to a terminal through a bridge somebody maintains in their spare time. The cTrader MCP servers and the skills package are the vendor's, dated and documented; when they change, the change has a date.

Open a demo account, then connect. Open a TopFX demo account →

What you will not find on this page

  • Income figures of any kind, ours or anyone else's.
  • Where the price is going, market calls, or a model reading a chart from a screenshot.
  • Buy or sell recommendations for any instrument.
  • Copying other people's trades, or automation on somebody else's calls.
  • Claims of being first or the sole platform with an AI integration. Several brokers and platforms have shipped MCP servers or agent APIs; cTrader is one of the first FX/CFD platforms with official ones.
  • Any claim that trade confirmation happens by itself. It is a setting in the terminal; you switch it on.

The words we use

  • A model does not predict price and does not guarantee anything.
  • A person is in the loop: one command, one review, one confirmation.
  • Demo first. Demo is enough for all four skills.
  • Code with rules beats an opinion: filters and sizes are computed, not felt.
  • Context beats the question: the model gets the report, the costs and the constraints, not "is this a good trade".
  • The model is a reviewer, not a generator of trades.

What we measured ourselves

Numbers you will not find in a tutorial. Ours, from the vendor's Docker image; the lines still marked pending follow when the demo account is connected to the stand, with the date. Measured on 4 September 2026.

Vendor toolchain on our stand: pulling the CLI image, scaffolding a cBot and compiling it inside the Docker image
scaffold 2.4 s · model draft 36 s · compile 5.2 s · one iteration
Time from an idea in words to a finished acceptance report on cTrader CLI, demo account
not yet measured
What a fresh cTrader install does with trade confirmation for MCP, out of the box
not yet measured

Questions

Do I need to know how to code?

You need to read, not to write. The model drafts the C# and the commands; the CLI builds and runs them; you review every command before it runs. That is the vendor's own model for AI-drafted commands.

Which account do I need?

A demo account. Everything on this page runs on demo; a cTID with a demo account is enough for the CLI, the Docker image and both MCP servers.

Does it run on Linux?

The CLI and its Docker image run on Linux, macOS and Windows. The local MCP server needs cTrader Windows or cTrader Mac running; the remote one needs a cTrader Web session.

Does "not rejected" mean the idea makes money?

No. It means the idea survived the filters you declared before the test. With enough attempts, noise survives too; that is why the number of attempts is written into the report and raises the threshold.

Is Claude required?

No. Any agent that can read the CLI reference and speak MCP will do; the vendor lists several developer clients. We use Claude Code in our own stand, on developer access rather than a chat subscription.

Can it run around the clock?

A cBot can run on a server or in the vendor's cloud. The pipeline on this page runs on a schedule and produces a report; it does not place orders at any hour.

Start on a demo account

All four skills need a cTID and a demo account. Open one, install the CLI or pull the Docker image, and run a first backtest with the broker's costs in it.

Open a TopFX demo account

A demo account is enough for everything below.

AI disclosureParts of the code samples and prompts on this page were drafted with an AI model and reviewed by a person before publication.

Not adviceThis page is education about tools. It is not investment advice, not a recommendation to trade any instrument, and not an invitation to open a live account.

ProtectionA general-purpose AI model is not a regulated financial service. Its output is not covered by the investor compensation scheme or the financial ombudsman of your jurisdiction.

Broker disclosureThe broker's own disclosure states that 85.19% of retail investor accounts lose money when trading CFDs with this provider.

Sources and dates

  1. cTrader CLI documentation: cBot lifecycle, backtest syntax, Docker image — checked 2 September 2026
  2. cTrader CLI: AI workflows ("review and run", safe prompts) — checked 2 September 2026
  3. cTrader CLI command reference (GitHub) — version of 14 August 2026
  4. cTrader local MCP server setup (three settings) — checked 2 September 2026
  5. cTrader remote MCP server setup (token per account, active session) — checked 2 September 2026
  6. Skills for cTrader MCP servers — checked 2 September 2026
  7. cTrader Risk-reward tool (volume from the amount at risk) — checked 2 September 2026
  8. Spotware: cTrader launches official MCP servers — 14 May 2026
  9. Bailey, Borwein, López de Prado, Zhu: Pseudo-mathematics and financial charlatanism (the expected best Sharpe ratio of noise) — 2014
  10. Anthropic consumer terms — 8 October 2025

Disclosure: Spotware, the vendor of cTrader, lists TopFX among its featured clients. This page is written by an independent introducing-broker partner of TopFX, not by either company.