Check initialization before appearance
Read the Experts and Journal tabs for OnInit failures. An INVALID_HANDLE dependency, failed buffer binding, or rejected input can prevent the indicator from reaching its calculation path.
MQL5 custom indicator diagnosis
When an MQL5 indicator is not showing on the chart, first confirm that OnInit succeeds and OnCalculate runs. Then verify the chart or separate-window property, indicator buffer and plot counts, SetIndexBuffer mappings, draw type, visible color, and calculated values. The official OnCalculate reference notes that returning zero hides values from the Data Window.
Open the Coding Agent and choose MQL5 from the language menu.
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots 1
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrDodgerBlue
double Output[];
int OnInit()
{
return SetIndexBuffer(0,Output,INDICATOR_DATA)
? INIT_SUCCEEDED : INIT_FAILED;
}
int OnCalculate(const int rates_total,const int prev_calculated,
const int begin,const double &price[])
{
for(int i=MathMax(prev_calculated-1,begin);i<rates_total;i++)
Output[i]=price[i];
return rates_total;
}Read the Experts and Journal tabs for OnInit failures. An INVALID_HANDLE dependency, failed buffer binding, or rejected input can prevent the indicator from reaching its calculation path.
MQL5 indicator properties define whether output belongs in the chart or a separate window and how many buffers and plots exist. SetIndexBuffer indexes start at zero even though property numbering starts at one.
Log rates_total and prev_calculated over a small interval. Ensure the loop reaches valid indexes, writes finite values rather than EMPTY_VALUE for the visible region, and returns rates_total. If source data comes from another handle, require BarsCalculated and check CopyBuffer counts.
This minimal indicator declares one plot and one buffer, binds them, writes finite prices, and returns rates_total. Compare each contract with the non-rendering indicator.
A clean compile or a cleared error code does not prove strategy logic, broker compatibility, backtest quality, or live-trading safety. Reproduce the result in the target MetaTrader 5 terminal and account environment.
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots 1
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrDodgerBlue
double Output[];
int OnInit()
{
return SetIndexBuffer(0,Output,INDICATOR_DATA)
? INIT_SUCCEEDED : INIT_FAILED;
}
int OnCalculate(const int rates_total,const int prev_calculated,
const int begin,const double &price[])
{
for(int i=MathMax(prev_calculated-1,begin);i<rates_total;i++)
Output[i]=price[i];
return rates_total;
}Pineify can generate or revise MQL5 source and use MQL5 compilation diagnostics during the coding workflow. Keep the exact error, source location, program type, and intended behavior in the request so the change remains reviewable.
Open MQL5 Coding AgentPineify does not run your broker terminal, Strategy Tester, market data, or live orders. Validate the final program in your own MetaTrader 5 environment.
Review MQL5 AI Coding Agent capabilities
Confirm OnInit returns INIT_SUCCEEDED and every handle or SetIndexBuffer call succeeds.
Match the window, buffer count, plot count, draw type, color, and SetIndexBuffer indexes.
Log rates_total, prev_calculated, loop bounds, source readiness, and the number of output values written.
Use a simple known series, return rates_total, attach to a fresh chart, and then restore the original calculation in stages.
Check failed initialization, incorrect window or plot properties, unbound buffers, an OnCalculate signature or return issue, invalid loop bounds, and output containing only EMPTY_VALUE or non-finite values.
The official OnCalculate reference says returning zero prevents indicator values from being shown in the Data Window. A normal completed calculation usually returns rates_total.
Treat INVALID_HANDLE as initialization failure and inspect GetLastError. Runtime error 4802 means the indicator cannot be created.
Last verified against the linked official references on . Compile and test the final source in the MetaTrader 5 build, broker, symbol, and account environment you plan to use.
Provide the exact diagnostic and intended behavior, inspect the generated change, compile it, and verify it in your MT5 test environment.
Open MQL5 Coding Agent