Skip to content
All library documents

Creating Dynamic Indicator Plots in MetaTrader 5

Article MQL5 articles

Summary

This programming tutorial explains how to convert a statically declared MetaTrader 5 indicator into one whose plot settings are configured at runtime. It uses an inside-bar candle display as its example. The static version declares the plot type and colors through compilation properties; removing those declarations leaves the buffers present but gives the platform no instructions for drawing them. The article then shows how plot type, color count, and line colors can instead be set through the indicator API during initialization.

The aim is to make presentation settings changeable in code without recompiling and to demonstrate how an indicator can respond to chart display choices. The examples are instructional code demonstrations, not trading research: they do not evaluate the inside-bar pattern's predictive value, profitability, or transaction costs. The discussion also leaves a limitation unresolved: switching to line-chart mode requires a different approach, which the author postpones. The material is most useful to MQL5 developers working on indicator display behavior.

Key ideas

  • Static plot directives define an indicator's display properties at compile time.
  • Removing those directives leaves buffers without a configured drawing method.
  • MQL5 plot settings can be configured dynamically through standard library calls.
  • Dynamic configuration can change presentation without recompiling the indicator.
  • The tutorial does not test whether the displayed inside-bar pattern is profitable.

Tags

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