Strategy / Reference
alerta.strategy.close_all
TradingView-compatible spelling: strategy.close_all, runs without warnings
Closes all open positions at market. `immediately=true` fills at the signal bar's close instead of the next bar's open.
alerta.strategy.close_all(comment, alert_message, immediately, disable_alert) → voidParameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
comment | string | Not specified | — | Optional close reason shown on the trade. |
alert_message | string | Not specified | — | Text for the {{strategy.order.alert_message}} placeholder. |
immediately | bool | Not specified | false | true = fill at this bar's close instead of the next bar's open. |
disable_alert | bool | Not specified | false | true = this order's fills send no order-fill alert (e.g. one strategy copy that alerts buys only). |
Returns
voidExample
alerta.strategy.close_all
strategy("Close All Example", overlay=true)if bar_index == 1 strategy.entry("L1", "long")if bar_index == 2 strategy.close_all()Names and aliases
Guides and navigation are localized. Built-in reference descriptions and code examples are maintained in English.