Skip to main content
Build order flow from the tape: every taker fill on the market, with what 0xArchive records about it. trades() reaches back to the chart’s first bar, at most 7 UTC days, from 0xArchive’s history, and continues live from the chart’s tape. The last three UTC days come in first, so a script draws its newest bars at once; the older days stream in after, and the script’s lines extend back when they are all in.

A trade

Sum the tape per bar

Add each trade to a tally in onTrade, and read it in the chart’s onBar. This is volume delta, in USD:
minSize and minNotional filter the stream, so trades({ minNotional: 100_000 }) delivers only trades of $100k or more.

Opening and closing trades

0xArchive records each trade’s change in open interest (oiDelta), in the market’s coin. With the taker’s side it says what the trade did: An oiDelta of 0 means one side opened while the other closed. Hyperliquid and HIP-3 count both sides of open interest, Lighter longs only, as each venue’s own open interest does. Opening and closing flow and Squeeze or new positions are built on it.

Why each side traded

oiDelta says what a trade did to open interest; it cannot say which side did what. takerWhy and makerWhy can: each side’s own position, before and after, as 0xArchive’s who’s-trading series buckets it. So a taker buy with takerWhy stop_short is a short stopped out, and the same buy with tp_short is one taking profit, which oiDelta alone reads the same. Market makers’ sides are tagged too. Either is null where 0xArchive could not vouch for the position, on Lighter, and from a server that does not send them yet.

Taker orders

One market order fills against many resting orders, and each fill is a trade. takerOrders() joins the fills back into the orders that made them and calls onOrder once per order, once all its fills are in:
minNotional counts the whole order, so takerOrders({ minNotional: 1_000_000 }) delivers $1M orders however many fills they took. A forming bar never sees part of an order, and history and live join the same way, by sameOrder. Lighter names no orders, so there every fill is an order of one. The reach is the trades’: the chart’s first bar, at most 7 UTC days back. To join fills yourself, a new order starts wherever a trade’s sameOrder is false. Large taker orders draws the ones of $2M or more as levels until price trades back, and Opening sweeps the orders that walked the book to open positions.

Volume by price

volumeProfile() sums the tape by price: what takers bought and sold at each price, over the current bar (bar()), the last few bars (last(n)), or since a time (since(time)), such as the session’s start. Each span gives a profile with its totals, its rows({ rowSize }), its point of control (poc()) and its value area (valueArea(70), by TradingView’s rule):
A row size puts rows on whole multiples of it, so a row is the same row on every bar; without one, each traded price is its own row. A profile is read in the run that asked for it. A span older than the trades (the chart’s first bar, at most 7 UTC days back) reads order flow by bar up to the trades and the trades from there, so it starts at the first whole bar at or after its start; where neither covers it, it reads available: false. Footprint cells draws each bar’s rows inside it, and Session volume profile the session’s developing value area.

Footprint rows

chart.rowSize is the row size the chart’s footprint draws: the reader’s own, or what Auto picks at the chart’s zoom. Pass it as the row size, and the rows a script marks sit on the footprint’s rows, its point of control is the footprint’s, and its imbalances are the ones the footprint shades:
A script that reads it runs again from its first bar when the size changes: when the reader picks another, or Auto steps to another as the chart zooms. Without a footprint on the chart it is the reader’s size for the market, or one near a 5,000th of the price ($20 rows for BTC at 81,000), the same for the whole run. To bin trades by row yourself, as the flow setups below do, use Math.floor(t.price / chart.rowSize).

Flow setups

A footprint shows where takers bought and sold. Each fill’s takerWhy adds who they were, so a setup can ask what no footprint can: Stacked imbalances above PoC marks buyers holding above the bar’s busiest price; Trapped traders, new positions opened on the wrong side of it; Stopped out at the extreme, stacks made by traders closing at a loss; and Breakout with new money, whether a move out of the previous day’s value area opened positions or closed them.

Order flow by bar, over a year

orderFlow() reads 0xArchive’s order flow archive at the chart’s interval: for each bar, what takers bought and sold at each price, and the bar’s totals. It reaches as far back as the chart does (a year in a backtest), where trades() reaches 7 days, so a footprint, delta or CVD strategy can be backtested over a year:
Each bar holds every trade that filled against the book, as the venue’s candles count them, so its volume and trade count equal the candle’s. Backstop liquidations and auto-deleveraging did not trade against the book: they are counted beside the bar (offBookVolume, offBookCount), never in its rows. orderFlow({ rowSize }) puts the rows on whole multiples of a row size (a whole multiple of the market’s price step); without one each traded price is its own row. A bar is read once it has closed and never before, so a backtest never sees a bar early. The forming bar is not in it: live, read it from trades() or volumeProfile().bar(). Order flow starts on 22 March 2025 12:00 UTC for Hyperliquid perps and 22 December 2025 for HIP-3 at the earliest. On a chart, the bars after the archive’s last closed hour come from the live trades as they close; there offBookVolume reads na, since the live tape does not tell those trades apart. A bar neither knows (a day not built yet) reads available: false with na values, never zeros, and cvd() reads na from the anchor through such a bar: the session’s CVD comes back the next day, the start’s does not. Rows are kept for the last 2,000 bars or 500,000 rows, whichever is fewer, and a bar older than that reads available: false with its totals.

Intent flow by bar, over a year

intentFlow() reads 0xArchive’s intent flow archive at the chart’s interval: for each bar, the trades summed by what each side did to its position, in the categories takerWhy and makerWhy name. Each category gives its volume, notional, VWAP and trade count, so a strategy on who opened, who took profit and who was stopped out can be backtested over a year, where trades() reaches 7 days:
Each cell is { volume, notional, vwap, count }: the size traded in the market’s coin, the USD at the traded prices, their ratio, and the trades. A category with no trade in the bar reads 0, and its vwap reads na. The categories come from each fill’s position before and after it and its closed profit, not from the order that made it: “stop” is an exit at a loss or a forced one, not a stop order. A stop order that closes in profit is tp_long or tp_short. Each side counts every trade once, so taker.total and maker.total are both the bar’s volume and trade count: every trade that filled against the book, as the venue’s candles count them. taker is the aggressors, the side that moved price; maker is the resting orders they filled; all adds the two, every trade twice, so all.open_long is every long opened in the bar, by takers and makers alike. Sizes add in whole units of the market’s size step, so a sum over many bars does not drift. A bar is read once it has closed and never before. Intent flow starts on 25 May 2025 14:24 UTC for Hyperliquid perps, the first minute in which every fill carries what its category is read from, and on 22 December 2025 for HIP-3, at the earliest. The archive holds closed hours: the forming bar, every bar after the archive’s last closed hour, a day it has not built, and everything before its start read available: false with na values, never zeros. A bar it holds only the first part of reads available: false with partial: true and its sums so far. For the newest bars, sum trades() by takerWhy as above. Every chart interval of a minute or more; seconds bars and bars that close on trades read available: false.

Order flow by bar, without events

Bars that close on trades (t500, v1000000 and the rest) carry buyVolume and sellVolume on each bar. On time bars, read orderFlow() above, or sum trades().

Next step

Read liquidations and where they would happen next in liquidations.
Last modified on November 16, 2026