Skip to content
All library documents

Configuring Custom Levels for a Moving Average Indicator

Article MQL5 code base

Summary

This document describes an MQL5 example for adding two user-specified levels to a moving average indicator. The example creates the custom indicator through the platform’s custom-indicator interface, passes the moving-average settings and two level values, checks whether initialization succeeded, and then adds the indicator to the chart. The demonstrated level values are positive and negative offsets.

The material is mainly an implementation example rather than a trading method. It shows how a developer can make levels configurable when calling an indicator and how to handle a failed indicator handle. It gives no rules for interpreting the levels, no market examples, and no performance evidence. The moving-average calculation and the meaning or units of the levels are not explained in detail, so users would need the indicator’s own documentation or source to assess how the settings behave.

Key ideas

  • The example adds two configurable levels to a moving average indicator.
  • An expert advisor passes the moving-average parameters and level values when creating the custom indicator.
  • The example checks the returned handle and stops initialization if creation fails.
  • The indicator is added to the chart after successful initialization.
  • The document provides no trading signals or evidence that the levels improve results.

Tags

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