Reference

Formula Reference

Variables and functions available in VYX custom signals and alerts.

Order-Book Variables

  • imb / absImb: selected-depth imbalance, signed and absolute.
  • deltaImb / absDelta / prevImb: candle-to-candle change and the previous value.
  • l1..l10 and c1..c10: per-level and cumulative imbalance from level 1 to 10.
  • bidNotional / askNotional / cumBookNotional: raw bucket and cumulative book notional.
  • bidWall / askWall: the biggest resting wall on each side of the book, in dollars. bidWallPx / askWallPx: the price it rests at; bidWallBps / askWallBps: how far that is from the mid; bidWallShare / askWallShare: its share of that side’s book.
  • sameSide: whether pressure stayed on the same side as the previous candle.

Spread & Price Variables

  • spreadAvg / spreadRange / spreadMin / spreadMax: spread aggregates in basis points.
  • mid / bestBid / bestAsk: top-of-book prices and midpoint.
  • open / high / low / close / quoteVolume / notionalM: kline fields and quote volume.
  • priceRangeBps / bodyBps / closeLocation: candle range, body, and where the close landed.
  • On a bar where nothing traded (common on thin markets off-hours), open/high/low/close carry the venue’s still-published quote (mark price, else the bid/ask mid) instead of reading zero — so moving averages and other lookbacks stay honest across quiet stretches.

Trade-Flow Variables

  • takerBuyRatio / takerSellRatio / avgTradeNotional: aggression and average trade size. A candle with no trades has no buy or sell share — it reads n/a, and an average or high/low over a window skips it.
  • cvdHigh / cvdLow / cvdRange: intracandle cumulative volume delta.
  • buyRun / sellRun: largest same-side taker run (sweeps).
  • tradeMaxBuy / tradeMaxSell: largest single taker print (whale orders).
  • sweep: the bar’s dominant taker event in quote notional — the larger of the biggest single print and the longest same-side run, on whichever side is bigger. This is the exact quantity the built-in "Sweep (chart parity)" signal ranks.
  • sweepBuy / sweepSell: that same magnitude for each side on its own. sweepSide: +1 when the buy side dominated, -1 the sell side, 0 on a quiet bar.
  • cvdClose: session-anchored running CVD at bar close — compare with change(cvdClose, n), not as a raw level across long spans. A change that reaches across a data-feed restart reads n/a rather than a false burst of buying or selling, and a bar with no trades holds the level, so on a quiet market the next bar reads only its own trades.
  • tradeBuyCount / tradeSellCount: aggressor print counts per side — many small prints read differently than a few blocks.
  • cascadeScore: same-side burst intensity versus this market’s own norm — the forced-flow proxy on Hyperliquid. Scored on every timeframe; it needs ten prior traded bars of that timeframe, so a freshly listed market’s first bars carry none.

Derivatives & Microstructure Variables

  • funding / fundingBps: perp funding rate; positive means longs pay shorts.
  • basisBps / markPremiumBps: mark versus last trade and index.
  • oi / oiDelta / oiDeltaPct: open interest and its change.
  • liqBuy / liqSell / liqNotional / liqDelta: liquidation notional by side, total, and net — not populated on Hyperliquid (no public market-wide liquidation feed).
  • ofi, microprice / micropriceBps: order-flow imbalance and size-weighted fair value lean versus mid.
  • premiumBps: venue basis at bar close (mark vs oracle, bps) — positive means the perp is trading rich.
  • impactBidPx / impactAskPx / impactSpreadBps: the venue’s own impact prices and their spread versus mid — a ready-made slippage read.
  • oiHigh / oiLow: intracandle open-interest extremes — churn the close-to-close delta smooths away.
  • bidOrdersL1 / askOrdersL1: resting order counts at the touch — big size in one or two orders is the classic fake-depth tell.

Statistics & Universe

  • p / z: percentile and z-score of pressure versus recent history.
  • rank: trailing-volume rank across the Hyperliquid market universe.
  • age: seconds since the candle, for freshness filters.
  • btcRet / betaBtc / residBps: BTC’s bar return (bps), the market’s rolling 60-bar beta to BTC, and the residual — this bar’s return minus its beta-implied BTC component. residBps isolates a market moving on its own rather than with BTC.
  • normVolume / normFlow / normRange / normSpread / normDepth / normOiMove: normal for the hour — what this market’s typical 1-hour bar looks like at the UTC hour the bar opened, from its last 90 days, weekdays and weekends apart. Each is in the unit of the number it sits beside (quoteVolume, net taker flow, priceRangeBps, spreadAvg, resting book notional, oiDeltaPct as a size), so dividing reads “times normal”: quoteVolume / normVolume > 3 is volume three times what this hour usually trades. They describe a whole hour — on 15-minute bars compare sum(quoteVolume, 4). Markets without 90 days of liquid trading read n/a.

Functions

  • Math: abs, max, min, avg, clamp, round, floor, ceil, sqrt, ln (natural log; non-positive inputs yield no value rather than firing), exp and tanh. barIndex() is the bar's position in the loaded history — only its differences mean anything, so it serves weighted sums and regressions, never dates.
  • Lookback (window 1-200 candles): prior(x, n), change(x, n), highest(x, n), lowest(x, n), sma(x, n), sum(x, n), stdev(x, n). Example: imb >= highest(imb, 50) — or a self-relative z-score of any expression: (imb - sma(imb, 50)) / stdev(imb, 50) >= 2.
  • median(x, n): the middle value over the last n candles. The robust baseline — a single outsized bar drags an average but not a median, so prefer it for notional metrics like sweeps and liquidations.
  • pctRank(x, n): where this candle’s x sits within its own last n candles, from 0 to 1 (1 = the highest of the window). This is how you say “big for THIS market” without picking a dollar threshold that fits BTC and misses everything else. Example: pctRank(sweep, 120) >= 0.94 fires on the top 6% of sweeps for whatever market it is scoring.
  • Indicators (period 2-200, on any series): rsi(x, n), ema(x, n), macd(x), atr(n). Example: rsi(imb, 14) <= 25 finds order-book "oversold".
  • Trailing stops: supertrend(n, factor) is the Supertrend stop price — an n-candle ATR × factor band that trails under price in an uptrend and over it in a downtrend — and sar(start, step, max) the Parabolic SAR, classically sar(0.02, 0.02, 0.2). Example: close > supertrend(10, 3) is "in a Supertrend uptrend"; crossUp(close, sar(0.02, 0.02, 0.2)) is "the SAR just flipped up".
  • Volume profile: poc(n), vaHigh(n) and vaLow(n) read the volume profile of the last n candles (2-200), with each candle's volume spread evenly over its high-low range. poc(n) is the point of control — the price that traded the most — and vaHigh(n) / vaLow(n) are the top and bottom of the value area, the band around it where 70% of the volume traded. Examples: close > vaHigh(24) is trading above value; (close - poc(24)) / poc(24) * 10000 is the distance from the POC in bps; poc(24) > prior(poc(24), 24) is value migrating up; close < prior(vaHigh(24), 24) && close > prior(vaLow(24), 24) is back inside the previous window's value area. For a 24-hour profile on any board, use tf(poc(24), 60). Built from candles rather than trades at each price, so read each level as a zone about a fiftieth of the window's range wide.
  • VWAP has no function of its own — write it from sums: sum((high + low + close) / 3 * baseVolume, n) / sum(baseVolume, n) is the volume-weighted average price of the last n candles, the same line the chart's VWAP study draws. Price against the 24-hour VWAP in bps on a 15-minute board is vw = sum((high + low + close) / 3 * baseVolume, 96) / sum(baseVolume, 96); (close - vw) / vw * 10000. Past 200 candles, read it from hourly candles: vw = tf(sum((high + low + close) / 3 * baseVolume, 24) / sum(baseVolume, 24), 60) is the last 24 closed hours on any board. The POC is the single most-traded price, not an average, so it is not a VWAP.
  • count(condition, n): how many of the last n candles met a condition. Example: count(oiDelta > 0, 5) >= 5.
  • Any expression can be the series a function reads: lowest(rsi(close, 14), 20), sma(close - open, 10), prior(rsi(close, 14), 5), count(rsi(close, 14) < 30, 5). Nested warm-ups add up, so lowest(rsi(close, 14), 20) needs 34 candles; keep a chain within 120 candles and alerts score it too.
  • Named parts: r = rsi(close, 14); r < 30 && r > prior(r, 1). Each name = …; part is substituted into what follows; the last part is the result. A name cannot be a variable or function the language already has (p, z, close, sma…) — the error names the word and offers a free one — and names live inside one formula: an indicator cannot read a part named in another, so each condition spells out what it needs.
  • Events: barsSince(condition) — candles since it last held. valueWhen(condition, x, k) — x at the k-th most recent candle where the condition held (0 = latest). pivotLow(x, left, right) / pivotHigh(x, left, right) — marks the candle that confirms a swing low / high; the swing itself is right candles back, read with prior(x, right). crossUp(a, b) / crossDown(a, b) — the candle a crosses b. onset(condition) — the first candle the condition holds (true now, not on the candle before): the transition edge as one word, so a handoff between two states fires once instead of staying lit for the whole state.
  • One thing after another is barsSince. "B, and A fired within the last N candles" is b && barsSince(a) <= N. "A still live — fired within N candles and B has not fired since" is barsSince(a) <= N && barsSince(b) > barsSince(a). Each stage is a condition; recency is the memory.
  • Read a saved screen by name: signal("Emerging") is 1 on the candles every condition of that screen holds (a signal combined All, or a single condition), so stages can be separate saved screens that read the one before them — developing && barsSince(signal("Emerging")) <= 20. It reads on the board's own timeframe (wrap it in tf() for another), its warm-up follows the chain, and editing the screen updates every formula reading it. A scored signal — consensus, linear or strict with several items — fires by vote, so it cannot be read this way: save its conditions as a screen. A screen cannot read itself, directly or through another, so a save that would close that loop is refused. When two signals share a name — a built-in beside a desk’s copy of it — they read as one if their conditions match; if they differ, the message names each one’s id to read instead, as signal("its-id").
  • A line built on itself: self(n) is the formula's own value n candles back, self(n, seed) with a starting value — how cumulative lines like the Positive Volume Index are written: self(1, 1000) * (1 + (quoteVolume > prior(quoteVolume, 1)) * change(close, 1) / prior(close, 1)). self() cannot sit inside ema(), sma() or prior(), but the line's distance from its own n-candle EMA is itself one such line: (1 - 2 / (n + 1)) * (self(1) + x), with x the line's change on each candle. PVI against its 50-candle EMA, in percent: (1 - 2 / 51) * (self(1) + (quoteVolume > prior(quoteVolume, 1)) * ln(1 + change(close, 1) / prior(close, 1)) * 100) — 0 on its signal line, negative below it.
  • tf(expression, minutes): the expression on another timeframe for the same market — minutes 1, 5, 15, 60, 240 or 1440. It reads the last of those candles that had closed by each candle on your board, so a value never changes after the fact. Example: tf(rsi(close, 14), 240) < 30 && crossUp(close, ema(close, 20)) — 4-hour RSI oversold while the 15-minute chart turns up. Every window inside tf() counts that timeframe's candles: tf(poc(24), 60) is the last day's point of control on any board, while tf(poc(24), 1440) would be the last 24 days'. Inside tf(), close is that timeframe's last closed candle, so to compare the price now keep close outside: close > tf(vaHigh(24), 60). Proof, the robustness sweep, your saved patterns and a signal read your AI files on the Workbench read it the same way, from closed candles only.
  • The clock: every candle knows when it opened, in UTC. utcHour() is 0-23, utcMinute() 0-59, dayOfWeek() 0-6 (0 = Sunday), newDay() is 1 on the first candle of each UTC day, and session("asia"), session("london"), session("ny") or session("overnight") is 1 on candles that open in that session — the same four sessions as the market read, daylight-saving safe on weekdays: Asia from UTC midnight to the London open, London to the New York cash open, New York for the US cash session (9:30-16:00 New York time), overnight to UTC midnight. onset(session("ny")) is the session's first candle. A candle belongs to the session it opened in, so on an hourly board the 13:00 candle is London's even when New York opens at 13:30.
  • Since an event: highestSince(condition, x), lowestSince(condition, x) and sumSince(condition, x) run from the latest candle the condition held (that candle included) to this one, and read n/a until it has held once. prevDay(x) is x on the last candle of the previous UTC day. The day's high so far is highestSince(newDay(), high); above yesterday's high is close > prevDay(highestSince(newDay(), high)); the move since the day opened, in %, is (close / valueWhen(newDay(), open, 0) - 1) * 100; taker flow since the New York open is sumSince(onset(session("ny")), takerBuyQuote - takerSellQuote).
  • An opening-range break on a 15m board: a = onset(session("ny")); orHigh = valueWhen(barsSince(a) == 3, highestSince(a, high), 0); session("ny") && barsSince(a) > 3 && close > orHigh — the high of New York's first four candles, broken later in the session. Yesterday's value-area high on a 15m board (96 candles a day) is prevDay(vaHigh(96)). An anchor reads n/a until the candles on screen reach back to it — yesterday's levels need more than a day of candles — so on 5m and faster boards read them from hourly candles: tf(prevDay(highestSince(newDay(), high)), 60). On weekends the sessions keep their summer UTC times (London from 07:00, New York 13:30-20:00).
  • Looking ahead, for a Proof target only: fwd(x, n) is x n candles later — fwd(highest(high, 8), 8) / close - 1 > 0.05 is “5% higher within the next 8 candles”. It belongs in a target’s confirm, the check that an event really happened, when you grade a signal against your own event (see States, Transitions And Events). A signal, screen, regime, column or desk refuses it, because a live read can never see what comes next; past the last stored candle it reads n/a.
  • Putting it together — a bullish RSI divergence: pl = pivotLow(low, 3, 2); lo = prior(low, 2); r = prior(rsi(close, 14), 2); valueWhen(pl, lo, 0) < valueWhen(pl, lo, 1) && valueWhen(pl, r, 0) > valueWhen(pl, r, 1) && barsSince(pl) <= 5. Swap rsi(close, 14) for cvdClose to read a flow divergence instead.
  • Cross-sectional (this symbol vs the whole scanned universe, at the same bar): xsRank(x) percentile 0-100 vs the field, xsZ(x) z-score vs the field, xsMedian(x) the field’s median. Example: xsRank(ofi) >= 95 fires only when a market’s order-flow imbalance is in the top 5% of every market scanned right now. A window can wrap a field read, so a screen can read the whole market over time: sum(xsMedian(bodyBps), 16) < -100 holds while the typical market’s candles add up to more than a 1% fall over the last 16, and xsMedian(priceRangeBps) < sma(xsMedian(priceRangeBps), 96) while the field is quieter than its own usual. The field read itself takes one variable — xsMedian(change(close, 16)) is refused; sum the field’s candles instead.
  • deseason(x, n): hour-of-day deseasonalized z-score — how unusual x is right now versus its own history at the SAME time of day, over the last n candles. Stops a market that always moves at the US open from looking “unusual” just because it’s the open. Needs several days of same-hour history, so it’s most useful on 1h and higher intervals; on short intervals it abstains rather than guess. Example: deseason(imb, 200) >= 2.

Formula Habits

Write formulas that you can explain after a volatile candle. If a formula is impossible to reason about during live review, simplify it before trusting the output. The in-app reference (the docs button on the desk) lists every variable with its exact definition.

More docs

Try it on the live map

Open the desk and put this to work across 300+ Hyperliquid markets — free, no install, no password.

Open VYX