Discussing the article: "Isolation Forest: Unsupervised Anomaly Detection, and What It Actually Finds in Price Data"

 

Check out the new article: Isolation Forest: Unsupervised Anomaly Detection, and What It Actually Finds in Price Data.

This article implements a self-contained Isolation Forest library for MetaTrader 5 with no labels, no distribution assumptions and no external dependencies. It details a reproducible 64‑bit generator, tree/forest construction, scoring and feature design, then verifies results against Python and market data with two null models. The package includes an indicator that plots the decision variable and a gate example. Readers get a validated library, clear limits of applicability and a practical way to calibrate thresholds.

The algorithm rests on one observation about random partitioning. Take a set of points and repeatedly split it: pick a coordinate at random, pick a value at random inside that coordinate's range, and send the points either side. Keep going until a point is alone. The number of splits that took is the point's path length.

Points buried in a dense region survive many splits, because almost every random cut lands with points on both sides, while a point far from the rest is separated early. Path length therefore measures directly how easy a point was to isolate.

 Two panels showing random axis-parallel cuts isolating a crowded point and an outlier


Two practical problems stand between that idea and a usable number. The first is that growing a tree until every point is alone makes it enormous, and the points needing the deepest trees are the ordinary ones nobody is asking about. So growth stops at a height limit of ceil(log2(psi)), the average depth of a balanced tree over a sub-sample of size psi.

Author: Hammad Dilber