Kumo Charts

@kumo-charts/core/alerts

The API reference is generated from the source comments.

import { … } from '@kumo-charts/core/alerts';

Functions

alertsfunctionSource

function alerts(): AlertsModule

The alerts module: chart.alerts, alerts on the price, on series, and on indicators and drawings when the chart has their modules.

Interfaces

AlertinterfaceSource

interface Alert
readonly id: string
readonly source: ValueSource
readonly trigger: AlertTrigger
readonly value: number | ValueSource | ChannelBounds
readonly frequency: AlertFrequency
readonly enabled: boolean
readonly label: string | null
readonly color: string | null
readonly lineStyle: LineStyle
readonly draggable: boolean
readonly visible: boolean
readonly buttons: readonly PriceLineButton[]
readonly status: AlertStatus
readonly triggeredAt: number | null

Time of the bar on which the alert last fired.

AlertDragEventinterfaceSource

interface AlertDragEvent extends PriceDragEvent

The user drags the line of an alert: its level, or a bound of its channel that is a number.

readonly bound: number | null

The index in the alert's value of the channel bound dragged; null for one level.

AlertInputinterfaceSource

interface AlertInput
id?: string

The chart numbers one, alert-1 on, when it is left out.

source?: ValueSource

Watched value; defaults to the main close.

trigger: AlertTrigger
value: number | ValueSource | ChannelBounds

A fixed level (drawn as a draggable line) or another value to compare with; for the channel triggers, the channel's two bounds, such as two lines of a drawing.

frequency?: AlertFrequency
enabled?: boolean
label?: string

Text of the line label.

color?: string

Defaults to the theme's alert color.

lineStyle?: LineStyle
draggable?: boolean

Lets the user drag a fixed level. Default true.

visible?: boolean

Shows the line of a fixed level. Default true.

buttons?: PriceLineButton[]

AlertsApiinterfaceSource

interface AlertsApi extends CollectionApi<AlertInput, Alert>

Alerts evaluated on every data update; fixed levels are drawn as draggable lines.

rearm(id: string): void

Arms an alert that fired with frequency once again.

AlertsEventMapinterfaceSource

interface AlertsEventMap
alertDrag: AlertDragEvent

The user drags an alert's level, or a bound of its channel; the alert follows immediately and keeps the final value.

alertTrigger: AlertTriggerEvent

AlertTriggerEventinterfaceSource

interface AlertTriggerEvent
readonly id: string
readonly time: number

Time of the bar that met the condition.

readonly value: number
readonly threshold: number

The threshold at that bar; for the channel triggers, the bound the value went through to enter or exit, or the bound nearest to it inside or outside.

readonly trigger: AlertTrigger
readonly replay: boolean

The alert fired while the chart replays history.

Types

AlertFrequencytypeSource

type AlertFrequency = 'once' | 'once-per-bar' | 'once-per-bar-close' | 'every-time'
  • once: fires one time, then the alert's status becomes triggered until rearm().
  • once-per-bar: at most once per bar, on the tick that meets the condition.
  • once-per-bar-close: evaluates closed bars only, when the next bar starts.
  • every-time: whenever an evaluation meets the condition.

AlertsModuletypeSource

type AlertsModule = ChartModule<{
  readonly api: { readonly alerts: AlertsApi };
  readonly events: AlertsEventMap;
}>

AlertStatustypeSource

type AlertStatus = 'active' | 'triggered' | 'disabled'

AlertTriggertypeSource

type AlertTrigger =
  | 'cross'
  | 'cross-up'
  | 'cross-down'
  | 'above'
  | 'below'
  | 'enter-channel'
  | 'exit-channel'
  | 'inside-channel'
  | 'outside-channel'
  • cross-up / cross-down / cross: the source moves through the threshold between two evaluations (ticks or bars).
  • above / below: the source is beyond the threshold.
  • enter-channel / exit-channel: the source moves into, or out of, the channel between two evaluations: inside after being outside or on a bound to enter, outside after being inside or on a bound to exit. Leaping over the whole channel, from below it to above it, does neither.
  • inside-channel / outside-channel: the source is between the bounds, or beyond one.

ChannelBoundstypeSource

type ChannelBounds = readonly [number | ValueSource, number | ValueSource]

The two bounds of a channel, in either order: at each bar the channel lies between them, e.g. the top and the bottom of a rectangle.

↑↓ to select · Enter to open · Esc to close