Robust Statistics for Price Indicators Using Median, MAD, and Theil–Sen
Summary
The article explains why price indicators based on the mean, standard deviation, and least-squares slope can be distorted by a small number of extreme observations. It presents median and median absolute deviation (MAD) as more resistant alternatives for a rolling window, scaling MAD by 1.4826 to make it comparable to standard deviation for normally distributed data. For trend estimation, it uses the Theil–Sen slope, defined as the median of pairwise slopes. The proposed MQL5 library computes these robust estimates alongside classical counterparts on the same window.
The library supports a median/MAD band, a Theil–Sen trend channel, a MAD-normalized oscillator, and a visual comparison with classical bands. The article discusses breakdown points and a contamination demonstration as evidence of statistical resistance to outliers, while explicitly separating that property from trading profitability. It also identifies an implementation tradeoff: exact Theil–Sen calculation has quadratic cost in window size. The described estimators address contamination, but do not establish that replacing classical indicators improves a trading strategy.
Key ideas
- A single extreme observation can strongly distort the mean, standard deviation, and least-squares slope.
- The median and MAD have a 50% breakdown point, while the article gives a roughly 29% breakdown point for Theil–Sen slope.
- Scaling MAD by 1.4826 makes it comparable to standard deviation for clean, normally distributed data.
- The shared library computes robust estimators and classical counterparts over the same rolling window.
- Exact Theil–Sen estimation has quadratic computational cost, and robustness alone does not imply profitability.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.