An independent plugin for AmiBroker · built for serious traders Documentation & support →

Polynomial Interpolation

A least-squares polynomial fit that smooths a series with almost no lag — responsiveness comparable to the Jurik MA, fast enough for intraday.

Polynomial Interpolation

Polynomial interpolation fits a smooth curve of a chosen degree through a window of recent bars and reads off its value at the most recent point. A degree-2 polynomial is a parabola, degree-3 adds an inflection, and higher degrees follow finer detail. Because the fit is least-squares — the curve that sits as close as possible to every bar in the window rather than threading through each one — the result is a de-noised, low-lag estimate of where the series really is, far less jumpy than the raw data. Its smoothing-versus-responsiveness trade-off is comparable to the well-known Jurik moving average, and the implementation is fast enough to run on intraday data without slowing AmiBroker down.

A degree-3 polynomial fitted through a rolling window, tracking price with almost no lag

How the Toolbox does it

The Toolbox ships a ready-made Polynomial Interpolation chart that plots the fitted curve over price; you set the look-back, the polynomial degree and an extra smoothing length from its parameters. Under the hood it uses an orthogonal-polynomial method, which keeps the fit numerically stable even at higher degrees. A companion Polynomial Bands formula plots a channel around the same curve. The calculation is also exposed as a single AFL function — PolynomialInterpolation(DataArray, Periods, Degree) — so you can fit a curve to price or to any indicator inside your own formula.

How you would use it

Use it as a responsive, low-lag alternative to a moving average, to smooth a noisy oscillator before you act on it, or to read the current slope or curvature of price. A large look-back with a low degree behaves like a gentle moving average; a shorter window with a higher degree hugs price more closely. Keep the degree low — 2 to 4 — for a smooth, stable curve, and make sure the look-back is at least as large as the degree.

More Smoothing & adaptive