Templates

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.

One cycle, and the call behind each step
Elysium · the token's contract
HyperCore · its own account
  1. 1Read
    A keeper calls step(); the vault reads
    coreTimeMspositionaccountValuemarkPx
    Its position, account value and the mark
    coreTimeMspositionaccountValuemarkPx
  2. 2Enter
    Sends leverage × capital
    limitOrder · IOC
    Fills at market, within the slippage
    limitOrder · IOC
  3. 3Rest the take-profit
    Sees the position, places the TP
    limitOrder · GTC
    A reduce-only order waits in the book
    limitOrder · GTC
  4. 4Take-profit fills
    no transaction
    Fills at its own price. No transaction needed
  5. 5Or the stop
    Mark past the stop: cancel, close
    markPxcancelByCloidlimitOrder · IOC
    The TP is cancelled; an order closes now
    markPxcancelByCloidlimitOrder · IOC
  6. 6Settle and wait
    Reads position zero, books the result, cools down
    positionaccountValue
    Account value after the close
    positionaccountValue
Then it waits out the re-entry delay and enters again, until a breaker or the end date stops it.

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.

What happens to $1,000
Long BTC at 3×, take-profit +2%, stop −1%, re-entry 1 min
Up 5%over 2 days
62,72559,500$1,000$1,143your $1,000
$1,000 →$1,143+14.3%
2 take-profits · 0 stops · in a trade at the end

If BTC rises 5% over 2 days, your $1,000 becomes about $1,143.

Sidewaysfor 2 days
60,30858,530$1,000$987your $1,000
$1,000 →$987−1.3%
2 take-profits · 4 stops · in a trade at the end

If BTC goes sideways for 2 days, your $1,000 becomes about $987.

Down 5%over 2 days
59,50256,500$1,000$833your $1,000
$1,000 →$833−16.7%
0 take-profits · 5 stops · in a trade at the end

If BTC falls 5% over 2 days, your $1,000 becomes about $833.

Drops 7%in an hour
59,50255,003$1,000$948your $1,000
$1,000 →$948−5.2%
0 take-profits · 2 stops · in a trade at the end

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.

Flat → Entering → Open → (take-profit fills | stop: Closing) → Settle → Cooldown → Flat
A breaker or the end date takes the token to Halted from any phase: sell-only, for good.

Settings

Market
Range: Any listed perp, HIP-3 included
Default: BTC
What it does: Which order book it trades. A thin book fills big orders worse.
Direction
Range: Long or short
Default: Long
What it does: Long wins when the price rises, short when it falls.
Leverage
Range: 1× up to Hyperliquid's max × (1 − cash share)
Default: 2×
What it does: Higher: bigger wins and losses per move, liquidation closer.
Take-profit
Range: 0.1%–100% from entry
Default: 2%
What it does: Closer: more, smaller wins. Further: fewer, bigger ones.
Stop
Range: Off, or 0.1% up to the liquidation price
Default: 1%
What it does: Tighter: smaller losses, hit more often.
Stop slippage
Range: 0.05%–10%
Default: 0.5%
What it does: The worst price a stop accepts. What doesn't fill is sent again in the next block.
Entry slippage
Range: 0.05%–5%
Default: 0.3%
What it does: The worst price an entry accepts. Past it, the order doesn't fill and waits for the next step.
Re-entry delay
Range: 0 s – 7 days
Default: 1 min
What it does: Longer: fewer cycles, more time out of the market.
After-stop multiplier
Range: ×1–×100 the delay
Default: ×1
What it does: Waits longer after a stop than after a take-profit.
Bank of each win
Range: 0%–100%
Default: 0%
What it does: Banked profit still belongs to holders but isn't traded any more.
Leverage
The same take-profit and stop, more or less size.
2×
Up 5%: $1,094 · down 5%: $886 · liquidation −43.8%
5×
Up 5%: $1,246 · down 5%: $734 · liquidation −16.8%
Take-profit and stop
Tight exits trade often; wide ones wait for bigger moves.
+2% / −1%
Sideways: 2 take-profits, 4 stops → $987
+4% / −2%
Sideways: 0 take-profits, 0 stops → $997
Re-entry delay
How long it waits after a close before it enters again.
1 min
Down 5%: 5 stops → $833
1 hour
Down 5%: 4 stops → $854
Cash share
Cash for instant sells against the leverage a market allows.
10%
BTC cap 36×
30%
BTC cap 28×

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.

coreTimeMs()
Kind: read
What it does here: How fresh the reads are. A step stops when they're older than 2 seconds.
Where today: HyperEVM: the block's time
position(vault, asset)
Kind: read
What it does here: The vault's own position on a market: its size and what it cost.
Where today: L1Read 0x…0800
accountValue(vault)
Kind: read
What it does here: What the vault's HyperCore account is worth: margin plus the open result. NAV is built from it.
Where today: L1Read 0x…080F
markPx(asset)
Kind: read
What it does here: Hyperliquid's mark price: what the stop, the bands, the levels and the strikes are checked against.
Where today: L1Read 0x…0806
limitOrder(… IOC)
Kind: write
What it does here: An order that fills at once or cancels, never worse than its limit: entries, stops, rebalances, grid steps.
Where today: CoreWriter action 1, time-in-force 3
limitOrder(… GTC, reduce-only)
Kind: write
What it does here: A take-profit that rests in Hyperliquid's book and fills at its own price, with no transaction needed.
Where today: CoreWriter action 1, time-in-force 2
cancelByCloid(asset, id)
Kind: write
What it does here: Cancels the resting take-profit by the id the vault gave it.
Where today: CoreWriter action 11
withdrawable(vault)
Kind: read
What it does here: How much USDC can leave the account right now, to pay sellers.
Where today: L1Read 0x…0803
usdClassTransfer(amount, toPerp)
Kind: money
What it does here: Moves USDC between the account's perp and spot balances.
Where today: CoreWriter action 7
depositFor(vault, amount, dest)
Kind: money
What it does here: Sends USDC from the vault on the chain into its own HyperCore account.
Where today: Circle's CoreDepositWallet
spotSend(system, USDC, amount)
Kind: money
What it does here: Sends USDC from the HyperCore account back to the vault on the chain, to pay sellers.
Where today: CoreWriter action 6

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.

Entry
What happens: 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.
Where: HyperCore
Next step
What happens: The vault sees the position and rests a reduce-only sell of 3.333 BTC at $91,810. The stop line is $89,110.
Where: Elysium → HyperCore
Take-profit
What happens: BTC trades through $91,810. HyperCore fills the resting order exactly there, even if the price jumps past it. No Elysium transaction is involved.
Where: HyperCore
Result
What happens: +$6,000 on the price, less $135 taker fee, $46 maker fee and about $20 funding: +$5,799.
Where: HyperCore
Within a second
What happens: A keeper's step reads position zero and settles: NAV $1.0580 (+5.8%).
Where: Elysium
Fees and bank
What happens: 10% of the gain ($580) is minted to the creator; half the rest ($2,610) is banked.
Where: Elysium
Cooldown
What happens: 60 s, then it enters again, sized from 3 × (NAV − banked).
Where: 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.