OpenScriptv0.5.0Documentation
GitHub

Alerts in /trading

Create price, study and drawing alerts on the /trading chart, alert on a condition your OpenScript study computes, see what a script's own alert() does there, and read the Alerts and Log tabs of the Alerts panel.

On this page
  1. Four kinds of alert
  2. A price alert in one click
  3. The Create alert dialog
  4. Study alerts, including on your own scripts
  5. Drawing alerts
  6. Alerts from a script
  7. Alerts on a script condition
  8. The Alerts panel
  9. How a firing reaches you
  10. Managing alerts

This page is about alerts as you meet them on the /trading page of OpenAlgo: setting a price alert with one right-click, putting an alert on a study's line (including a study you wrote in OpenScript), what an alert() in your script does on the chart in this release, how each firing reaches you, and how to read and manage everything in the Alerts panel on the right-hand toolbar. For writing alert() calls in a script, see Alerts from scripts.

Four kinds of alert

KindWhat it watchesHow you create itListed in the Alerts tab
Price alertThe instrument's price against a level or a channelRight-click the price pane, or the Alerts button on the chart toolbarYes
Study alertOne plot of a study on the chart, built-in or your own script, against a valueRight-click the study's line, or the Alerts buttonYes
Drawing alertA level of a drawing, such as a trend lineRight-click the drawing, or the Alerts buttonYes
Script alertAn alert() call in an OpenScript study on the chartNothing to create: it is watched once the study is on the chartNo. Any firing appears in the Log tab

The first three are alerts you set on the chart, and each has a row in the Alerts tab with its own settings. The fourth is written into the script itself: its condition and message come from the code. In this release a script alert rarely fires on the chart (see Alerts from a script), so to be told about a condition your script computes, use a study alert on a plot of it, as Alerts on a script condition shows.

A price alert in one click

  1. Right-click the price pane at the level you want to watch.
  2. Choose Create price alert at followed by the price, for example Create price alert at 812.45.

The alert is made there and then, with no form in between. A toast confirms it, such as Alert set: SBIN crossing 812.45, and a line appears across the chart at the level. The price is rounded to the instrument's tick size, so a point picked between two ticks becomes a price the instrument can actually trade at.

A right-click alert takes these settings, and every one can be changed afterwards with Edit on its row:

SettingValue
ConditionCrossing
EvaluateIntrabar touch
RepeatOnly once
ExpirationTwo months from now
When it firesSound and Desktop notification
Alert nameWritten from the alert, such as SBIN crossing 812.45
A price alert drawn as a labelled line on an NSE chart beside the Alerts panel
An alert is drawn on the chart it watches, and listed in the Alerts panel with its status.

To move a price alert, drag its line. The new price is rounded to the tick, and a name the page wrote for you follows the new price; a name you typed yourself is left alone.

The Create alert dialog

Click Alerts on the chart toolbar, beside Indicators, to open Create alert for the chart in that pane. The line under the title names the instrument, such as SBIN on this chart. The same dialog opens as Edit alert from the Edit action on a row of the Alerts panel, with Save in place of Create.

The dialog reads top to bottom as a sentence: what to watch, when to fire, when to stop, what to call it and how to tell you.

Condition

What to watch picks the source:

What to watchThen chooseValue
PriceNothing moreA price, seeded with the latest close
Study plotStudy (numbered as in the chart legend, such as 1: RSI) and PlotA value in the plot's own units, seeded with the plot's latest value
Drawing levelDrawing (each drawing by its tool and a number) and LevelNone: the drawing supplies its own level on every bar

The list also offers Candle condition, but the dialog has no control yet for picking which candle pattern to watch, so saving one stops at "Choose a candle condition."

Condition then decides what counts as a hit:

ConditionFires when the watched value
CrossingMoves from one side of the level to the other, in either direction
Crossing upMoves from at or below the level to above it
Crossing downMoves from at or above the level to below it
Greater thanIs above the level
Less thanIs below the level
Entering channelMoves from outside the band between Lower and Upper to inside it
Leaving channelMoves from inside that band to outside it

The two channel conditions replace the single value box with Lower and Upper. Greater than and Less than test a state rather than a crossing: with Repeat set to Every time they fire again on every bar the value stays beyond the level, so pair them with Only once unless you want to hear about it again.

Trigger

ControlChoices
RepeatOnly once: fire the first time, then show as Fired. Every time: keep watching after each firing, firing at most once per bar
EvaluateOn bar close or Intrabar touch

The hint under Evaluate says what each one costs. On bar close: "Fires on a confirmed bar. A wick that is later revised will not fire it." Intrabar touch: "Fires the moment price touches, including on a wick that final history may not keep." On bar close is the same rule an OpenScript alert() follows by default. Intrabar touch is quicker and noisier, and it is what every new alert starts with.

Expiration

Tick Expires and pick a date and time, or leave it unticked for an alert that watches until you remove it ("Open-ended: this alert keeps watching until you remove it."). A new alert starts ticked, two months ahead. The time is on the chart's own clock, and the hint underneath names the time zone, the same one as the chart's time axis.

Alert name

The first box is the name. Leave it empty and the name is written for you from the alert, such as RSI crossing up 30; the box shows that name as its placeholder. The second box is an optional Message.

A message can carry values filled in at the moment the alert fires. Type a placeholder in double braces. The first five in the table are also shown as buttons under the box, and clicking one adds it to the end of the message.

PlaceholderFills in
{{ticker}}The instrument, as the chart names it. {{symbol}} works too
{{exchange}}The exchange it trades on
{{interval}}The chart's timeframe. {{timeframe}} works too
{{price}}The value that met the condition
{{close}}The fired bar's close
{{open}}The fired bar's open
{{high}}The fired bar's high
{{low}}The fired bar's low
{{volume}}The fired bar's volume, as a whole number
{{time}}The time of the bar the alert fired on
{{timenow}}The moment it was delivered

For example, {{ticker}} crossed {{price}}, close {{close}} on {{interval}} arrives as a sentence you can act on from a notification. Prices are written with the instrument's own decimals. The two times are written like 2026-09-23 10:35, on your computer's clock rather than the chart's. A placeholder spelled wrong is left exactly as you typed it, and so is one the chart has no value for: a bar that carries no volume keeps {{volume}} rather than claiming zero.

Below the message, Active as soon as it is saved is ticked by default. Untick it to save the alert in the Stopped state.

When it fires

Four boxes choose how you are told, per alert:

BoxTicked for a new alertWhat it needs
SoundYesNothing
Desktop notificationYesYour browser's permission, which the page asks for when you create or save an alert
TelegramNo"Needs the bot running and your account linked"
WhatsAppNo"Needs a paired device"

Sound and the desktop notification never leave your machine. Telegram and WhatsApp send the message out, and each must be set up on its own page in OpenAlgo first. See How a firing reaches you.

Saving

Click Create (or Save). If something is missing, the dialog says what in red and does not close:

MessageWhat to do
Enter a price to watch.Type a price in the value box
Enter a value to watch.Type a value for the study plot
A channel needs both of its bounds.Fill in Lower and Upper
A channel needs two different bounds.Make Lower and Upper differ
Choose a study. This chart has none, or the one chosen has been removed.Add a study to the chart, or pick another
Choose a plot from that study.Pick a plot (see Study alerts for which entries are plots)
Drawings are still loading. Try again in a moment.Wait a moment and click again
Draw something on the chart first, then alert on its level.Draw first, then open the dialog
Choose which level of that drawing to watch.Pick a level
Enter an expiry date and time, or switch the expiry off.Complete the date and time, or untick Expires

Study alerts, including on your own scripts

A study alert watches one plotted line against a value. It works the same on a built-in study and on a study you wrote in OpenScript, because a saved script sits on the chart like any other study.

The quickest way is to right-click the study's line and choose Create study alert. The alert is made at once, with the condition Crossing and the value the line had at the bar under the pointer, and otherwise the same settings as a right-click price alert. Open Edit on its row to change the condition or the value.

From the dialog, set What to watch to Study plot, then pick the Study and the Plot. For a study written in OpenScript the Plot list shows the keys the chart gives each plot(): p0 for the first plot() in the file, p1 for the second, and so on. The list also shows other columns the script produces, such as openscript:alert:0 for its first alert(). Those are not plots, and picking one stops at "Choose a plot from that study." Right-clicking the line is the surest way to get the plot you mean. The value is in the plot's own units: an RSI threshold of 70 is 70, and it is not rounded to the instrument's tick.

The Create alert dialog set to watch a plot of an OpenScript study
Create alert: watch a price, a study plot, a drawing level or a candle condition, and choose how it fires.

A study alert set to Intrabar touch reads the plot as it moves during the bar; set On bar close to judge only the value the bar closed with.

An alert on a study you later remove from the chart can no longer be checked. Its row says why, and it is dropped the next time the chart restores its alerts.

Drawing alerts

Right-click a drawing and choose Create drawing alert. When a drawing cannot carry an alert the entry is greyed out, and hovering it tells you why. From the dialog, choose Drawing level, then the Drawing and which Level of it to watch. There is no value to type: a trend line is at a price on every bar, and that price is the level.

Alerts from a script

A study that calls alert() needs no setup to be watched. Save it in the Scripts panel and put it on the chart with Apply to chart there, or from the Indicators dialog. Each alert() in it becomes a condition the chart checks as new bars arrive, starting from the next new bar.

When a script alert does fire on the chart:

  • a toast shows the script's message, or its title when the message is absent on that bar;
  • the alert sound plays, and a desktop notification appears if the /trading tab is hidden and the browser allows notifications;
  • a row is added to the Log tab, with the title, the message and the symbol.

A few things set script alerts apart from the alerts you create on the chart:

  • They are not in the Alerts tab, so they have no Stop, Edit or Delete. To silence them, remove the study from the chart, or take the alert() out of the script and save it.
  • Delivery is fixed at Sound and Desktop notification. There is no box to tick for Telegram or WhatsApp.
  • Nothing fires for history. Adding the study, or changing its settings, recalculates the past without sending anything. Only bars that arrive afterwards are checked.
  • At most once per bar. The chart checks each alert() once for each new bar, so the frequency values "once" and "everyUpdate" behave as "oncePerBar" here. See frequency.
  • The id names the alert. A repeat of the same id replaces its previous desktop notification rather than stacking another beside it. Give every alert a fixed id and a title, as The id is a promise explains.

A strategy deployed from the Strategies panel runs on the OpenAlgo server rather than on the chart, so the limit above does not apply to it. It sends nothing while it replays history at the start; after that, each alert it raises is written as a line in that run's log, and it is not sent to this panel, the sound or any channel.

Alerts on a script condition

The dependable way to be told about something your script computes is to plot the condition as 1 or 0 and put a study alert on that plot. Set to On bar close, the study alert is judged on the closed bar, the same rule a script's alert() follows. It also has everything the dialog offers (a name, message placeholders, an expiry, repeat) and can go to Telegram or WhatsApp as well as the sound and the desktop notification.

version 1

study("Breakout flag", precision = 0, range = [0, 1])

upper = highest(high, 20)[1]
broke = crossUp(close, upper)

// 1 on the bar the close breaks the twenty bar high, 0 on every other bar.
plot(broke ? 1 : 0, "Breakout", aqua, style = "step")
  1. Save the study and add it to the chart.
  2. Click Alerts on the chart toolbar to open Create alert.
  3. Set What to watch to Study plot, pick this study, and pick plot p0.
  4. Set Condition to Crossing up and type 0.5 as the value, so the alert fires on the bar the flag steps from 0 to 1.
  5. Set Evaluate to On bar close and Repeat to Every time.
  6. Tick the channels you want under When it fires, and click Create.

During warmup broke is absent, and an absent condition takes the second branch of ? :, so the plot reads 0 there rather than leaving a gap. To watch several conditions, give each its own plot() (they become p0, p1 and so on) and set one study alert per plot.

The Alerts panel

Click Alerts on the right-hand toolbar, between Objects and Scripts. The panel opens beside the chart, so you can keep it open while you watch the prices it is waiting for.

The Alerts panel with Alerts and Log tabs, a search box, a status filter and one active alert
The Alerts panel: every alert with its instrument, interval and status, and a Log of every trigger.
  • The header reads Alerts, with the pane it describes underneath, such as Pane 1 · NSE:SBIN. With several panes on screen it describes the pane you are working in.
  • The menu at the right of the header holds Start all, Stop all and Remove all alerts.
  • Two tabs, Alerts and Log, each with a count.
  • A search box under the tabs (Search alerts, or Search log) that matches the name, the message and the symbol.
  • On the Alerts tab, a sort by Status, Name or Recently fired. On the Log tab, a Clear button in its place.

There is no New button. You create an alert where the price is, from the chart, and the panel shows what is already watching.

The Alerts tab

One row per alert on this pane. Each row shows:

  • the alert's name, and the time it last fired (only the time when that was today, the date and time otherwise);
  • its message, or when it has none, what it is waiting for, such as Crossing up 812.45;
  • the symbol and timeframe it was made on, such as SBIN · 5m;
  • its state.
StateMeans
ActiveWatching
FiredA Repeat Only once alert that has fired. It stays in the list, and its line is removed from the chart
StoppedPaused by you, or saved with Active as soon as it is saved unticked
ExpiredIts expiry time has passed. It stays in the list, and its line is removed from the chart

Sorting by Status puts Active first, then Fired, Stopped and Expired.

A row can read Active and still not be checked at this moment. It then carries one more line saying why. The common ones:

LineWhyWhat to do
Switch to 5m to evaluate this alertAn alert is checked only on the timeframe it was made on. A price alert's line still shows on other timeframesSwitch the pane back to that timeframe
Instrument context differsThe pane now shows another symbolSwitch back to the symbol the alert was made on
Alerts are pausedThe chart is in bar replay, a workspace is still loading, or the chart has no dataLeave replay or wait; alerts resume on their own

Hover a row for its three actions: Stop (or Start on a stopped alert), Edit, which opens the Edit alert dialog, and Delete.

The Log tab

One row per firing, newest first, from every pane and every chart. Each row shows:

  • the alert's name and a time: for a row added while the page is open, the time of the bar it fired on; for a row read back from the server, when it was recorded;
  • the message, with its placeholders filled in;
  • the symbol, and the price at which it fired when the firing carried one;
  • on rows read back from the server, the channels that accepted the message: sound, notification, telegram, whatsapp.

Rows added while the page is open show no channels. After a reload, a row with no channels listed is an alert that fired and reached nobody, which is a different thing from an alert that never fired.

The log is kept on the OpenAlgo server for 90 days, so firings survive a closed tab. When /trading opens, the page reads back the latest 200, and it holds up to 200 firings while it stays open, dropping the oldest first. Clear empties the log on the server as well; if the server does not agree, a toast says "The log could not be cleared. It will be back on the next reload."

How a firing reaches you

Every firing shows a toast on the page with the alert's message (or its name, when there is no message) and is written to the Log. The alert's When it fires boxes then decide the rest:

ChannelWhat you get
SoundTwo short rising tones from the /trading tab
Desktop notificationYour operating system's notification, titled with the symbol and the alert's name, with the message as its text. Shown only while the /trading tab is hidden, because a visible page already has the toast. Clicking it brings the chart forward
TelegramThe symbol, the name and the message, sent through OpenAlgo's Telegram bot to your linked account
WhatsAppThe same text, sent to your paired device

The outward channels are tried together, and each is tried once. When one refuses, a toast says so in the server's own words, for example "The alert fired, but Telegram did not take it." followed by the reason, and it is not retried. The alert has already fired by then, and the Log row records which channels accepted it.

Managing alerts

ToDo this
Change an alertEdit on its row, then Save
Move a price alertDrag its line on the chart
Pause and resume oneStop and Start on its row
Pause or resume allStop all or Start all in the panel menu
Delete oneDelete on its row, or hover its line on the chart and press Delete or Backspace
Delete all on the paneRemove all alerts in the panel menu
Silence a script's alertsRemove the study from the chart
Clear the historyClear on the Log tab

Pressing Delete over the chart removes a drawing first when one is selected or under the pointer, and an alert's line only when nothing else claims the key.

Alerts belong to the chart pane they were made on and are saved with that chart in your browser, so they come back when you reopen /trading. A Repeat Only once alert that has fired comes back as Fired, not armed again, so it does not fire twice for the same price.

Related. Alerts from scripts, Realtime and confirmation, The editor, Plots, Sandbox and live, Troubleshooting