Skip to main content
Residual momentum on a BTC chart

BTC on 1-day bars in the 0xArchive Terminal, 2026-10-28.

Open on a chart

Load it on BTC 1d in the terminal, then change its settings or open it in the script editor.
A portfolio across Hyperliquid’s perps, in one account. Every Sunday’s close it ranks the universe by each coin’s residual momentum, the last 15 days of returns that its 60-day beta to BTC does not explain, over its 30-day volatility, and holds the top fifth from Monday’s open. The arrows on the chart are its own market’s fills; the equity curve is the whole account’s.

How it works

universe.topN(25) picks the 25 perps with the most dollar volume over the last 30 days, among those with 60 days of prices, again every 30 days. The pick reads only days before it, from every perp that traded then, delisted ones included, so the run never holds a coin for what it later became. On each Sunday’s close, pool.resid(market, 'BTC', 15, 60) and pool.volatility(market, 30) give each member’s score, and portfolio.longShort(scores, { quantile: 0.2, sides: 'long' }) turns the top fifth into equal weights that add up to the account. strategy.targets() sets the whole book: a coin that leaves the top fifth is sold at the next open. Set Sides to long the top and short the bottom instead. The Strategy report’s Markets tab shows what each coin made after fees, slippage and funding, and Book each rebalance’s weights beside the universe’s picks. A portfolio pays a flat 2 bps of slippage a fill: the archive’s order book readings start on 6 Sep 2026.

The script

residual-momentum.ts

Next step

See the next example, RSI cross, pasted Pine.
Last modified on October 28, 2026