Appearance

Personalize your experience

Mode
Accent Color
Direction
All Docs/QuaScript//
QuaScript logo

QuaScript Documentation

Language guide, engine API, 601 builtins and the preset library · v3.0.0-phase1

book: order book (host data)

Generated from the engine catalog by tools/gen-docs.mjs; do not edit.

Constants

NameValueMeaning
book.ask_side1Ask side (1).
book.bid_side-1Bid side (-1).
book.col_orders3Order count column of book.bids / book.asks (na when unknown).
book.col_price0Price column of book.bids / book.asks.
book.col_size1Size column of book.bids / book.asks.
book.col_total2Cumulative size column of book.bids / book.asks.
book.order_id3Order id column of book.orders.
book.order_price1Price column of book.orders.
book.order_side0Side column of book.orders (-1 bid, 1 ask).
book.order_size2Size column of book.orders.

book.ask

script.qs
book.ask

Best ask price of this bar's book.

Needs host data (order book).

book.ask_size

script.qs
book.ask_size

Size resting at the best ask.

Needs host data (order book).

book.ask_volume

script.qs
book.ask_volume(levels = 0) -> series

Resting ask size over the top levels (0 = the whole side).

ArgumentKindDefaultNotes
levelsint0

Needs host data (order book).

book.asks

script.qs
book.asks

The ask side of this bar's order book as a grid: one row per price level, best first; columns price, size, cumulative size and order count. Empty when the bar has no book.

Needs host data (order book).

book.bid

script.qs
book.bid

Best bid price of this bar's book.

Needs host data (order book).

book.bid_size

script.qs
book.bid_size

Size resting at the best bid.

Needs host data (order book).

book.bid_volume

script.qs
book.bid_volume(levels = 0) -> series

Resting bid size over the top levels (0 = the whole side).

ArgumentKindDefaultNotes
levelsint0

Needs host data (order book).

book.bids

script.qs
book.bids

The bid side of this bar's order book (L1 / L2, or aggregated from L3 orders) as a grid: one row per price level, best first; columns price, size, cumulative size and order count (book.colprice / colsize / coltotal / colorders; the count is na when the feed does not report it). Empty when the bar has no book.

Needs host data (order book).

script.qs
bids = book.bids
for i in 0..grid.rows(bids) { depth += grid.get(bids, i, book.col_size) }

book.depth

script.qs
book.depth

What this bar's book holds: 0 nothing, 1 top of book (L1), 2 price levels (L2), 3 individual orders (L3); na when the chart supplies no book at all.

Needs host data (order book).

book.imbalance

script.qs
book.imbalance(levels = 0) -> series

(bid size - ask size) / (bid size + ask size) over the top levels (0 = the whole book), -1 .. 1.

ArgumentKindDefaultNotes
levelsint0

Needs host data (order book).

book.impact

script.qs
book.impact(qty, side = 1) -> series

Percent between the mid and the average fill of a market order of qty walking the book (side = book.askside to buy, book.bidside to sell); na when the book is too thin.

ArgumentKindDefaultNotes
qtynumrequired
sideint1

Needs host data (order book).

book.largest_order

script.qs
book.largest_order(side = 0) -> (price, size)

The largest single resting order (L3) on one side (0 = either): (price, size).

ArgumentKindDefaultNotes
sideint0

Returns 2 values: price, size. Needs host data (order book).

book.levels

script.qs
book.levels

Price levels present on both sides of this bar's book (0 = no book on this bar).

Needs host data (order book).

book.liquidity

script.qs
book.liquidity(pct, side = 0) -> series

Resting size within pct percent of the mid price: side = book.bidside, book.askside or 0 for both.

ArgumentKindDefaultNotes
pctnumrequired
sideint0

Needs host data (order book).

script.qs
near = book.liquidity(0.25)

book.microprice

script.qs
book.microprice

Mid price weighted by the opposite touch sizes (leans towards the thinner side).

Needs host data (order book).

book.mid

script.qs
book.mid

(best bid + best ask) / 2 of this bar's book.

Needs host data (order book).

book.order_count

script.qs
book.order_count(side = 0) -> series

Resting orders on one side (0 = both): counted from L3 orders, else summed from the order counts of L2 levels; na when the feed reports neither.

ArgumentKindDefaultNotes
sideint0

Needs host data (order book).

book.orders

script.qs
book.orders

Every resting order of this bar's book (L3 / market-by-order feeds) as a grid: columns side (-1 bid, 1 ask), price, size and order id (book.orderside / orderprice / ordersize / orderid). Empty without L3 data.

Needs host data (order book).

book.pressure

script.qs
book.pressure(decay = 0.25) -> series

Distance-weighted imbalance of the whole book, -1 .. 1: each level counts exp(-distance% / decay), so orders near the touch dominate.

ArgumentKindDefaultNotes
decaynum0.25

Needs host data (order book).

book.spread

script.qs
book.spread

Best ask - best bid of this bar's book.

Needs host data (order book).

book.vwap

script.qs
book.vwap(side, levels = 0) -> series

Size-weighted average price of one side over the top levels (0 = the whole side).

ArgumentKindDefaultNotes
sideintrequired
levelsint0

Needs host data (order book).

book.wall

script.qs
book.wall(side, levels = 0) -> (price, size)

The largest price level of one side (over the top levels, 0 = the whole side): (price, size).

ArgumentKindDefaultNotes
sideintrequired
levelsint0

Returns 2 values: price, size. Needs host data (order book).

script.qs
(wall_px, wall_sz) = book.wall(book.ask_side)

© 2026 Quatick Technologies. All rights reserved.