MLMA
By LuxAlgoJun 19, 2026
MLMA is a rigorous take on the machine learning moving average: a causal Nadaraya-Watson kernel regression with a Gaussian kernel fits the last 100 bars, and the fitted mean plots as an adaptive smoother wrapped in uncertainty bands at 2.0 residual standard deviations. Every estimate uses the current and prior bars only, so plotted history never repaints. The bands swell where the model struggles to explain recent prices and pull in where it accounts for them, and a dashboard reports slope, price's side of the fit and stretch in σ units.
How to Trade the MLMA?
- Slope color flips: the line paints by its own slope — the directional-bias read — with slope-turn alerts on each change.
- Price crosses the fitted mean: the regime read; optional triangles mark the crossings.
- Band breakout: a push beyond either band is stretch the model cannot explain — momentum or extreme, depending on context.
- Band reversion: crossing back inside the envelope starts the reversion read toward the fitted mean.
The model-driven envelope serves trend and reversion styles alike — a signature shared across the machine learning toolkit.
MLMA Settings
- Source (default close).
- Window Length (default 100): bars the model sees; longer smooths and lags more, shorter hugs price and risks fitting noise.
- Kernel Bandwidth (default 8.0): how quickly a bar's weight decays with age — the role length plays for an EMA.
- Show Uncertainty Bands (default on) with Band Multiplier (default 2.0): envelope distance in residual standard deviations.
- Show Dashboard (default on).
- Style toggles: Slope Trend Coloring (on), Uncertainty Gradient Fill (on), Price Crossing Markers (off).
Frequently Asked Questions
Does the MLMA repaint?
No. The regression is evaluated one-sided: each bar's value comes from that bar and older ones only, and is final on close. Kernel fits are often drawn two-sided, refitting history as new bars arrive; this build does not.
How do the bands differ from Bollinger Bands?
Bollinger Bands measure price's dispersion around a fixed-weight average; these bands measure the kernel fit's own residual dispersion under the same weights. They act as a confidence interval on the model, expanding exactly where the smoother is least trustworthy.
What do Window Length and Kernel Bandwidth each control?
The window caps how much history the fit can see; the bandwidth decides how fast weight fades inside it. With the default 8.0, bars more than about twenty back barely register even in a 100-bar window — tune the bandwidth for feel, and enlarge the window only to give a wider bandwidth room.
The Library is free. Quant makes it yours.
Pull any concept or indicator into Quant: rebuild it, retune it, or turn it into a backtested strategy of your own.
