Skip to content
All library documents

Adding Buy and Sell Alerts to a Color-Coded Moving Average

Article MQL5 code base

Summary

This indicator modification adds configurable alerts to a color-coded moving average. Users can choose whether signals mark only a color change, representing a breakout, or also report an ongoing trend. Other inputs control which bar is checked, the number of alerts, and whether notifications use sound, email, or mobile push messages. The buy and sell routines inspect the indicator’s color buffer and use price, spread, symbol, and chart timeframe information when composing alerts.

The article explains where to place the signal calls in the indicator calculation flow and notes that the moving average’s color values distinguish rising from falling states. It assumes one call to each signal routine and depends on an external smoothing library. The material focuses on alert wiring rather than evaluating the moving average as a strategy: it supplies no profitability or false-signal evidence, and alert behavior depends on correct buffer indexing and the chosen bar and signal mode.

Key ideas

  • The indicator can alert on a color transition or on an ongoing moving-average trend.
  • Inputs control the signal mode, bar checked, alert count, and notification channels.
  • Buy and sell routines use the color buffer to identify rising and falling conditions.
  • Alert messages can include price, spread, symbol, time, and chart timeframe information.
  • The article explains implementation points but does not assess trading performance.

Tags

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