Discussing the article: "Market Microstructure in MQL5: Order Flow (Part 6)"

 

Check out the new article: Market Microstructure in MQL5: Order Flow (Part 6).

This article adds six order-flow functions and a new OrderFlowAnalysis struct to MicroStructureFoundation.mqh: VPINOHLC, signed flow imbalance, trade intensity versus a 20-session baseline, a late-minus-early smart-money index, flow momentum, and a wrapper that outputs a confidence weight. Flow confidence is gated by noise and jump intensity from Parts 5 and 4. Calibrated on 602 NQ M1 NY sessions, it provides ready-to-use intraday flow signals with documented thresholds.

Order flow is the proximate cause of price changes. Every price movement results from one side of the market being more aggressive than the other — buyers lifting offers or sellers hitting bids. The challenge at one-minute resolution is that the aggressor side is not directly observable from OHLCV data. The functions in this article construct bar-level approximations of order flow. They are conditioned on the noise and volatility measures from Parts 4 and 5. The output is connected to the OrderFlowSignal struct reserved in Part 1.

Before the implementation sections, two points require explicit framing — both involve the same M1 aggregation problem documented in Part 5.

VPIN_OHLC() approximates the volume-imbalance component of the Easley, López de Prado and O'Hara (2012) VPIN measure using bar-level data. The canonical VPIN requires fixed-volume buckets where every trade contributes to the imbalance estimate. On one-minute NQ futures bars, each bar contains hundreds of executions. For the same reason as the Roll spread in Part 5, intrabar aggregation absorbs the microstructure signal, so the imbalance collapses toward 0.5. The empirical study shows a total VPIN range of 0.45 to 0.62 across 602 sessions, with regime elevations of 6% during stress. This is a weak but directionally correct signal. It is retained as the OHLCV-best-available approximation and must not be interpreted as a statistically calibrated probability of informed trading.

Author: Max Brown