# Some Preliminary Thoughts on the Moving Median, from Victor Niederhoffer

November 25, 2013 |

Some preliminary thoughts on the running median 2, 3, 4, 1, 7, 8, 9, 3.

A moving median of the first 5 is 3, of the next 5 is 4, of the next 5 is 7, of the next 5 is 8– it's a good indicator of trend. First recommended to me 53 years ago by Fred Mosteller, Chairman of Harvard's first statistics dept.

It is more stable than the moving average as outliers are removed from sample. It is easy to compute fast with computers for small running numbers like 5 or 100 by repeated sorts. For higher numbers, you can form two groups, those below the median and those above. As a new number comes up you place it in one of the two groups if higher or lower and take away the oldest number. Then adjust to make the two groups equal again. It is not used as much as the moving average so it shouldn't be hurt by front running or spikes when cross over occur. It has a defined distribution when the underlying distribution has inordinate extreme values as frequently occurs with Cauchy or similar distributions with infinite variance.

It's probably a good thing to use when using nearest neighbors as predictors, i.e using the median and running median to compute your predictors. It deserves testing in real life markets for real life applications.

## Ralph Vince writes:

It is the indicator of "expectation," as evidenced by human behavior itself, and not the probability-weighted mean.

Moving medians have some distinct advantages.

They represent real values that occur. For example, taking the average of 1, 2 and 5 gives you 4, which never occurred, whereas the median 2 did occur. Continuing with the same series, should subsequent values in the series be less than 5, the value of 5 will not occur as a moving median. Hence, the moving median eliminates outliers.

One of my appliances has three thermometers to measure temperature. The value displayed is the median (and hence a series of moving medians). Should one of the thermometers be broken, or distorted by being in a particularly hot or cold spot, the median will still give me the best estimate. This elimination of outliers is very useful.

Should you have data whose importance relies upon only crediting occurring values and need to eliminate outliers, then you should test moving medians. We ourselves had experimented with them regarding price series and written extensively about them, but do not use them in our current work. Our reason is that we consider the outliers in a price series to be particularly important.

The following is a plot ratio of SP500 (10 week moving average) / (10 week moving median) for the recent 5 years (SP500 weekly close data).

`SELECT * FROM wp_comments WHERE comment_post_ID = '8848' AND comment_approved = '1' ORDER BY comment_date`