INNER CODE UNIT · Python

close_position

codedpro/mt5-trade-split-manager · mcp_server.py:182

    def close_position(ticket: int):
        """Close an open MT5 position by its ticket number (one leg of a split
        order). Get ticket numbers from list_positions. This closes at market;
        it is immediate and cannot be undone.
        """
        return _request("DELETE", f"/position/{ticket}")

    @mcp.tool()
    def cancel_order(ticket: int):
        """Cancel a pending (not-yet-filled) MT5 order by its ticket number. Get
        ticket numbers from list_pending_orders. This only removes an unfilled
        order; it does not touch already-open positions.
        """
        return _request("DELETE", f"/order/{ticket}")

    @mcp.tool()
    def safe_shutdown():
        """Consolidate the remaining take-profit legs before the bridge/EA goes

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…