Loop
Buys (or shorts) one market at a fixed leverage, takes profit at a set gain, stops at a set loss, waits, and does it again. The simplest strategy token.
What it does
In one sentence: “Buy BTC at 3×, take profit at +2%, stop at −1%, wait 1 minute, repeat.” The take-profit rests in Hyperliquid's order book, so it fills on its own the moment the price gets there. The stop is checked every block.
- 1ReadA keeper calls step(); the vault readscoreTimeMspositionaccountValuemarkPxIts position, account value and the markcoreTimeMspositionaccountValuemarkPx
- 2EnterSends leverage × capitallimitOrder · IOCFills at market, within the slippagelimitOrder · IOC
- 3Rest the take-profitSees the position, places the TPlimitOrder · GTCA reduce-only order waits in the booklimitOrder · GTC
- 4Take-profit fillsno transactionFills at its own price. No transaction needed
- 5Or the stopMark past the stop: cancel, closemarkPxcancelByCloidlimitOrder · IOCThe TP is cancelled; an order closes nowmarkPxcancelByCloidlimitOrder · IOC
- 6Settle and waitReads position zero, books the result, cools downpositionaccountValueAccount value after the closepositionaccountValue
What happens next
The same rules on four price paths over two days. Watch where it enters (white), takes profit (green) and stops (red), and what $1,000 becomes.
If BTC rises 5% over 2 days, your $1,000 becomes about $1,143.
If BTC goes sideways for 2 days, your $1,000 becomes about $987.
If BTC falls 5% over 2 days, your $1,000 becomes about $833.
If BTC drops 7% in an hour, your $1,000 becomes about $948.
- Enters
- Take-profit
- Stop
- Price
Illustrative price paths over 2 days. What the token does on them, and every dollar figure, comes from the template's own simulator with these settings and Hyperliquid's fees, with funding and order-book slippage where they apply. Before the fees to buy and sell the token. Not a forecast.
How it runs
A keeper calls step(); anyone can. Each call does whatever is due, in this order: read HyperCore (a read older than 2 s stops here) → arm the take-profit once the entry shows → settle a filled take-profit, or send the stop → resend a stop that didn't fill → settle, take the performance fee on a new high, bank a share of a win, check the breakers → wait the re-entry delay → pay queued sells → keep the cash share → enter again.
Settings
| Setting | Range | Default | What it does |
|---|---|---|---|
| Market | Any listed perp, HIP-3 included | BTC | Which order book it trades. A thin book fills big orders worse. |
| Direction | Long or short | Long | Long wins when the price rises, short when it falls. |
| Leverage | 1× up to Hyperliquid's max × (1 − cash share) | 2× | Higher: bigger wins and losses per move, liquidation closer. |
| Take-profit | 0.1%–100% from entry | 2% | Closer: more, smaller wins. Further: fewer, bigger ones. |
| Stop | Off, or 0.1% up to the liquidation price | 1% | Tighter: smaller losses, hit more often. |
| Stop slippage | 0.05%–10% | 0.5% | The worst price a stop accepts. What doesn't fill is sent again in the next block. |
| Entry slippage | 0.05%–5% | 0.3% | The worst price an entry accepts. Past it, the order doesn't fill and waits for the next step. |
| Re-entry delay | 0 s – 7 days | 1 min | Longer: fewer cycles, more time out of the market. |
| After-stop multiplier | ×1–×100 the delay | ×1 | Waits longer after a stop than after a take-profit. |
| Bank of each win | 0%–100% | 0% | Banked profit still belongs to holders but isn't traded any more. |
Plus the settings every template shares: the cash share, breakers, pool cap, end date, fees, market liquidity, metadata and seed. See Shared settings.
Under the hoodintended, on Elysium's precompiles
Every precompile call a Loop token makes, in the order its cycle first makes them, then the pool's own. Until Elysium publishes its precompiles these are the intended calls; the contracts run them on HyperEVM testnet today. What each does, and the assumptions behind them: Precompiles on Elysium.
| Call | Kind | What it does here | Where today |
|---|---|---|---|
coreTimeMs() | read | How fresh the reads are. A step stops when they're older than 2 seconds. | HyperEVM: the block's time |
position(vault, asset) | read | The vault's own position on a market: its size and what it cost. | L1Read 0x…0800 |
accountValue(vault) | read | What the vault's HyperCore account is worth: margin plus the open result. NAV is built from it. | L1Read 0x…080F |
markPx(asset) | read | Hyperliquid's mark price: what the stop, the bands, the levels and the strikes are checked against. | L1Read 0x…0806 |
limitOrder(… IOC) | write | An order that fills at once or cancels, never worse than its limit: entries, stops, rebalances, grid steps. | CoreWriter action 1, time-in-force 3 |
limitOrder(… GTC, reduce-only) | write | A take-profit that rests in Hyperliquid's book and fills at its own price, with no transaction needed. | CoreWriter action 1, time-in-force 2 |
cancelByCloid(asset, id) | write | Cancels the resting take-profit by the id the vault gave it. | CoreWriter action 11 |
withdrawable(vault) | read | How much USDC can leave the account right now, to pay sellers. | L1Read 0x…0803 |
usdClassTransfer(amount, toPerp) | money | Moves USDC between the account's perp and spot balances. | CoreWriter action 7 |
depositFor(vault, amount, dest) | money | Sends USDC from the vault on the chain into its own HyperCore account. | Circle's CoreDepositWallet |
spotSend(system, USDC, amount) | money | Sends USDC from the HyperCore account back to the vault on the chain, to pay sellers. | CoreWriter action 6 |
coreTimeMs()position(vault, asset)accountValue(vault)markPx(asset)limitOrder(… IOC)limitOrder(… GTC, reduce-only)cancelByCloid(asset, id)withdrawable(vault)usdClassTransfer(amount, toPerp)depositFor(vault, amount, dest)spotSend(system, USDC, amount)Worked example: a take-profit
BTC Loop 3×: long BTC at 3×, take-profit +2%, stop −1%, re-entry 60 s. A 10% performance fee and half of every win banked. The pool is worth $100,000 across 100,000 tokens.
| Moment | What happens | Where |
|---|---|---|
| Entry | Mark $90,000. The vault sends an IOC buy for $300,000 (3.333 BTC), at most 0.3% worse. It fills at about $90,010. | HyperCore |
| Next step | The vault sees the position and rests a reduce-only sell of 3.333 BTC at $91,810. The stop line is $89,110. | Elysium → HyperCore |
| Take-profit | BTC trades through $91,810. HyperCore fills the resting order exactly there, even if the price jumps past it. No Elysium transaction is involved. | HyperCore |
| Result | +$6,000 on the price, less $135 taker fee, $46 maker fee and about $20 funding: +$5,799. | HyperCore |
| Within a second | A keeper's step reads position zero and settles: NAV $1.0580 (+5.8%). | Elysium |
| Fees and bank | 10% of the gain ($580) is minted to the creator; half the rest ($2,610) is banked. | Elysium |
| Cooldown | 60 s, then it enters again, sized from 3 × (NAV − banked). | Elysium → HyperCore |
Edge cases
- Part of the take-profit fills. The rest keeps resting; the stop still guards what's left.
- The price gaps through the take-profit. The resting order fills at the take-profit price.
- The price gaps through the stop. The close fills up to the stop slippage past the mark; the rest goes again next block.
- Liquidation. With the stop off, or past a gap, a liquidation closes the position; the next step settles it like any close.
- New money during a trade waits in cash and joins at the next entry.