tv_close_position
Closes an open TradingView paper trading position by symbol or position ID and returns both the closed position and remaining open positions.
Instructions
MUTATES the connected TradingView broker: close an open position by symbol or position id (market close via the broker adapter). PAPER ONLY. Returns the position that was closed and the remaining open positions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| layout | No | chart layout id or index; default active | |
| symbol | No | symbol of the position to close, e.g. BYBIT:ETHUSDT.P | |
| position_id | No | position id from tv_trading_status (wins over symbol) | |
| expect_layout | No | layout id the tab is expected to show right now; the call refuses if it differs (a tab keeps its target id when the user opens another layout in it) |