AlertsConditions and script alerts

Conditions and script alerts

Combine an alert with RSI, funding, open interest, RVOL, liquidations or CVD, or have it wait for a signal from your own script.

A simple alert checks one condition. On the Conditions tab you attach more, and with a script alert the alert waits for a signal you wrote yourself in CoinScript. Both are included from the Plus plan up.

Further conditions

In the alert dialog, open the Conditions tab. You can also go there directly through the super search (CtrlK) with “Alert with conditions…”.

  1. At the top, choose when the alert should trigger: all match (AND) or any matches (OR).
  2. Row 1 is the Main condition from the Settings tab.
  3. Click + Add condition. A new row starts with “RSI (14) greater than 70”.
  4. Choose a source and operator, enter the value and, for “Rises by” or “Falls by”, the time window.
  5. × removes a row again.

Up to five further conditions are possible. Each row shows its current value on the right, such as “Current 64.2”, and “· met” as soon as it applies. At the bottom, the Preview sums everything up in one sentence, for example: “Triggers when price crosses 85,000.00 AND RSI (14) greater than 70.”

Sources

SourceMeaningUnit
PriceLast price$
RSI (14)RSI over 14 candles in the alert's timeframe, the current candle with the live price–
Funding rateCurrent funding rate% / 8 h
Open interestOpen positions$M
Volume (RVOL)Volume of the current candle relative to the average of the 20 candles before it× avg
LiquidationsLong and short liquidations of the current candle in the alert's timeframe$M
CVDBuy minus sell volume of the last 24 hours$M

As with the main condition: open interest and funding rate are only available for crypto perpetuals, liquidations and CVD only for crypto. If a source is missing for the symbol, its chip is grayed out.

Operators

OperatorApplies when…
Greater thanthe value is above the threshold
Less thanthe value is below the threshold
Crosses upthe value has risen above the threshold since the last check
Crosses downthe value has fallen below the threshold since the last check
Rises bythe value has risen by at least that percentage in the chosen window
Falls bythe value has fallen by at least that percentage in the chosen window

For “Rises by” and “Falls by”, choose a window: 5 min, 1 h, 4 h or 24 h. The value is then a change in percent, such as “Open interest rises by 5% in 4 h”.

Note. For price, RSI (14), open interest and CVD, the windows work right away. For funding rate, volume (RVOL) and liquidations, the window only fills while the alert is being checked: a 4-hour window therefore first needs 4 hours of readings.

Combining conditions sensibly

  • With AND, all rows must apply in the same check. A crossing is a moment, so combine it with states such as “Greater than” or “Rises by”, not with a second crossing.
  • With OR, one row is enough, even a further condition on its own.
  • With the “On candle close” trigger, the terminal checks the main condition on the closed candle and the further conditions with their values at that moment.

An example of a breakout with confirmation: price Crosses up 85,000, AND Volume (RVOL) greater than 2, AND Open interest Rises by 2% in 1 h.

Script alerts

With a script alert, the alert waits for an event from your own CoinScript: a signal() or an alertcondition(). Alternatively, it compares the script's first plot() with a value, as with a price alert. How to write such scripts is explained under Language and Examples.

Create a script alert

  1. Save your script with Add to chart. It then appears under Code → My scripts.
  2. There, click the Bell (“Alert on this script”) in the script's row. The dialog opens with the source Script · {name} and the script's first event.
  3. Under Condition, choose the event the alert should wait for.
  4. Choose the trigger, expiration and notifications and click Create.

In the dialog, Source also offers all your scripts as “Script · {name}” chips.

Condition of a script alert

Condition first lists the titles of your script's signal() and alertcondition() calls, then the usual comparisons Crosses, Greater than and so on. An event needs no value. A comparison refers to the script's first plot() and needs a value in the Value field.

Below the condition you see “Current” with the value of the first plot and “· met” when the chosen event applies on the candle the alert reads.

How a script alert calculates

  • The script runs over the last 300 candles of the symbol and timeframe you created the alert on. All data series, feed() and symbol() deliver the same values as with Run in the editor, as long as the terminal is open.
  • If you're signed in, mantacharts also checks script alerts without an open terminal. The script then has the candles (open, high, low, close, volume) and the order flow available: delta, cvd, buyVol, sellVol, liqLong, liqShort, trades, buyTrades and sellTrades, calculated across all exchanges combined. That's why these values can differ slightly from those in the editor.
  • If a script reads more, such as oi, funding, company figures such as revenue, feed() or symbol(), mantacharts only checks the alert while the terminal is open. The alert dialog says so under Source.
  • It calculates with the default values of its input() calls. What you change in the indicator's settings on the chart doesn't apply to the alert.
  • A signal can be detected up to a minute later than on the chart.
  • With “Once”, “Once per candle” or “Every time”, the current candle counts. With “On candle close”, the last closed candle counts.
  • The alert always uses the most recently saved version of the script.
Tip. A signal in the current candle can disappear again if the price keeps moving until the candle closes. If you only want confirmed signals, use the “On candle close” trigger.
Warning. The alert finds the event by its title. If you rename signal(…, { title: 'Long' }) in the script, the alert can no longer find it. Choose the condition again in that case. If you delete the script, the alert can no longer trigger. A script that throws an error or exceeds the time limit doesn't trigger anything either.