tv_set_position_brackets
Move the stop loss and/or take profit on an open TradingView paper position, leaving unspecified levels unchanged and validating against position side and price.
Instructions
MUTATES the connected TradingView broker: move the stop loss and/or take profit of an OPEN position via the broker adapter (editPositionBrackets). PAPER ONLY - refuses unless the broker is TradingView Paper Trading on a demo account. Give symbol or position_id and at least one of stop_loss / take_profit; the value you leave out keeps its current level (both are always sent). Sanity gate against the position side and price: long needs stop_loss < price < take_profit, short the reverse - no override. Returns previous and applied levels plus the position before/after, read back until the broker shows the new values. dry_run=true returns the plan and sends nothing; use it first. Verified live against a paper position: stop moved and restored, ~450 ms each.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| layout | No | chart layout id or index; default active | |
| symbol | No | symbol of the open position, e.g. BYBIT:ETHUSDT.P (bare ETHUSDT is expanded) | |
| dry_run | No | true = validate against the live position and return the plan without sending | |
| stop_loss | No | new stop-loss price | |
| position_id | No | position id from tv_trading_status (wins over symbol; on Paper it equals the symbol) | |
| take_profit | No | new take-profit price | |
| 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) |