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

Strategy / Reference

alerta.strategy.closedtrades.exit_bar

TradingView-compatible spelling: strategy.closedtrades.exit_bar_index, runs without warnings

Alias of exit bar index for closed trades.

alerta.strategy.closedtrades.exit_bar(trade_index) → int

Parameters

NameTypeRequiredDefaultDescription
trade_indexintYes—Closed trade index.

Returns

int

Example

alerta.strategy.closedtrades.exit_bar
strategy("strategy.closedtrades.exit_bar", overlay=false)if bar_index == 3    strategy.entry("Long", strategy.long, comment="Example entry")if bar_index == 8    strategy.close("Long", comment="Example exit")value = strategy.closedtrades > 0 ? strategy.closedtrades.exit_bar(0) : navar result = table.new(position.top_right, 1, 1)if barstate.islast    table.cell(result, 0, 0, str.tostring(value), text_color=chart.fg_color)

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.