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, and spans older than the trades (the chart’s first bar, at most 7 UTC days back) read 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, without events

Bars that close on trades (t500, v1000000 and the rest) carry buyVolume and sellVolume on each bar. Time bars do not split volume, so sum trades() for them.

Next step

Read liquidations and where they would happen next in liquidations.
Last modified on October 31, 2026