Testing an order-flow idea properly: Order Flow Imbalance
Learning objectives
- Define Order Flow Imbalance (OFI) from changes in best-bid and best-ask prices and queue sizes, following Cont, Kukanov & Stoikov (2014).
- Describe their finding of a linear, contemporaneous relation between OFI and short-horizon price changes, with a slope inversely related to market depth.
- Explain why a strong contemporaneous fit is not a predictive trading edge.
- Design a proper predictive test of an OFI signal on ES/NQ using the module's tools — costs, walk-forward, deflation and a lockbox.
M7.10 — BACKTEST OVERFITTING & DEFLATED SHARPE VISUALIZER
Multiple-Testing Haircut: Reported Sharpe vs Deflated Sharpe Across N = 1 → 1000 Trials
0%
M10.07 — Testing an order-flow idea properly · Quant Validation
This lesson is in production. The outline below shows what it will cover. The full lesson will ship with a worked study design and a quiz with answer explanations.
Hook
- “Order flow moves price” is true, but by the time you have measured it, the price has already moved. This is the gap between explaining a move and predicting one.
Chart first: defining OFI at the top of the book
- Each book update n contributes eₙ from the bid side and the ask side:
- bid side: if the best bid rises, add the new bid size; if it is unchanged, add the change in bid size; if it falls, subtract the previous bid size;
- ask side: the mirror image with the sign reversed, because a growing ask queue is selling pressure.
- OFI over an interval = the sum of eₙ. A small table will walk through 4–5 book updates on ES.
What the paper found
- Over short intervals, mid-price change ≈ β · OFI (linear and contemporaneous), and β falls as market depth rises (slope inversely proportional to depth).
- The relation was robust to intraday seasonality and stable across time scales and stocks in their sample (NYSE TAQ data, 50 US stocks). The lesson will flag that the sample was equities, not CME futures.
- Volume-based (square-root) impact relations were noisier than the OFI relation.
Contemporaneous ≠ predictive
- A high R² between OFI and price change in the same interval says OFI describes how prices form. It does not say that past OFI forecasts future price.
- Predictive test: regress the next interval’s price change on this interval’s OFI, net of costs in ticks (M10.02).
Designing the test (planned worked example)
- Pre-register (M10.06): contract, session, interval length, signal threshold, holding period and cost model.
- Walk forward over months (M10.03), count every interval length and threshold tried, deflate the best result (M10.04), check PBO (M10.05), then make one lockbox run.
- Data requirements: market-by-price or top-of-book data with queue sizes. Footprint bars are not enough to compute OFI.
Common mistake (planned)
- Treating an in-bar delta or OFI “confirmation” as a signal when it is measured over the same bar as the price move it confirms.
Sources
- Cont, Kukanov & Stoikov, “The Price Impact of Order Book Events”, Journal of Financial Econometrics 12(1), 47–88 (2014), DOI 10.1093/jjfinec/nbt003. arXiv preprint · RePEc
Prerequisite: M10.06 Lockbox discipline, M3.08 (DOM & liquidity) · Next: M10.08 Prop-firm rule math
Educational content only — not financial advice. Futures trading involves substantial risk of loss.
Saved in this browser (account sync comes at launch).
Not financial advice. Educational content only. Futures trading involves substantial risk of loss.