Skip to content
AlertaChartAlertaScript / docs
AlertaScript / alerta.strategy.close_all
On this pageSignatureParametersReturnsExample

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) → void

Parameters

NameTypeRequiredDefaultDescription
commentstringNot specified—Optional close reason shown on the trade.
alert_messagestringNot specified—Text for the {{strategy.order.alert_message}} placeholder.
immediatelyboolNot specifiedfalsetrue = fill at this bar's close instead of the next bar's open.
disable_alertboolNot specifiedfalsetrue = this order's fills send no order-fill alert (e.g. one strategy copy that alerts buys only).

Returns

void

Example

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.

AlertaScript

No results found.

Search by name, alias, or keyword.