Skip to content
All library documents

Building a Hull Moving Average Momentum Oscillator in MQL5

Article MQL5 articles

Summary

The article explains how to create an MQL5 oscillator by calculating price momentum as the difference between a close and the close a chosen number of bars earlier, then smoothing that series with a Hull Moving Average. The HMA is constructed from fast and slow weighted moving averages, a differencing step, and a final weighted average whose period is based on the square root of the smoothing length. The article notes that rounding is used to convert derived periods to integers.

The implementation organizes calculation and display buffers, handles initialization and historical data, and plots a color-changing line around a zero reference with a filled area. Positive and negative readings are distinguished by color. The article describes the indicator’s calculations and visualization, but does not report strategy backtest results or show that its readings predict returns. It cautions that crossings can occur often in flat markets, so the oscillator is better treated as one input alongside other confirmation and risk controls.

Key ideas

  • Raw momentum is the difference between the current close and a close from a selected number of bars earlier.
  • The Hull Moving Average smooths momentum using multiple weighted moving average stages to limit lag.
  • The oscillator’s sign relative to zero indicates positive or negative momentum, with colors used for display.
  • The MQL5 implementation separates calculation buffers from plotted values and visual elements.
  • Frequent zero-line crossings in flat markets limit the value of treating the oscillator as a standalone signal.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.