Skip to content
All library documents

Estimating Market Microstructure Features from OHLCV Bars in MQL5

Article MQL5 articles

Summary

This article ports a set of bar-level market microstructure estimators to MQL5 and describes a class and chart indicator for calculating and displaying them. The measures include Roll spread and impact, Corwin-Schultz spread and intraday volatility, and Kyle, Amihud, and Hasbrouck liquidity or price-impact estimates. It outlines rolling calculations, the tick rule applied to bar closes, and how an EA can read the resulting features.

The central limitation is data quality: MT5 tick volume counts price changes rather than individual trades, so bar-close direction and tick volume only approximate signed trade flow. The author advises treating the lambda estimates as ordinal regime signals, not comparable absolute impact values across brokers. Roll and Corwin-Schultz spread estimates avoid volume inputs and are described as more comparable. Tick-level estimators and entropy features are deferred. The article lists mathematical invariant checks and a Python–MQL5 numerical comparison in its contents, but the supplied text does not give detailed validation results.

Key ideas

  • Roll spread is inferred from serial covariance in consecutive price changes.
  • Corwin-Schultz estimates spread and intraday volatility from adjacent high-low ranges without volume data.
  • The bar-level Kyle and Hasbrouck estimates use approximate signed volume based on bar-close direction and tick volume.
  • Treat lambda outputs as ordinal signals because broker tick-volume conventions vary.
  • The described MQL5 port does not include the tick-level estimators or entropy features.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.