Discussing the article: "Measuring Market Efficiency with Lempel-Ziv Complexity"

 

Check out the new article: Measuring Market Efficiency with Lempel-Ziv Complexity.

This article presents a compact MQL5 library for market-complexity analysis: LZ76 complexity and Normalized Compression Distance built on a SAX symbolizer, exposed through a simple facade and an efficiency indicator. It explains the discretization choices, normalization, and distance formulation, and validates the code with unit checks and an independent cross-check. You get a ready-to-use library and indicator, plus a disciplined way to interpret readings with a shuffle null and a direction check.

The idea has a name in finance. The efficient-market hypothesis says that in a liquid market prices already reflect the available information, so returns should be close to unpredictable, close to a coin flip. Compression turns that abstract claim into something you can measure on a chart. If the moves are truly unpredictable they do not compress, and the complexity reads high. Where the complexity drops, the market is, in this narrow sense, leaving structure on the table. Whether that structure is anything you could trade is a harder question, and one this article takes seriously rather than waving away.

The catch, and the reason this article spends as much time on measurement discipline as on code, is that a raw complexity reading on real returns is easy to misread. Market returns are fat-tailed, and fat tails lower the complexity number on their own, with no predictability behind them at all. So a naive reading calls an efficient market inefficient. The library here is built to separate the two: what part of a low reading is the shape of the return distribution, and what part is genuine structure you could act on.

The work is aimed at a developer who wants a compact, well-tested complexity toolkit in pure MQL5, and who cares more about an honest answer than a flattering one. Everything is built from scratch, cross-checked against an independent Python implementation, and then run on EURUSD and gold across two timeframes.

Measuring Market Efficiency with Lempel-Ziv Complexity

Author: Hammad Dilber

 
great writeup !!