Skip to content
All library documents

Hull Moving Average Calculation and Slope-Based Coloring

Article MQL5 code base

Summary

This document explains a custom Hull Moving Average indicator calculated from closing prices. For each bar, it computes weighted moving averages over the full period and half period, doubles the half-period average and subtracts the full-period average, then smooths that difference with another weighted average over the square root of the period. The indicator exposes period, color mode, single-line color, and historical-bar limit settings.

In multicolor mode, the line is green when its value rises, red when it falls, and gray when unchanged; single-color mode uses a selected color. The included implementation shows the calculation and display logic, but provides no trading rules, tests, or performance evidence. Its usefulness as a signal therefore remains unassessed, and the displayed slope only describes recent indicator direction. The code also contains implementation choices, including integer division for the half period and history limits, that users should check for their intended platform and data range.

Key ideas

  • The Hull Moving Average smooths a weighted average of the difference between half-period and full-period averages.
  • A final weighted average over the square root of the chosen period produces the displayed line.
  • The indicator can use a fixed color or show rising and falling slopes with different colors.
  • The document provides implementation details but no evidence that the indicator predicts returns or improves a strategy.

Tags

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