DeployStrategy
Deploys a compiled NinjaScript strategy. The deployment registry tracks every MCP-originated deployment so the agent can stop or inspect later.
Write Action
Deployment puts a strategy into live trading. The agent must restate parameters, account, instrument, and quantity, and wait for explicit confirmation before this call.
| Property | Value |
|---|---|
| Required scope | mcp:trade |
| Risk | High. Lives orders may be placed by the strategy. |
| Side effects | A live strategy starts running on NT8. |
When an agent should use it
- After a green compile, a passing backtest (single or sweep winner), and a quantitative gate.
- After an explicit user confirmation.
When an agent should not use it
- On a funded account without confirming firm rules permit automation.
- As a follow-up to a "looks good" backtest with too few trades or a wide sweep.
- During chart-mode workflows where direct chart-strategy attach is required. See the addon-side notes about NT8 chart-strategy enable.
Parameters
{
"strategy": "MyEmaCross",
"account": "Sim101",
"instrument": "MES 06-26",
"parameters": { "FastPeriod": 9, "SlowPeriod": 21, "AtrStop": 2.25 },
"quantity": 1
}
Response shape
{
"deployment_id": "d-7001",
"strategy": "MyEmaCross",
"account": "Sim101",
"is_trading": true,
"started_at": "2026-05-15T14:30:00Z"
}
Example user prompt
On Sim101, deploy MyEmaCross with FastPeriod=9, SlowPeriod=21, AtrStop=2.25,
quantity 1, MES 06-26. Restate everything before deploying and wait for me to
confirm. After deploy, call GetDeployedStrategyState and confirm is_trading.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
compile_required | Strategy is not compiled. | Compile first. |
account_disconnected | Cannot deploy without a live connection. | Reconnect. |
instrument_mismatch | The instrument is not subscribed or expired. | Verify with MarketInfo. |
is_trading: false after deploy | Strategy started but failed to enter the trading state. | Inspect GetDeployedStrategyState for errors. |
Safe workflow placement
CompileNinjaScript → WriteNinjaScriptFile → RunStrategyBacktest → user confirms
→ DeployStrategy → GetDeployedStrategyState → EmitMcpAlert
After deployment, GetDeployedStrategyState must show is_trading: true. If not, do not claim success.
Use in AI-generated NinjaScript workflows
- When the agent should call it: only after a green compile, a passing backtest with realistic commission and slippage, an optional sweep winner re-validated, and an explicit user confirmation. Default to Sim101 first.
- Required scope:
mcp:trade. - Confirmation required: yes. Always. Even on Sim101.
- What the agent should summarize: account, instrument, quantity, parameters, the backtest gates that passed, and the expected behavior the user should watch for in the first session.
- Failure mode it helps catch: vibe deploying. The agent should refuse to deploy a strategy that compiled but never backtested, or that backtested without realistic costs, or that did not pass the user's gates.
For the broader vibe coding workflow, see NinjaScript AI Workflow.