Kill switch
Block new exposure and flatten the account.
Get the kill switch
Whether the account's kill switch is engaged.
Path
The account's id, acc_ and 26 characters, as the dashboard shows it.
Response
When it was engaged: seconds since 1970 (UTC). Null when it is not engaged.
The deviation, in points, its closing deals carry. Null when it is not engaged.
Errors
| 401 | invalid_api_key | The key is not a workspace's current key (a rolled key stops working within about a minute). |
| 401 | missing_api_key | No API key: send it as |
| 404 | no_such_account | No such account, or one the key's workspace doesn't have: the two look the same. |
| 503 | engine_busy | The account's engine host has too many calls in flight (256). Nothing was done; try again. |
| 503 | engine_unavailable | The account's engine host is not connected to Pipsocket, or disconnected while the call waited. A trade it already had is still settled: look it up. |
| 504 | engine_timeout | The account's engine did not answer within 30 seconds. |
Engage the kill switch
Blocks new exposure first (new orders and changes to pending orders are refused with 423 until it is lifted; the block survives restarts), then deletes every pending order and closes every position, each as one request sent once. It first waits up to 6 seconds for trades still being sent. Engaging it again retries whatever is left. Closing, close by, cancelling and setting stops still work while it is engaged.
Path
The account's id, acc_ and 26 characters, as the dashboard shows it.
Body
Left out: MT5's empty valuesThe largest difference from the current price the closing deals accept, in points, for instant or request execution. 0 if left out.
Response
No positions or pending orders in a fresh read of the account, and no trade that could add exposure without a known outcome (unknown included).
Each pending order and the removal sent for it (or the one already waiting for its answer).
Fields of cancelled
The pending order's ticket.
A trade request: the request as recorded for the terminal (sent), its state, and MT5's answer.
Fields of request
The request's id (req_...): look it up with GET /requests/{request}.
A trade request's state: pending (sent, no answer yet: never sent again), done (MT5 answered: filled, placed or rejected, as result.retcode says), unknown (no answer within 130 seconds; it becomes done if the terminal reports the answer later) or refused (the terminal did not send it).
MT5's MqlTradeRequest, field for field, exactly as recorded to send to the terminal: the request's state and result say whether it reached MT5. Fields the call does not use carry MT5's empty values (0, "", fok, gtc).
MT5's MqlTradeResult once done; why it was not sent once refused; otherwise null.
What the answer means, in a sentence.
Each position and the close sent for it (or the one already waiting for its answer).
Fields of closed
The position's ticket.
A trade request: the request as recorded for the terminal (sent), its state, and MT5's answer.
Fields of request
The request's id (req_...): look it up with GET /requests/{request}.
A trade request's state: pending (sent, no answer yet: never sent again), done (MT5 answered: filled, placed or rejected, as result.retcode says), unknown (no answer within 130 seconds; it becomes done if the terminal reports the answer later) or refused (the terminal did not send it).
MT5's MqlTradeRequest, field for field, exactly as recorded to send to the terminal: the request's state and result say whether it reached MT5. Fields the call does not use carry MT5's empty values (0, "", fok, gtc).
MT5's MqlTradeResult once done; why it was not sent once refused; otherwise null.
What the answer means, in a sentence.
What a fresh read found afterwards; null if the terminal did not answer it.
Fields of remaining
Ids of requests sent before the switch engaged that could add exposure and have no known outcome. If one fills and the terminal reports it, the switch closes what it opened.
Whether the account's kill switch is engaged.
Fields of kill_switch
When it was engaged: seconds since 1970 (UTC). Null when it is not engaged.
The deviation, in points, its closing deals carry. Null when it is not engaged.
What the outcome means, in a sentence.
Errors
| 401 | invalid_api_key | The key is not a workspace's current key (a rolled key stops working within about a minute). |
| 401 | missing_api_key | No API key: send it as |
| 404 | no_such_account | No such account, or one the key's workspace doesn't have: the two look the same. |
| 422 | invalid_request | A field, query parameter or header is missing, malformed or not allowed, or the body is not JSON. Nothing was sent. |
| 503 | account_not_connected | the switch is engaged (and stays engaged), but the terminal stopped answering: no position was closed, though pending orders may already have been deleted. Engage it again once the terminal is connected; a sweep also runs when it reconnects. |
| 503 | engine_busy | The account's engine host has too many calls in flight (256). Nothing was done; try again. |
| 503 | engine_unavailable | The account's engine host is not connected to Pipsocket, or disconnected while the call waited. A trade it already had is still settled: look it up. |
| 504 | engine_timeout | The account's engine did not answer within 30 seconds. |
Lift the kill switch
Lifts the account's kill switch: new orders and changes to pending orders are accepted again. Lifting a switch that is not engaged changes nothing.
Path
The account's id, acc_ and 26 characters, as the dashboard shows it.
Response
When it was engaged: seconds since 1970 (UTC). Null when it is not engaged.
The deviation, in points, its closing deals carry. Null when it is not engaged.
Errors
| 401 | invalid_api_key | The key is not a workspace's current key (a rolled key stops working within about a minute). |
| 401 | missing_api_key | No API key: send it as |
| 404 | no_such_account | No such account, or one the key's workspace doesn't have: the two look the same. |
| 422 | invalid_request | A field, query parameter or header is missing, malformed or not allowed, or the body is not JSON. Nothing was sent. |
| 503 | engine_busy | The account's engine host has too many calls in flight (256). Nothing was done; try again. |
| 503 | engine_unavailable | The account's engine host is not connected to Pipsocket, or disconnected while the call waited. A trade it already had is still settled: look it up. |
| 504 | engine_timeout | The account's engine did not answer within 30 seconds. |