Develop custom MQL5 indicators with proper patterns. Use when creating indicators, debugging OnCalculate(), working with buffers, or implementing multi-timeframe indicators in MetaTrader 5.
Limited to specific tools
Additional assets for this skill
This skill is limited to using the following tools:
references/buffer-patterns.mdreferences/complete-template.mdreferences/debugging.mdreferences/display-scale.mdreferences/recalculation.mdBattle-tested patterns for creating custom MQL5 indicators with proper display, buffer management, and real-time updates.
Display Scale (for small values < 1.0):
IndicatorSetDouble(INDICATOR_MINIMUM, 0.0);
IndicatorSetDouble(INDICATOR_MAXIMUM, 0.1);
Buffer Setup (visible + hidden):
SetIndexBuffer(0, BufVisible, INDICATOR_DATA); // Visible
SetIndexBuffer(1, BufHidden, INDICATOR_CALCULATIONS); // Hidden
New Bar Detection (prevents drift):
static int last_processed_bar = -1;
bool is_new_bar = (i > last_processed_bar);
Warmup Calculation:
int StartCalcPosition = underlying_warmup + own_warmup;
PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, StartCalcPosition);
Blank Display: Set explicit scale (see Display Scale reference)
Rolling Window Drift: Use new bar detection with hidden buffer (see Recalculation reference)
Misaligned Plots: Calculate correct PLOT_DRAW_BEGIN (see Complete Template reference)
Forward-Indexed Arrays: Always set ArraySetAsSeries(buffer, false)
For production MQL5 indicators:
These patterns solve the most common indicator development issues encountered in real-world MT5 development.
For detailed information, see: