tv_set_alert_condition
Merge new conditions, message, webhook, or name into a live TradingView alert and re-arm it. Returns previous state so you can revert the change.
Instructions
MUTATES a live alert: shallow-merge patch (camelCase model fields: conditions, message, webhook, name, resolution, ...) into the alert through the same modifyRestartAlert call path the TradingView UI uses - the ONLY path the server accepts (raw snake_case payload round-trips are rejected with invalid_request and were removed). Returns { id, patched_keys, sent, previous, current, was_active, paused_restored, current_raw } so the change is reversible - feed previous back as the next patch to undo it. Refuses an empty patch, identity fields (id/alert_id) and unknown field names. ARMED WINDOW: modify_restart always re-arms the alert; if it was paused before the call it is stopped again right after (~1s later, paused_restored: true) - a fire inside that window would deliver the alert's real message/webhook. Clone -> modify -> stop path verified live 2026-09-05 on defanged throwaway clones. Alerts on this account fire real webhooks that place live orders.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | numeric alert id, as returned by tv_list_alerts | |
| patch | Yes | camelCase model fields to shallow-merge into the alert: conditions, message, webhook, name, resolution, ... | |
| layout | No | chart layout id, target id, or 0-based index; default = the chart tab that is actually painting | |
| 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) |