# ARL rule guide Reference for the Candle Ping ARL text editor. Use live prices, candlesticks or perpetual futures data in alerts and control how often they fire. ## Your first rule At each 5-minute close, alert when the price moves from at or below its 20-bar simple moving average to above it. Allow at least 30 minutes between alerts. ```arl clock bar_close(5m) let average = sma(close, 20) when crosses_above(close, average) trigger cooldown 30m ``` ## How can I get AI to write my rule? Choose an AI from Open. Send the prefilled guide, or paste the guide copied automatically for DeepSeek, Gemini or Microsoft Copilot. Add this request. ```text For BTC, check each 15-minute close. Alert when RSI(14) crosses above 30. Leave at least one hour between alerts. Give me paste-ready ARL. ``` Paste the ARL rule from the AI response into Alerts → New → ARL text in the workspace. Preview historical triggers, verify the timeframe, crossing direction and cooldown, then choose Create alert. ## Rule structure and defaults Each rule defines one alert for one symbol. Write each clause on its own line in the order shown below. Use `#` for a comment to the end of the line. | Clause | Usage | Requirements and defaults | | --- | --- | --- | | `scope` | `scope symbol("binance:BTCUSDT.PERP")` | Optional. Defaults to the chart symbol. An explicit symbol must match the chart. | | `clock` | `clock bar_close(5m)` | Declare explicitly when possible. Defaults to the finest timeframe referenced by `when`. Required if none can be inferred. | | `let` | `let fast = ema(close, 9)` | Optional. Use a unique name for each definition. | | `when` | `when close > fast` | Required. The expression must evaluate to a condition. | | `trigger` | `trigger rising_edge, cooldown 30m` | Optional. Defaults to `level`. Separate options with commas. | | `notify` | `notify app.in_app()` | Optional. Defaults to in-app notification. Select external channels in the workspace. | ## Clocks and timeframes `clock bar_close(5m)` evaluates at bar close. Available timeframes are `1m`, `3m`, `5m`, `15m`, `30m`, `1h`, `2h`, `4h`, `6h`, `12h`, `1d`, `1w`. `clock tick` checks on price updates. `clock interval(7s)` samples every seven seconds and takes a positive integer in seconds. In live rules `close` is the current price. Use `close @ 15m` to read the closing price of the latest completed 15-minute bar. Wrap the entire expression before switching its timeframe. This checks for a 5-minute RSI crossing above 30 while the last closed 15-minute price is above its average. Use the clock timeframe or a coarser one. ```arl clock bar_close(5m) when crosses_above(rsi(close, 14), 30) and (close > sma(close, 10)) @ 15m ``` ## Available market data ### Candlestick fields - Price (`close`) — Live rules use the latest price. Bar-close rules use the closing price of the corresponding bar. - Open (`open`) — Opening price of the bar. - High (`high`) — Highest price in the bar. - Low (`low`) — Lowest price in the bar. - Volume (`volume`) — In base units. Live rules use the current 1-minute bar total. - Turnover (`turnover`) — In quote units. Live rules use the current 1-minute bar total. Volume spike on a higher close: `volume > 2 * sma(volume, 20) and close > open`. ### Perpetual futures fields - Open interest (`data.open_interest`) — Open interest in base units. - Funding rate (`data.funding_rate`) — Latest reported rate. Thresholds can use `0.01%`. Perpetuals only. Samples expire after 3 minutes. Replay uses settled funding and historical open interest. Older Bitget samples are coarser. Hyperliquid and Coinbase have no historical open interest. ## Indicators and conditions Read price with `close`. Use `+ - * /` for arithmetic, `> >= < <= == !=` to compare numbers, and `and`, `or`, `not` for logic. `5%` means `0.05`. Use `sma(src, n)`, `ema(src, n)` and `rsi(src, n)`. Select `.line`, `.signal` or `.hist` from `macd(src, fast, slow, signal)`. Select `.mid`, `.upper` or `.lower` from `bbands(src, n, k)`. Use `crosses_above(a, b)` for an upward crossing and `crosses_below(a, b)` for a downward crossing. Use `close > 100000` to check whether price is above a threshold. ## Custom indicator formulas Formulas use ARL numeric functions and `open`, `high`, `low`, `close` or `volume`. No `clock`, `when`, `@` or custom references. Use `turnover` and perpetual `data.*` fields in alerts, not in formulas. The chart uses its current timeframe and the latest formula. Saved alerts keep their formula version. To update an alert, opt in to the latest library formula when editing it. Example: Volume ratio. The ID is `volume_ratio`. The formula below measures current volume relative to the average volume of the last 20 bars. ```text volume / sma(volume, 20) ``` After saving the indicator, reference it as `custom.volume_ratio`. The rule below checks whether the ratio crosses above 2 at a 5-minute bar close. ```arl clock bar_close(5m) when crosses_above(custom.volume_ratio, 2) ``` ## Frequency and expiry The default `level` fires while true. `rising_edge` fires when the condition becomes true. `once` stops after one alert. `rearm` takes a condition for arming again. Separate trigger options with commas. Use `cooldown 30m` for a minimum gap and `max 3 per 1d` for a rolling limit. `expire` takes `never`, a duration, or a quoted ISO 8601 timestamp with timezone. Durations use `s m h d w` and span one second to one week. For example, alert once when the live price exceeds 100000. ```arl clock tick when close > 100000 trigger once ``` ## Use a rule in the workspace Select your symbol and paste the rule into the ARL text editor when creating an alert. Use Preview to see historical triggers. Indicators need warm-up data. The browser allows up to 10,000 one-minute bars per rule. Live previews use 1-minute candles. `tick` checks at each close. `interval` keeps its UTC grid and uses the latest unused close. Intraminute crossings may be missed. The default `notify app.in_app()` is optional. Choose external channels in the workspace. Generate rules using the syntax and data supported in this guide. Cross-symbol scans are unavailable.