Skip to content
AlertaChartAlertaScript / docs
AlertaScript / var
On this pageSignatureReturnsExample

Utilities / Reference

var

TradingView-compatible spelling: var, runs without warnings

Initializes a variable once and retains its value between bars. Use := to assign a new value to the existing variable.

var float previous = na → language construct

Returns

language construct

Example

//@version=6indicator("Persistent variable")var float previous = naprevious := closeplot(previous)

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.