Skip to content
All library documents

Building MetaTrader 5 Signals and Trailing Rules from Custom Indicators

Article MQL5 code base

Summary

This document explains a proof-of-concept MQL5 library that lets MetaTrader 5 Expert Advisors generate buy, sell, exit, and trailing-stop or take-profit actions from standard or custom indicators. Users can configure explicit indicators in input groups or define indicators inline, then combine their values with built-in conditions or mathematical expressions. The expressions can also access price series, symbol properties, global variables, and indicator buffers.

The article walks through configuring the modules in MetaEditor’s Expert Advisor wizard and gives a custom signal-indicator example. It explains how to handle indicators that use zero rather than an empty-value marker for bars without signals, and how to pass indicator parameters. The library is explicitly incomplete: it is a proof of concept, supports at most 20 parameters per custom indicator, and does not support stop or limit orders through its indicator core. The example demonstrates configuration, not a validated strategy or evidence of trading performance.

Key ideas

  • The library lets Expert Advisors define entries, exits, and trailing adjustments from configurable indicator signals.
  • Signals can use explicit or inline indicators and can evaluate mathematical expressions.
  • Expressions can reference historical price series, symbol properties, and indicator values.
  • The example shows how to adapt signal checks when an indicator uses zero for empty bars.
  • The proof-of-concept library has limits, including no stop or limit order support in its indicator core.

Tags

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