Building Custom Indicators and Accessing Their Buffers in MetaTrader
Summary
This technical guide explains how MetaTrader custom indicators are configured, displayed, and called by other programs. It describes choosing the main chart or a separate window, setting scale limits, declaring indicator buffers, and assigning colors. An Ichimoku example shows how initialization and calculation routines connect buffers to lines, shifts, labels, and rolling calculations, including handling bars already counted on prior updates.
The article also explains how an Expert Advisor can retrieve a custom indicator's buffer with iCustom, including the order for passing indicator inputs and selecting a buffer and bar shift. The example demonstrates how defaults may be used when inputs are omitted, while warning that explicit parameter sets are preferable when the same indicator is called in multiple configurations. This is a programming reference rather than a trading method: it provides no strategy evaluation or evidence about indicator effectiveness. Its advice is specific to MetaTrader's indicator interface, and excessive or poorly written indicators can slow the terminal.
Key ideas
- A custom indicator must be assigned to either the chart window or a separate window.
- Indicator buffers hold the values used to draw indicator outputs, and their styles and shifts control presentation.
- Calculation routines can limit work to bars that have not already been processed.
- Expert Advisors can retrieve indicator buffer values and pass custom inputs through iCustom.
- Using many indicators or inefficient indicator code can reduce terminal performance.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.