Skip to main content

How to Use Cursor with NinjaTrader 8 and CrossTrade MCP

Cursor is a popular AI-coding IDE that supports MCP. With CrossTrade MCP registered, Cursor can draft NinjaScript that compiles against your real NT8 install, run Strategy Analyzer backtests, and keep a strategy in Sim101 until you decide otherwise.

Why Cursor plus CrossTrade MCP is useful for vibe coding NinjaScript

Cursor's strength is editor context: it sees your project files and can refactor across them. CrossTrade MCP adds the part Cursor cannot do on its own: it lets the agent look at your actual NT8 install, compile NinjaScript against it, and drive Strategy Analyzer. The pair turns vibe coding into a verified compile-backtest loop.

Prerequisites

RequirementDetail
CrossTrade subscriptionElite
CrossTrade Add-Onv1.13.0 or higher
NinjaTrader 8Running, broker connected
CursorLatest version with MCP support, paid plan if required
Scopemcp:trade for compile/write/backtest
AccountSim101
Start in Sim101

Use Sim101 for the first compile and backtest cycle. Do not run deployment on a funded account while you are validating the workflow.

Step 1: Add the MCP server in Cursor

  1. Open Cursor.
  2. Settings → Features → MCP (or the current equivalent label).
  3. Add MCP Server.
  4. Paste:
{
"crosstrade": {
"url": "https://app.crosstrade.io/v1/api/mcp"
}
}
  1. Reload the MCP servers list.
  2. On the next tool call, Cursor opens a browser tab for OAuth consent. Approve mcp:trade.

Step 2: Confirm tools are available

Open a new chat or composer pane and ask:

List the CrossTrade MCP tools you can call. Then GetMcpCapabilities and
McpSelfTest. Report the add-on version, NT8 version, and feature flags.

If the tools do not appear, see the troubleshooting table.

Step 3: Create a workspace for strategy drafts

Make a clean directory for the experiment:

mkdir -p ~/crosstrade-strategies/SampleEmaCross
cd ~/crosstrade-strategies/SampleEmaCross

Open the folder in Cursor. The advantage of using Cursor over a chat-only setup is that drafts and notes live alongside the code.

Step 4: Ask Cursor to inspect NinjaScript symbols before writing code

Before generating anything, ground the agent in your install:

For an MES 5-minute EMA crossover strategy with an ATR-based trailing stop,
call GetNinjaScriptHelp on EMA, ATR, CrossAbove, and SetTrailStop. Restate the
chosen overloads. Do not draft yet.

Read the result. Push back if anything looks wrong.

Step 5: Generate a strategy

Draft SampleEmaCross.cs into this workspace. Long when 9-EMA crosses above
21-EMA. ATR-based trailing stop, multiplier 2.0. One contract. Max two trades
per session. Time filter 09:30 to 11:00 ET. Account Sim101. Do not compile yet.

Cursor writes the file. Read it.

Step 6: Compile through CrossTrade MCP

CompileNinjaScript(in_memory: true) using the source in SampleEmaCross.cs.
If compile fails, for each error LookupNinjaScriptSymbol on the unresolved
identifier and rewrite the offending line. Recompile until green. Do not call
WriteNinjaScriptFile yet; we will do that explicitly.

After a green in-memory compile, write the source to your NT8 user directory only after explicit confirmation.

Step 7: Backtest and iterate

WriteNinjaScriptFile to Strategies/SampleEmaCross.cs. Then RunStrategyBacktest
on Sim101, last 30 trading days, 5-minute bars, commission $1.27 per round-trip,
slippage 1 tick. Show the metrics block.

Apply your gates: minimum profit factor, max drawdown cap, minimum trade count. If the gates fail, iterate the prompt, not just the parameters.

Step 8: Export final notes and risks

In the workspace, ask Cursor to write a short NOTES.md summarizing:

  • What the strategy does in plain English
  • Backtest gates that passed or failed
  • Five reasons not to deploy live
  • What you would change next

Cursor is good at this; the notes file makes the next session faster.

Troubleshooting

SymptomLikely causeFix
Tools list emptyOAuth consent not completed, or MCP server cached old stateRemove and re-add the server, redo consent
401 unauthorizedToken expired or revokedReauthorize from the CrossTrade AI Clients page
403 insufficient_scopeToken is mcp:readReauthorize at mcp:trade
408 timeoutNT8 closed or add-on disconnectedOpen NT8, check the add-on
Compile keeps failing the same wayAgent not calling LookupNinjaScriptSymbolForce a fresh lookup before each retry

FAQ

Is Cursor required?

No. Claude Desktop, Claude Code, or any MCP client works. Cursor is well-suited to multi-file workspaces.

Does this need mcp:trade?

Yes. Compile, write, and backtest are write-capable tools that require mcp:trade.

What about funded accounts?

Default to Sim101. Verify the firm's automation policy before any deployment thinking.