Skip to main content
Each recipe chains real MCP tools in the order you’d call them. The calls are shown as tool name + arguments — your client phrases them as its own tool invocations. The golden rule runs through all of them: kick off, then wait_for_completion. See developer concepts for the why.
Every metric below is a hypothetical, simulated backtest result — deterministic math over real historical prices, net of modeled slippage and commission, not advice. Past performance does not guarantee future results. Always test before you trade.

Recipe 1 — Create a strategy and backtest it

The most common flow. create_strategy builds the rules and runs a backtest in one shot (it’s on by default), so you wait once on the build, then read the finished strategy.
1

Create a session

Get a session_id to hang everything off of.
2

Start the strategy

Describe the idea in plain English. You get back an operation_id.
3

Wait for the build

Poll the operation_id with task='strategy_op'. On success the result carries the finished strategy summary, including its backtestResults.
4

Read the result

Inspect the strategy, and hand the app_url to your user so they can open the strategy card and Strategy Flow chart.
{
  "title": "MNQ opening-range breakout"
}
If step 3 returns status: "timed_out", the build is still running server-side. Call wait_for_completion again with the same operation_id — it’s not an error.
Don’t backtest or optimize the artifact until step 3 reports succeeded. Until then the strategy is still creating. Results are hypothetical and simulated — past performance does not guarantee future results.

Recipe 2 — Backtest an existing strategy

You already have a strategy artifact (maybe created with backtest=false, or its backtestStatus is not_tested / failed, or you just want a fresh run). backtest_existing_strategy re-tests it in place — no new version, no fork.
1

Find the artifact

list_strategies to get the artifact_id and its current backtestStatus.
2

Start the backtest

backtest_existing_strategy kicks it off.
3

Wait on the artifact

Poll with task='backtest' and the artifact_idwait_for_completion watches the artifact’s backtestStatus.
{
  "session_id": "<session_id>"
}
On success you get backtest_resultstradeCount, totalPnl, winRate, maxDrawdown, sharpeRatio. See the metrics glossary for what each one means.

Recipe 3 — Run a parameter sweep

Optimization is a two-step async flow: configure the batch, then run it. You need the strategy’s canonical parameter keys first — those come from list_strategies.
1

Get the parameter keys

list_strategies returns each strategy’s canonicalParameters. Use the key of each parameter you want to sweep.
2

Configure the sweep

setup_optimization with a range (min, max, step) per parameter. It returns an optimization_id. Nothing runs yet.
3

Run it

run_optimization promotes the batch to running — one backtest per combination.
4

Wait for the batch

Poll with task='optimization', passing both the artifact_id and the optimization_id.
{
  "session_id": "<session_id>"
}
A completed batch reports total_combinations, failed_count, and a best_result.
A sweep is the easiest way to fool yourself. The “best” combination is the one that fit the past best — it may not repeat. Treat optimizer output as a starting point, not a promise. Past performance does not guarantee future results. See optimization.

Recipe 4 — Cancel a long-running task

A sweep across many combinations can run for a while. cancel_task requests a stop. It’s idempotent, returns immediately, and behaves differently per task type.
The session’s single running sweep is resolved automatically — it stops between combinations and keeps the partial results.
cancel_task
{
  "session_id": "<session_id>",
  "task": "optimization",
  "artifact_id": "<artifact_id>",
  "optimization_id": "<optimization_id>"
}
cancel_task returns right away — it requests the stop, it doesn’t block until the task winds down. If you were waiting, your wait_for_completion loop will see the task settle on its next poll.

Recipe 5 — Look up contract specs

Before you size stops, targets, or position math, get the tick details right. Discover symbols, then pull the specs for the one you’ll trade.
1

Discover what's tradable

list_symbols returns every CME Group symbol with its ticker, name, and sector.
2

Pull the specs

get_reference_data for a single symbol returns tick size, tick value, margin, and session hours.
{}
list_symbols takes no arguments. Use it to confirm a symbol is in scope (CME, CBOT, NYMEX, COMEX only) before you build a strategy on it, then get_reference_data for the tick math.

Next steps

MCP tools

The full reference for every tool’s inputs and outputs.

Developer concepts

Sessions, operations, status fields, and the async model.

Optimization

What a sweep does — and how not to overfit.

Is the backtest real?

Why the numbers are reproducible and what they do and don’t model.