Reading Custom Indicator Values in a MetaTrader Expert Advisor
Summary
This tutorial explains how a MetaTrader 5 Expert Advisor can obtain values from a custom indicator. VWAP serves as the example: the indicator calculates a daily volume-weighted price and assigns itself a short name so the EA can identify it on the chart. The EA can then retrieve its handle and copy values from its data buffer.
The article also shows the alternative of creating an indicator handle from the EA when the indicator is not already on the chart, and describes adding custom indicators to a chart. A pair of moving averages illustrates how to pass indicator parameters when requesting handles. The examples focus on integration and data access rather than a trading rule or performance evaluation. Correct indicator naming, buffer selection, handle validity and parameter matching are necessary for the EA to read the intended values; the article does not assess the reliability or profitability of strategies built from them.
Key ideas
- A custom indicator should set a meaningful short name that an Expert Advisor can use to find it on a chart.
- An EA can read indicator output by obtaining a handle and copying values from its buffer.
- If the indicator is not present, the EA can create a handle for it directly.
- Custom indicator parameters can be supplied when creating the handle.
- The examples teach platform integration and do not establish a trading strategy's performance.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.