mmScript · Reference
mmScript reference + templates
mmScript is mmflow's screening DSL — a safe expression language for defining cross-coin screens as code. Compiles in-browser to a (coin → boolean) predicate evaluated against the live HL universe + cross-venue archives. No eval, no Function() — a hand-rolled lexer + parser + interpreter so we control safety.
Operators
evaluator returns a number; nonzero finite = true
| Operator | Meaning | Example |
|---|---|---|
| AND | Boolean conjunction | rsi > 70 AND funding > 0.0001 |
| OR | Boolean disjunction | vol_24h_usd > 1e7 OR oi_usd > 5e6 |
| NOT | Boolean negation | NOT (oi_z > 2) |
| > >= < <= | Numeric comparison | change_24h > 0.05 |
| = != | Equality | rsi != 0 |
| + - * / | Arithmetic | (funding['hl'] - funding['bin']) * 1e4 |
| ( ) | Grouping | (rsi > 70 OR rsi < 30) AND vol_24h_usd > 1e7 |
| [ ] | Indexed access (venue/asset) | funding['hl'] |
Scalar variables
current value for the row's coin
| Name | Type | Description |
|---|---|---|
| funding | number | Funding rate per period (HL = 1h). Decimal, e.g. 0.0001 = 1bp. |
| funding_z | number | Z-score of current funding vs trailing 30d distribution (from /api/funding-rank). |
| funding_max | number | 30d max funding rate seen for this coin (HL). |
| funding_min | number | 30d min funding rate seen for this coin (HL). |
| oi | number | Open interest in contract units (HL). |
| oi_usd | number | Open interest in USD (HL · oi × markPrice). |
| oi_z | number | Z-score of current OI vs 30d distribution. |
| oi_24h_change | number | OI change over 24h, decimal (0.10 = +10%). |
| vol_24h | number | 24h volume in coin units (HL). |
| vol_24h_usd | number | 24h volume in USD (HL). |
| premium | number | Spot vs perp basis (HL, decimal). |
| premium_z | number | Z-score of basis vs 30d distribution. |
| price | number | Mark price (HL). |
| change_24h | number | 24h price change, decimal. |
| rsi | number | 14-period RSI on 1h candles, 0–100. |
| macd | number | MACD line (1h candles). |
| iv_atm | number | ATM implied vol for the nearest weekly expiry (Deribit). Percent. |
| iv_skew | number | 25Δ put − 25Δ call IV, percent (sign = bias). |
| gex_total | number | Total dealer gamma exposure for the coin (USD per 1% spot move). |
| gex_wall_dist | number | Distance from spot to nearest gamma wall, fractional. |
| whale_notional_24h | number | Sum of HL whale-tape notional ($ ≥ 50k prints) over last 24h. |
| liq_notional_24h | number | Total liquidations on the coin over last 24h, USD (OKX archive). |
| leverage_avg | number | Average leverage of HL traders on this coin. |
| crowdedness | number | Composite crowdedness score (oi_z + funding_z + premium_z). |
Indexed variables
key is a string literal in brackets
| Form | Valid keys | Description |
|---|---|---|
| funding[venue] | hl, bin, byb, okx, lighter, aster | Funding rate per period at the named venue. |
| oi[venue] | hl, bin, byb, okx | Open interest in USD at the named venue. |
| vol[venue] | hl, bin, byb, okx | 24h volume in USD at the named venue. |
| iv_atm[asset] | btc, eth, sol, xrp | ATM IV for the given Deribit underlying (per asset, not per coin). |
| premium[venue] | hl, bin, byb, okx | Spot vs perp basis at the named venue, decimal. |
Template gallery
click → load into editor
Extreme funding (any venue)
Funding above 10bp/8h on any venue (long-squeeze candidate)
funding['hl'] > 0.0001 OR funding['bin'] > 0.0001 OR funding['byb'] > 0.0001 OR funding['okx'] > 0.0001
Negative funding (squeeze candidates)
Funding below -10bp/8h on HL (short-squeeze candidate)
funding['hl'] < -0.0001
Squeeze setup
Negative funding + OI expanding + volume confirming
funding['hl'] < -0.00005 AND oi_24h_change > 0.10 AND vol_24h_usd > 5e6
Crowded long detector
Funding rich + premium positive + OI bursting
funding['hl'] > 0.0001 AND premium['hl'] > 0.001 AND oi_z > 2
Crowded short detector
Funding flipped negative + premium discount + OI rising
funding['hl'] < -0.00005 AND premium['hl'] < -0.001 AND oi_z > 1
Funding-OI divergence
Funding extreme but OI not following — possible exhaustion
(funding['hl'] > 0.0002 OR funding['hl'] < -0.0002) AND oi_24h_change < 0.05
Cross-venue funding arb
Funding spread > 5bp between HL and Binance
funding['hl'] - funding['bin'] > 0.00005 OR funding['bin'] - funding['hl'] > 0.00005
RSI overbought + crowded long
RSI > 70 + extreme funding (reversal candidate)
rsi > 70 AND funding['hl'] > 0.0001
Whale-driven move
Whale notional > $10M + 24h change > 5%
whale_notional_24h > 1e7 AND change_24h > 0.05
Safety model
- No
eval,new Function, orsetTimeout. Hand-rolled lexer/parser/interpreter only. - Identifiers resolved against a fixed allow-list; unknown names return
NaNrather than throwing — script always compiles. - No loops, recursion, or function definitions — every script terminates in linear time per coin.
- Sandboxed: no access to
globalThis, DOM, or browser APIs.