Building a Production-Ready NLMS Adaptive Moving Average in MQL5
Summary
This article turns a normalized least-mean-squares (NLMS) adaptive filter into an MQL5 chart indicator called SAMA. It describes configurable input transformations using prices, differences, or returns; adaptive filter weights; and slope-based line coloring. The implementation includes safeguards intended to make the indicator more stable in live use: parameter checks, a warm-up period, training only on closed bars, optional ATR-based error clamping, optional weight normalization, and a learning rate scaled by an Efficiency Ratio.
The document explains how these components address numerical instability, spikes, and differences caused by the indicator’s history-dependent weight state. It recommends warm-up processing and cautious learning-rate settings, but it presents no performance results or benchmark against conventional moving averages. These safeguards reduce some operational problems without removing path dependence. The article points to a later study for evaluating trading outcomes, so the indicator’s usefulness as a signal remains unproven here.
Key ideas
- The indicator predicts each input from lagged observations and updates its filter weights using an NLMS rule.
- It supports price, price-difference, and percentage-return inputs.
- ATR-based error clamping and optional weight normalization are intended to limit extreme updates and output-scale drift.
- An Efficiency-Ratio adjustment changes the learning rate according to recent directional movement.
- The indicator trains on closed bars and uses warm-up history, but its weights remain path-dependent.
- The article describes implementation safeguards rather than evidence of trading profitability.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.