Turnmarks

Least squares

Every other construction chooses a shape and then discovers what it does. This one starts from the other end: say what response you want, including how much delay you are willing to accept, and solve for the coefficients that come closest.

Build one

Lag, noise gain, peak gain and leak are defined on the comparison page — the tool sits above the article deliberately, so the numbers arrive before the prose that explains them.

How it works

Write down the response you would like — pass everything slower than some period with a stated delay, reject everything faster than another — and you have a target. The taps that come closest to it in the least-squares sense are the solution to a linear system, and a browser solves it in milliseconds.

Two details matter. The requirement that the taps sum to one is a hard constraint rather than a penalty, so the filter passes a flat price unchanged exactly rather than nearly. And a ridge term keeps the solution from running away at short delays, where the unregularised answer buys speed with enormous coefficients that cancel: the mathematical version of standing on a chair to reach further.

What it costs

Rejection is bought with tap energy, and tap energy is noise gain. That is the family's characteristic bill, and both halves of it are real: against a window sitting at the same distance behind price, a solved design rejects far more and costs substantially more noise doing it.

What it is not is a clean sweep. T3 leaks less than any of these three and costs a fraction of the noise, and Hull's noise gain is higher than two of them. Those filters simply sit at their own fixed lag and cannot be moved off it, which is the actual difference and the subject of the last section on this page.

What our measurements say

The three characters the generator offers, and the rest of the table for scale:

Least squares at period 24, measured the same way as every other filter here. Green is the best in that column, and less is better in all of them. Each name is a link, and loads that filter into the dials above.
Filter Lag Noise Peak Leak vs an EMA of the same lag
ours, Fast4.380.24541.5700.01026leak 0.0713× · noise 2.40×
ours, Balanced7.660.15141.0620.00169leak 0.0195× · noise 2.47×
ours, Smooth18.500.12991.0040.00154leak 0.0415× · noise 4.94×

Within this family the shortest lag here is ours, Fast at 4.38 bars and the least leak is ours, Smooth at 0.00154, and they are not the same filter: ours, Fast leaks 0.01026 to buy that speed, and ours, Smooth sits 18.50 bars back to buy that quiet. Leak is measured over periods of 4.0 bars and shorter, the same band as every other page in this section, so the rows can be read against the full table. The table happens to contain one pair that isolates this: ours, Balanced and WMA sit 7.66 and 7.67 bars behind price, near enough to the same place to compare directly, and at that shared delay ours, Balanced leaks 0.0298 times what WMA does for 2.78 times the noise gain.

Where this family loses

It loses on noise, always, and it is worth being specific about to whom. At around five bars of lag, Ehlers' SuperSmoother rejects less than a least-squares design does but costs no more noise than a plain exponential average, so if noise is what you care about it is simply the better filter there. T3 rejects more than anything else in the table — it holds the lowest leak on the page — at a fraction of the noise gain.

What this construction offers is not a better filter. It is the delay as a dial: state the lag you can live with, get the best available rejection at exactly that lag, with the bill printed. Each fixed construction occupies one point on that curve and cannot be moved along it.

The other constructions