ELITE FEATURE · MCP
OPEN BETA

AI trading agents for NinjaTrader 8.

Point Claude, ChatGPT, Cursor, or any MCP client at NinjaTrader 8 and let it act as a trading agent. Your agent writes the NinjaScript, compiles it, backtests through NT8's actual Strategy Analyzer engine, sweeps parameters, deploys the winner, and monitors the live state — all in one conversation. No C# experience required.

CrossTrade owns the entire agent loop: inspect → write → compile → backtest → optimize → deploy → verify. Every step is one typed MCP tool call. You set the gates. The agent does the work.

1:1
NT8 SA parity
41
Fitness functions
~400ms
Per backtest iteration
Sweep size

You shouldn't have to learn C# to backtest a hypothesis

NinjaScript is a great execution environment for live trading. It is a terrible place to iterate on ideas by hand. You have to compile, attach to a chart, configure Strategy Analyzer, click around for parameters, wait, read a results panel that's locked inside the desktop app, then translate everything back into a hypothesis you can adjust. An AI trading agent on the MCP Trading API collapses that loop into a chat session.

YOU (in Claude, ChatGPT, or Cursor)

Write a simple ATR-trailing-stop strategy on MES that goes long when the 9-EMA crosses above the 21-EMA. Backtest April 2026, 5-minute bars. Sweep ATR from 1.5 to 3.0 in 0.25 steps. Tell me the best parameters by NetProfit, then run a full backtest with those and show me every trade.

YOUR TRADING AGENT

I'll inspect NT8's actual EMA / ATR signatures first, compile in memory, write the strategy, run the sweep, then drill into the winner.

GetNinjaScriptHelp · LookupNinjaScriptSymbol(EMA) · CompileNinjaScript(in_memory:true) · WriteNinjaScriptFile

RunStrategyBacktest with optimization.parameters_sweep: [{name:"AtrStop", min:1.5, max:3.0, step:0.25}]

→ 7 iterations completed in 2.1s. Best: AtrStop=2.25, NetProfit $1,420, ProfitFactor 1.34, 89 trades.

→ Full single-backtest with AtrStop=2.25, returning every trade.

What your trading agent can do

Every tool here is exposed through the Model Context Protocol. Any MCP-compatible AI client (Claude, ChatGPT, Cursor, Continue, Cline) can call them with the user's permission.

code

Write NinjaScript with AI

Your agent pulls the real signatures from your NT8 install (not stale training data) and writes C# that compiles on the first or second try. Pre-flight syntax checks happen in memory before anything lands on disk.

AGENTIC
science

Backtest 1:1 with NT8

RunStrategyBacktest drives Strategy.RunBacktest() through NT8's actual Strategy Analyzer engine. The trades and metrics are bit-identical to what you'd see in NT8's UI. Verified against SampleMACrossOver on MES: $800 NetProfit, profit factor 1.14, 264 trades.

CORE
tune

AI parameter sweeps

Pass an optimization.parameters_sweep argument and your agent cartesian-enumerates every combination. Results return ranked best-first with the winning parameters in a top-level best callout. 41 NT8 fitness functions resolve by name.

OPTIMIZE
rocket_launch

Deploy + monitor

The same parameters your agent backtested with go straight into DeployStrategy. The MCP deployment registry tracks every strategy your agent has launched, and GetDeployedStrategyState returns the live NT8 state (trading? active orders? bar count?) on demand.

LIFECYCLE
visibility

See your real risk

Account balances, open positions, working orders, executions, daily watermarks, and quote snapshots are all available as MCP tools. Build prompts that refuse to deploy if drawdown is too deep or the position would breach a prop-firm limit.

SAFETY
notifications_active

Alert through your channels

EmitMcpAlert routes agent-generated alerts through your in-app notifications, email, Discord, or Telegram. Build prompts that ping you when a backtest finishes, a sweep identifies a winner, or a deployed strategy reaches a threshold.

CORE

The full idea → live agent loop

Every step is one MCP tool call. The AI sequences them. You approve the gates.

01

Inspect

GetMcpCapabilities, LookupNinjaScriptSymbol, SearchNinjaScriptSymbols, GetNinjaScriptHelp. Your agent reads the actual NinjaTrader surface available in your install.

02

Write

The agent encodes your hypothesis as NinjaScript. Idiomatic C#, sized for the NT8 version it just inspected. No copy-pasted templates from training data.

03

Compile

CompileNinjaScript(in_memory:true) validates syntax against the running NT8 AppDomain. Fully isolated until you approve writing the file.

04

Backtest

RunStrategyBacktest runs the strategy through NT8's Strategy Analyzer engine. Same trades, same metrics, same fills as the desktop UI.

05

Optimize

Pass optimization.parameters_sweep to enumerate every parameter combination. Results sorted best-first by NetProfit with a best callout.

06

Deploy

DeployStrategy launches the compiled strategy headlessly or attaches it to a chart. GetDeployedStrategyState verifies it actually reached active state.

We verified the engine

You shouldn't trust an AI trading agent (or its backtest engine) just because a marketing page says so. Here are the actual numbers — same configuration run through NT8's UI and through MCP — that prove parity.

Metric
NT8 Strategy Analyzer UI
Agent (RunStrategyBacktest)
Net Profit
$800.00
$800.00
Profit Factor
1.14
1.1425
Total Trades
264
264
Sharpe Ratio
0.80
0.80
Long Net Profit
$1,718.10
$1,718.10
Short Net Profit
-$1,366.90
-$1,366.90

Reference run: SampleMACrossOver (ships with NT8) on MES 06-26, 5-minute bars, April 1–30, 2026, Fast=10, Slow=25, Sim101 account, no commission, 0 slippage. Same configuration in both places.

What the wire actually looks like

You probably won't write these by hand. Your trading agent does. But here's what your agent is sending.

MCP tools/call · single backtest
{
  "method": "tools/call",
  "params": {
    "name": "RunStrategyBacktest",
    "arguments": {
      "strategy_class": "MyEma20Reversal",
      "instrument":     "MES 06-26",
      "bars_period":    {"period_type": "Minute", "value": 5},
      "from":           "2026-04-01T00:00:00Z",
      "to":             "2026-04-30T00:00:00Z",
      "parameters":     {"Quantity": 1, "StopAtrMultiplier": 2.25},
      "fill":           {"slippage_ticks": 0}
    }
  }
}
MCP tools/call · parameter sweep
{
  "method": "tools/call",
  "params": {
    "name": "RunStrategyBacktest",
    "arguments": {
      "strategy_class": "MyEma20Reversal",
      "instrument":     "MES 06-26",
      "bars_period":    {"period_type": "Minute", "value": 5},
      "from":           "2026-04-01T00:00:00Z",
      "to":             "2026-04-30T00:00:00Z",
      "optimization": {
        "fitness": "MaxNetProfit",
        "parameters_sweep": [
          {"name": "StopAtrMultiplier", "min": 1.5, "max": 3.0, "step": 0.25},
          {"name": "TargetRatio",       "min": 1.0, "max": 2.0, "step": 0.25}
        ]
      }
    }
  }
}

A real agent prompt

You don't issue tool calls one at a time. You write one prompt and let the agent sequence dozens of calls inside your guardrails. Drop this into Claude Desktop, Claude Code, Cursor, or any MCP client connected to CrossTrade and watch the full loop run.

Idea-to-live agent prompt

I'm in an Apex $50k evaluation on APEX1234 with about $200 of daily loss room left. Defensive ideas only.

1. Inspect the account first. If current risk is already too high, stop.

2. Research a one-contract MES morning scalper. Time filter, no averaging, ATR stop, target ≤ 1.5R, max two trades per session, hard daily lockout.

3. Write the NinjaScript. Compile in memory. Only write the file when compile is green.

4. Backtest 60 days. Gate: PF > 1.25, MaxDD < $350, trades > 40. If any gate fails, stop.

5. Sweep stop multiplier and target ratio. Show top three. Re-run a single full-detail backtest on the winner.

6. Ask me to confirm before DeployStrategy. After deploy, GetDeployedStrategyState. Confirm is_trading.

7. EmitMcpAlert(deployment_started) so I get a notification.

See the full prompt library for account-risk agents, market-research agents, NinjaScript authoring agents, and operational shutdown agents.

Honest limitations

Most "AI for trading" marketing pages would skip this section. We won't. Here are the constraints you'll actually run into building trading agents on CrossTrade MCP.

  • Optimization is cartesian. Pass optimization and the agent enumerates every combination. GeneticOptimizer and StrategyGenerator names are accepted but the iteration loop is exhaustive. You get every point in the grid, ranked by NetProfit. Fitness-specific ranking and genuine genetic search are on the roadmap.
  • Sweep parameter types. Only int / long / double / float / decimal are sweepable. Boolean and enum strategy inputs can still be fixed via the parameters argument.
  • NT8 must be running. The MCP server is hosted, but it talks to your NT8 desktop over the CrossTrade add-on. If NT8 is offline, agent tools return a clear error instead of inventing fake data.
  • Elite + Add-On v1.13.0+. The Elite gate is enforced at token issuance. REST and WebSocket access remain on Pro, but trading agents on MCP need Elite.
  • Async jobs. Backtests and compiles return a job_id and complete asynchronously. Your agent polls GetMcpJob for progress. Jobs auto-expire after 30 minutes.
  • Live trades are real. MCP tools can submit orders and deploy strategies. Use mcp:trade scope only with agents you trust, and always start your prompts with a safety frame that asks the agent to confirm account, instrument, and risk before any write.

Ready to deploy your first trading agent?

MCP Trading is included with the CrossTrade Elite plan. Plug Claude, ChatGPT, Cursor, or any MCP-capable AI client into NinjaTrader 8 and start running real agents against your real install — write, backtest, optimize, deploy, monitor.