Trading commands and outcomes
A trading command asks a connected account to perform an action. Commands can come from a direct request, a trade copier, or an equity monitor.
What you can ask an account to do
Open a position or place an order
Use open to request a buy or sell at market, or to place a pending order. For example, a buy-limit order asks to buy at the specified limit price or lower. Once the platform accepts the order, it can remain pending until its conditions are met. The trade record and its events show whether the order has filled. Available order types depend on the connected platform. See Create open command.
Change an existing position or order
- Use
modify_stop_lossto change the stop-loss level. For example, you might move the stop on an open position after the market price has changed. - Use
modify_take_profitto change the price target at which you want the position to close for a profit. - Use
modify_pending_priceto change the requested entry price of an order that is still pending. For example, you might lower the entry price of an unfilled buy-limit order.
Check the account's trade report for the updated level. See Create modify command.
Close all or part of a position
Use close_full to request a close of the entire remaining position. Use close_partial to request a reduction by a percentage, such as closing half while keeping the rest open. Check the account's reported remaining volume after a partial close. The broker's minimum volume can affect whether it can execute the request. See Create close command.
Direct requests
Direct trading commands require a Full account. The connection's trading permissions, the platform's supported operations, and the broker's execution conditions still apply. A successful API response when you create a command confirms that Tradesync queued the request. Use the returned command ID to follow its progress.
Status, results, and events
A command starts as working. Its status tells you where the request stands, and its result can explain what happened during execution. For example, working with no_connection means the request is still working and the latest result reports a connection problem. A command can finish as complete or abandoned. If the result includes an error code, interpret it for the connected platform.
Command events show reported execution outcomes over time, such as a connection problem followed by success. Use the current command status and result alongside those events. If you request cancellation, Tradesync requests removal from the execution queue. The broker may already have executed the action by then, so check the account's trade reports for the actual change.
Following a close request
- Find the position and keep its Tradesync trade ID. Submit a full close request using the position's platform ticket and save the command ID from the response.
- Look up the command and filter command events by command ID. If the command is still
working, use the result to see whether a problem has been reported. Acompletestatus with asuccessresult records successful execution of the command. - Use the Tradesync trade ID to look up the position and filter its trade events. The closed record and close event show what the account reported. See Positions, orders and trade history for how to follow the record and its changes.
Use the Commands API to submit or cancel a command and check its current state. Use the Command Events API to look up its reported execution outcomes.