Discussing the article: "Detecting and Visualizing Outlier Bars in MQL5 Using Modified Z-Score on OHLCV Features"

 

Check out the new article: Detecting and Visualizing Outlier Bars in MQL5 Using Modified Z-Score on OHLCV Features.

Abnormal bars inflate mean and standard deviation estimates, distorting ATR, Bollinger Bands, and moving averages. We implement a native MQL5 indicator that detects such bars with the Modified Z-Score applied to four features: body, upper wick, lower wick, and tick volume. The indicator marks flagged bars on the chart and plots a composite score in a separate subwindow, helping you diagnose contamination in rolling-window indicators.

Every price series contains bars that do not belong to the ordinary distribution of market behavior. A central bank rate decision can produce a candlestick whose body is ten times the median session range. A liquidity gap at a weekend open can generate a wick that dwarfs anything seen in the preceding hundred bars. A broker feed anomaly can inject a tick volume observation so large it renders the surrounding data invisible on a chart scale.

These bars are outliers. They are not necessarily erroneous — many represent genuine, economically significant events. But their presence inside the fixed lookback window used by common indicators creates a statistical contamination problem that is rarely discussed in quantitative trading literature.

This article presents the engineering design and implementation of a native MQL5 indicator for detecting abnormal price bars using the Modified Z-Score. The indicator analyzes four bar features: body size, upper wick, lower wick, and tick volume. It computes a composite outlier score for each bar, marks anomalies on the chart, and plots the score as a histogram in a dedicated subwindow.

Author: Ushana Kevin Iorkumbul