MQL5 compiler diagnostic

MQL5 Compile Error 209: 'OnCalculate' entry point not found for the indicator

MQL5 OnCalculate entry point not found is compiler code 209. An indicator source does not contain either exact documented int OnCalculate signature, or its name, return type, parameter types, references, or const modifiers differ. Copy one official signature exactly and keep it at global scope.

Open the Coding Agent and choose MQL5 from the language menu.

Compiler code 209.mq5
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots   1

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 datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   for(int i=MathMax(prev_calculated-1,0);i<rates_total;i++)
      Output[i]=close[i];
   return rates_total;
  }
  • Diagnostic: 'OnCalculate' entry point not found for the indicator
  • Code: 209
  • Layer: MetaEditor compiler
  • Verify: compile with F7

Read the diagnostic in context

MetaEditor reports 'oncalculate' entry point not found for the indicator when the source cannot satisfy the language or API contract at that location. Compile errors prevent creation of the EX5 program until they are resolved.

Start with the first error in the build output. A missing delimiter, declaration, or include can make later lines produce secondary messages that disappear after the root cause is fixed.

Likely source-level causes

Compare the exact failing line with its declaration and the official reference. Keep the compiler line and column in the repair prompt or issue report.

  • OnCalculate is misspelled or uses the wrong capitalization.
  • The function returns void instead of int.
  • A parameter type, order, reference marker, or const modifier differs.
  • The source is an EA or script pattern but declares indicator properties.

Make the smallest repair

Choose one of the two documented OnCalculate forms and reproduce it exactly. Return rates_total after populating the buffers, and return zero only when the indicator intentionally has no values to show.

Compile after each coherent edit. When the first diagnostic moves or disappears, re-read the remaining list instead of applying stale fixes from the previous build.

Use a focused diagnostic

The handler matches the documented full timeseries signature and returns rates_total. Real indicator logic still needs buffer direction and history guards appropriate to its loop.

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.

Compiler code 209.mq5
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots   1

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 datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   for(int i=MathMax(prev_calculated-1,0);i<rates_total;i++)
      Output[i]=close[i];
   return rates_total;
  }
Where Pineify fits

Repair editable MQL5 source with compiler feedback

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 Agent

Pineify 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
Pineify MQL5 AI Coding Agent with an editable MetaTrader 5 code artifact

A practical verification workflow

  1. 1

    Save the exact diagnostic

    Record the message, code 209, file, line, and column from MetaEditor 5.

  2. 2

    Fix the first root error

    Open the first failing line and inspect the declaration, delimiters, include dependencies, and nearby syntax before touching later messages.

  3. 3

    Apply a local correction

    Choose one of the two documented OnCalculate forms and reproduce it exactly. Return rates_total after populating the buffers, and return zero only when the indicator intentionally has no values to show.

  4. 4

    Recompile and test

    Press F7, confirm the compiler result, then run the EA, indicator, or script in the appropriate MetaTrader 5 test environment.

Frequently asked questions

What does mql5 oncalculate entry point not found mean?

The official MQL5 compilation table defines code 209 as "'OnCalculate' entry point not found for the indicator."

Should I fix every compiler message at once?

No. Fix the first credible root error and compile again. One malformed statement can create several downstream diagnostics.

Does a successful compile prove the EA works?

No. Compilation validates source and type contracts. Runtime behavior, order handling, strategy logic, and broker compatibility require separate tests.

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.

Continue with reviewable MQL5 source

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