indicator()
Names the script and says where it draws. Must be the first statement.IndicatorOptions
'percent': values in the script’s own pane (axis, tags, legend) print with a % sign. Set the values in percent.false keeps every input’s value out of the script’s name in the legend (“Bands”
rather than “Bands 20 2”). Default true. An input’s own legend: false keeps one out.'own': the plots on the price pane share a hidden scale of their own, drawn over the
candles without moving the price scale, as Pine’s scale.none. Default 'price'.A panel script: it runs in a script panel of its own rather than on a chart, on the market and
interval named here, or the panel’s choice where they are left out.
bars() is that market’s
bars, which clock the script; its panel blocks and graphs fill the panel. Plots are not drawn.
A market-wide read (20 markets’ positioning, a cross-market table) is a panel script.strategy
A strategy: an indicator whose target position the engine trades, charging what the venue would have (fees, slippage from the order book, funding), with an equity curve, fills on the chart and a Strategy report. Must be the first statement, in place ofindicator().
void
The position wanted from this bar’s close, as a fraction of equity: 1 fully long, −1 fully
short, 0 flat, held to the leverage. Applies on closed bars only. The same value again holds
the position as it is; a new value trades to it.
The same position wanted once price reaches a stop or a limit, resting until then.
A portfolio’s weight wanted in one market from this bar’s close, as a fraction of equity,
filled at that market’s next daily open. Markets not set keep what they hold. The book is held
to
leverage at the fill: the markets traded give way, those left alone do not.The position wanted as a notional in USD: positive long, negative short. One market only.
The position wanted in coins: positive long, negative short, held to the leverage. One market only.
Close the position when price reaches a stop or a limit, whichever it reaches first; the other
is then cancelled. It rests until it fills or the position it closes is closed. One market only.
A portfolio’s whole book from this bar’s close, market to weight: a market left out goes to 0.
What trading has cost so far, in USD: funding positive when received.
StrategyOptions
A strategy’s display options are an indicator’s (overlay: true draws its plots over the candles); it runs on a chart, never in a panel.
Where the account starts trading, with history loaded back to it: a date such as
'2025-03-01' (or an ISO time,
UTC unless it names a zone), a time in ms, or
a span back from the run’s end, '90d', '4w' or '1y' (a whole number of days, weeks or 365-day years,
lowercase, at most ten years). A span back is counted from the close of the newest bar the run has (a backtest’s
end on our server), so a template can say “a year back” and still give the same result on the same bars. By default
what the chart holds.'nextOpen' (the default): a target set on a bar’s close fills at the next bar’s open, so a
script never trades on a close it hasn’t seen. 'close': at the signal bar’s own close.'venue' (the default): the venue’s base tier, a market or stop fill paying the taker rate and
a limit fill the maker rate. Or rates of your own; makerBps defaults to takerBps.'book' (the default): what a market order of the fill’s size paid against the archived book
at the signal bar’s close (Hyperliquid and HIP-3), fallbackBps where it has no reading. Or a
flat cost.Charge funding while a position is open, every hour as the venue settles it. Default true; time charts of 1m and up only.
The most a target may ask for, as a multiple of equity. Default 1. Above 1 a position can be liquidated.
A portfolio: one account, shared cash and cross margin, across every Hyperliquid perp, set with
strategy.target(weight, { market }) or strategy.targets({...}). It runs on any time chart
from 1m to 1W: each market fills at the open of its own next bar at the chart’s interval, is
marked at its closes and liquidated at its bars’ worst prices, from the same bars its chart
shows (on 1D every market’s from the universe history’s months, which hold exactly those
bars; intraday each market’s own stream). The chart shows its own market’s fills and the whole account’s equity. Funding is
charged every hour at the day’s mean hourly rate. history is how many days of the universe
history (for picking markets) load before the chart’s first bar (default 180). Slippage is a
flat cost (slippage: { bps }, default fallbackBps, 2): the archive’s book readings start on
2026-09-06.PortfolioPosition
One market of a portfolio’s book.StrategyPosition
Fills that opened or added to the position since it was last flat; 0 when flat. A portfolio’s open sleeve counts one.
The chart bar (
chart.index) and the time of the fill that opened the position; na when flat, and in a portfolio.RestingOrderOptions
A resting order: it waits until price reaches it rather than filling at the next open. A stop fills when price trades through it, at its price (or the open, when a bar opens past it), as a taker; a limit fills when price trades at it, at its price or a better open, as a maker with no slippage. An order placed on a bar’s close can fill from the next bar on, and stays until it fills, is replaced by another with its id, or is cancelled.Names the order: another with this id replaces it,
strategy.cancel(id) removes it. Default
'entry'. A target with an id and no price is a market target that cancels the resting one.ExitOptions
Close only a long or only a short. Default: the position open now, or else the next one opened.