FlowscopeDocs

alert reference

Declared alerts and their triggers.

Declare an alert at top level with alert name = alert(title: ...) and fire it from a handler with name.trigger(). Alerts fire on live data only.

Functions

alert

Flowscope Script
alert(title: string, description: string = "", onClose: bool = false, payload: Type = null) -> Alert

Declares an alert that the script can trigger.

Use this directly in an alert declaration. Keep the declaration’s name stable; it identifies the alert.

  • title is the required display name. description adds optional help text. Both must be string literals.
  • onClose defaults to false, allowing the alert to fire on the first trigger during a bar. Set it to true to fire only when a bar is confirmed.
  • payload optionally names a declared record type. Its fields can be string, int, float, bool, or nullable versions of those types. Omit it or use null for an alert with no payload.

Alerts fire only on live data, at most once per bar for each declaration.

ParameterType
titlestring
descriptionstring
onClosebool
payloadAlertPayload?

Returns Alert

Available in Setup only: declarations, setup and state initialisers.

Methods

alert.trigger

Flowscope Script
alert.trigger(payload: P = null) -> void

Triggers an alert on live data.

Call this on an alert you declared, or an alias of that alert, from a handler or a function called by a handler.

For an alert with a payload, pass one record of its declared type. For an alert without a payload, pass no argument. The call returns no value.

Each alert can fire at most once per bar. Historical replay evaluates the arguments but does not send an alert. With onClose: true, triggers during a forming bar do not send an alert either.

ParameterType
payloadAlertPayload?

Available in Handlers and functions called from handlers.