POST Disable Strategy
- NT8
- Tradovate
Disable a running strategy without closing positions NT8
Disables a NinjaScript strategy without automatically flattening its position. For a chart-attached strategy, this is a true in-place pause: NT8 stops routing OnBarUpdate calls and the strategy remains attached to its chart. For an account-hosted strategy, disable terminates the strategy, moves it to Finalized, and removes it from the account. In either mode, an open position remains in place, while pending orders may be cancelled by NT8's lifecycle rules.
Use this when you want the strategy to stop generating new entries while leaving its existing position open. A chart-attached strategy can later resume in place with EnableStrategy; an account-hosted strategy must be recreated from its saved deployment. To also flatten the position, use CloseStrategy instead.
Endpoint
POST /v1/api/accounts/{account}/strategies/{strategyId}/disable
Headers
| Name | Value |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer <token> |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account | string | Required | Name of the NT8 account that owns the strategy. |
strategyId | string | Required | ID of the strategy as returned by ListStrategies or ListAllStrategies. |
Code examples
- Python
- JavaScript
- cURL
import requests
token = 'my-secret-token'
url = "https://dev.crosstrade.io/v1/api/accounts/Sim101/strategies/370780512/disable"
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
try:
response = requests.post(url, headers=headers, json={})
print(f"Response Code: {response.status_code}, Response Text: {response.text}")
except Exception as e:
print(f"An error occurred: {e}")
const token = 'my-secret-token';
const url = "https://dev.crosstrade.io/v1/api/accounts/Sim101/strategies/370780512/disable";
fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json"
},
body: JSON.stringify({})
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));
TOKEN="my-secret-token"
curl -X POST "https://dev.crosstrade.io/v1/api/accounts/Sim101/strategies/370780512/disable" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
Response
- 200
- 400
{
"strategyId": "370780512",
"account": "Sim101",
"hostMode": "account",
"wasEnabled": true,
"isEnabled": false,
"state": "Finalized",
"engine": "StrategiesGrid.StrategyDisable",
"verified": true,
"terminated": true,
"resumable_in_place": false,
"success": true
}
{
"success": false,
"error": "strategy_not_found",
"detail": "No strategy with id '370780512' on account 'Sim101'. Use ListStrategies or ListAllStrategies to discover valid ids."
}
Platform nuances
Available in CrossTrade Add-On v1.13.0+.
As of add-on v1.13.6, Control Panel (account-hosted) strategies are disabled through NT8's own Strategies grid pipeline, and success: true is returned only after NT8 confirms the change (verified: true); if NT8 does not confirm it, the call returns success: false with error: "disable_unconfirmed" (re-check with GetStrategyState). Note that NT8 does not pause a headless strategy: disabling it terminates the strategy (its state goes to Finalized) and removes it from the account, so the response includes terminated: true and resumable_in_place: false. Any open position it held remains on the account. To run it again, use EnableStrategy (which recreates it from the saved deployment) or StartStrategy. Chart-attached strategies, by contrast, are a true in-place pause via the strategy's enable flag and report verified: false.
WebSocket API
This request can also be made over the WebSocket API. The account and strategyId path parameters are passed inside args.
{
"action": "rpc",
"id": "my-request-id",
"api": "DisableStrategy",
"args": {
"account": "Sim101",
"strategyId": "370780512"
}
}
Tradovate
NinjaScript strategies are a NinjaTrader desktop concept, so there is no /v1/api/tv equivalent for disabling a strategy. See the Tradovate API overview for what the Tradovate surface covers.
For direct Tradovate account control, inspect positions and orders, then use the documented position or order actions as needed.