Discussing the article: "Surrogate Data Testing: A Null Model for Any Statistic, and Why Shuffling Bars Is Not One"

Check out the new article: Surrogate Data Testing: A Null Model for Any Statistic, and Why Shuffling Bars Is Not One.

We implement surrogate testing for indicators in MQL5: generate synthetic series that match your data's distribution and spectrum, score any statistic, and locate the observation within its null distribution. The library provides four null models, an FFT that handles arbitrary lengths, and a plug‑in interface for custom measures. An indicator visualizes the statistical alongside its chance band for direct interpretation.

Suppose your indicator reports a determinism of 0.73, or a persistence entropy of 1.42, or a time reversal asymmetry of -0.31. The number is real and the code is correct, yet the reading is uninterpretable, because nothing in the calculation tells you what that statistic would have produced on a series with no structure worth finding. Without that comparison a reading is a number, not a result.

The standard answer is a null model: generate many synthetic series sharing everything with your data except the thing you claim to have found, score the statistic on each, and see where the real reading lands among them. The difficulty is all in "share everything except". Get that wrong and the test answers a question nobody asked.

MQL5 already has permutation testing. Two articles cover it, both aimed at strategy results: Monte Carlo Permutation Tests in MetaTrader 5 permutes ticks, and Permuting price bars in MQL5 permutes bars, and both ask whether a backtest could have arisen by luck. That is a sound question about a P&L curve. It is usually the wrong question about an indicator, for a mechanical rather than philosophical reason. Shuffling bars destroys arrival order and, with it, the autocorrelation almost every technical indicator uses. A shuffled null therefore asks, "Is the indicator reading anything at all?" That is the right question for an indicator whose claim does not involve time ordering, and the wrong one for the majority that do. For those the relevant question is, "Is it reading anything beyond the linear correlation present in any trending or mean-reverting series?"

The difference is visible in one picture. The chart below takes 300 daily gold bars, converts them to absolute log returns, and plots the autocorrelation of the data against two candidate nulls. Absolute returns are used because raw gold returns have little linear structure (mean absolute autocorrelation over lags 1 to 10 is 0.064 against a noise band of 0.115), while absolute values exhibit volatility clustering, which is what a volatility statistic reads.

 Two bar charts comparing the autocorrelation of the data with a bar-shuffled version and with an IAAFT surrogate

Author: Hammad Dilber