Microstructure overlay: Stoikov micro-price, queue imbalance and OFI
The Microstructure overlay reads the live order book and draws the Stoikov micro-price as a trailing line, plus a gauge of L1 queue imbalance and multi-level order-flow imbalance (OFI) normalised by depth. It is a contemporaneous state reading, not a predictor.
Senzoukria · Documentation · Updated September 2026
Where to find it
- Where
- Chart → Indicators panel → group « Quant models » → « Microstructure (quant) »
- Default
- Off. OFI levels 10, micro-price line on, QI / OFI gauge on, trail 180 s, OFI smoothing 20 events
- Data needed
- A live depth feed (L2 snapshots sorted best-first), delivered by the Rithmic footprint chart, which is where the overlay is wired. No book, no output
What it does
Three readings of the book state are computed on every depth snapshot. The micro-price (Stoikov) is a fair price inside the spread weighted by the opposite queues: P_micro = Pb + I × (Pa − Pb) with I = Qb / (Qb + Qa). A large bid queue pushes it toward the ask. The queue imbalance is (Qb − Qa) / (Qb + Qa) at the first level, in [−1, +1]. The order-flow imbalance (OFI) sums, over N levels, the size that arrived, left or moved on each side between two snapshots, following Cont-Kukanov-Stoikov extended to multiple levels.
OFI is normalised by an EMA of the average depth per level, so the value is comparable across instruments and across hours of the same session. Without that normalisation the raw number has no meaning outside one book at one moment.
On the chart the micro-price is drawn as a trailing line over the last seconds, and a gauge shows the queue imbalance and the smoothed OFI. Both readings are computed from the depth snapshots of the Rithmic footprint chart; on a chart without a book the overlay stays empty.
Settings
| Setting | Default | What it changes |
|---|---|---|
| OFI levels | 10 (1–20) | Number of book levels per side integrated into the OFI; the OFI state is rebuilt when the symbol or this value changes |
| Micro-price line | On | Draws the Stoikov micro-price trail on the price scale |
| QI / OFI gauge | On | Shows the L1 queue imbalance and the smoothed OFI gauge |
| Line color | #e6e6e6 | Colour of the micro-price trail |
| Trail length | 180 s (30–600, step 30) | How many seconds of micro-price history stay on screen |
| Trail width | 1 px (1–4, step 0.5) | Stroke width of the trail |
| OFI smoothing | 20 events (1–100) | Length in events of the EMA applied to the normalised OFI before it reaches the gauge; 1 shows the raw value |
How to use it
Read the micro-price relative to the last trade: when it sits above the mid, the resting book is heavier on the bid and the next print is more likely to be an up-tick than a down-tick at that instant. Read the OFI gauge as pressure that is happening now, together with the footprint delta of the forming bar.
Lower « OFI levels » on thin books where deep levels are stale; raise it on large-tick instruments such as ES where the first levels alone are too coarse. Increase « OFI smoothing » if the gauge is unreadable at high update rates.
Limits and pitfalls
- The source research is explicit: OFI explains contemporaneous returns, not future ones. Lagged OFI has a negative out-of-sample R² at one minute. Do not treat the gauge as a forecast.
- The first snapshot only sets the baseline; the OFI returns nothing until a second snapshot arrives.
- An empty book side returns a null micro-price rather than a guessed value, and a snapshot without an exchange timestamp is skipped rather than stamped with the local clock.
- Depth data is billed by your data provider; L2 must be enabled on the subscription.
- The overlay is fed by the Rithmic footprint chart; the NinjaTrader and Quantower bridge charts do not feed it.
Related pages
This page in other languages
Frequently asked questions
- Why does the OFI need to be normalised by depth?
- A raw OFI of 500 contracts means something different at 09:30 with 2,000 contracts per level and at 13:00 with 300. Dividing by N × the EMA of average depth per level makes the reading comparable across hours and instruments.
- Is the micro-price a prediction of the next price?
- It is a fair value inside the spread given the current queues. It is a better short-horizon estimator than the mid, but it is a reading of the present book, and the panel's description says so explicitly.