Anthropic · MCP · NinjaTrader 8

Connect Claude Code to NinjaTrader 8

Claude Code (CLI) is the best harness for NinjaScript work. Edits local files and calls CrossTrade MCP tools in the same conversation.

See it in action
~/strategies · claude code · sample-ema-cross

Claude Code calling CrossTrade MCP tools against a live NinjaTrader 8 account. Run this yourself in 5 minutes →

Why Claude Code

Why pair Claude Code with CrossTrade MCP

Claude Code can read and write local files, run shell commands, and call MCP tools in one session. That combination turns the NinjaScript compile loop into a tight feedback cycle: draft, compile in memory against your real NT8 install, repair on error, write the file once green, and run Strategy Analyzer.

Transport OAuth via `claude mcp add --transport http` (Streamable HTTP)
Highlights

What this combination unlocks

Real compile loop

CompileNinjaScript runs against your actual NT8 install, not a sandbox.

File edits + tool calls

Edit SampleEmaCross.cs and call RunStrategyBacktest in the same prompt.

Git-aware

Commit each working iteration as you go.

How it works

The connection chain

Claude Code
   │  OAuth-authorized tool call
   ▼
CrossTrade hosted MCP server   (https://app.crosstrade.io/v1/api/mcp)
   │
   ▼
CrossTrade Add-On running inside NT8 on your PC
   │
   ▼
NinjaTrader 8

One URL, one consent screen, one read-only first prompt. The MCP server is hosted by CrossTrade; you don't run anything beyond NT8 + the CrossTrade Add-On.

Ready to set up Claude Code?

The full step-by-step setup lives on a dedicated page. Verified against Anthropic's current docs.

Open setup instructions →
Example prompts

Copy-paste prompts that work today

Compile loop GetNinjaScriptHelp on EMA and ATR. Draft SampleEmaCross.cs. CompileNinjaScript(in_memory: true). Repair until green. Do not WriteNinjaScriptFile yet.
FAQ

Common questions

Is Claude Code a good fit for NinjaScript development?

Yes, it's the best Claude surface for NinjaScript work. Claude Code edits local files and calls MCP tools in the same session, so the compile loop (draft → CompileNinjaScript → repair → write file → backtest) becomes one tight feedback cycle. Claude Desktop and Claude.ai web can't edit local files, which is why the Code variant exists.

Do I need Claude Code, or will Claude Desktop suffice?

Desktop for interactive trading sessions, journal review, conversational debugging. Code for NinjaScript authoring, repository-style sessions, compile/backtest loops where you also want to edit local files. Most traders end up using both: Desktop for chat, Code for code.

Does Claude Code work with the free Claude plan?

Claude Code requires Pro, Max, Team, Enterprise, or a Console subscription. You can also authenticate via Amazon Bedrock, Google Vertex AI, or Microsoft Foundry with their credentials instead of Anthropic auth.

Mac, Windows, and Linux?

All three. macOS 13.0+, Windows 10 1809+ or Server 2019+, Ubuntu 20.04+, Debian 10+, Alpine 3.19+. The native installer (curl -fsSL https://claude.ai/install.sh | bash) handles all platforms.

Claude Code vs Cursor for NinjaScript?

Cursor is a full IDE with project navigation, multi-file refactoring, and a chat panel. Claude Code is a terminal agent that edits files via shell commands. Both run the same compile-loop pattern against CrossTrade MCP. Pick Cursor for IDE ergonomics; pick Claude Code if you live in the terminal.

How do I switch between mcp:read and mcp:trade safely?

Run /mcp inside Claude Code to see registered servers. Select CrossTrade → "Clear authentication" → re-run a tool call to trigger re-auth at the new scope. Default to mcp:read for inspection; only escalate when a specific workflow needs writes.

Can Claude Code commit my NinjaScript changes to git?

Yes. Claude Code runs shell commands, including git. The typical workflow is: draft strategy → compile → repair → write file → git add and commit. You get a per-iteration audit trail of every successful change.

What if a compile fails repeatedly on the same identifier?

Force the agent to call LookupNinjaScriptSymbol or SearchNinjaScriptSymbols on a synonym. Sometimes models get stuck guessing the wrong overload; the lookup grounds them in your actual NT8 install's symbol table. CrossTrade's tools are the floor of truth, not the model's training data.

Connect Claude Code to NinjaTrader 8 in 5 minutes

Free Sim101 walkthrough. Read-only first. Upgrade scope only when a real workflow needs it.