MQL5 preprocessor question

Does #property strict Cause an Error in MQL5 Compilation?

Yes, current MetaEditor can report #property strict as an unknown MQL5 property because strict is not listed among current MQL5 program properties. Remove that directive from an MQL5 file, then fix any remaining diagnostics on their own terms. This does not turn MQL5 into a permissive language or justify suppressing type and conversion errors.

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

Current MQL5 property pattern.mq5
#property copyright "Your name"
#property link      "https://example.com"
#property version   "1.00"

// Do not add #property strict to an MQL5 source file.
int OnInit()
  {
   return INIT_SUCCEEDED;
  }
  • Directive: not a current MQL5 property
  • Possible diagnostic: unknown property (288)
  • Repair: remove only the directive
  • Then: recompile and fix remaining errors

Also searched as: does property strict cause error in mql5 compilation.

Why the directive is flagged

The MQL5 preprocessor accepts #property, but each property name must be recognized. The official compilation table defines code 288 as unknown property, and the current MQL5 program-property list does not include strict.

This is different from a type mismatch elsewhere in the program. Removing one unsupported property does not repair invalid assignments, conversions, calls, or declarations.

Safe migration from older snippets

When a source file was adapted from MQL4 or an old forum example, remove #property strict and compile immediately. Then treat every remaining message as an MQL5 migration issue.

  • Confirm the file extension is .mq5 and MetaEditor belongs to MetaTrader 5.
  • Replace MQL4 trade and indicator APIs with their MQL5 contracts.
  • Keep documented #property directives that define version or indicator presentation.
  • Do not mass-delete warnings or casts to make the output quiet.

Verify the result

Compile after removing only the unsupported directive. If the diagnostic moves to another line, solve that new source issue directly. A successful compile still requires runtime and Strategy Tester checks.

Use a focused diagnostic

The example uses documented MQL5 program properties and omits strict. Indicator files should add their documented window, buffer, and plot properties as needed.

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.

Current MQL5 property pattern.mq5
#property copyright "Your name"
#property link      "https://example.com"
#property version   "1.00"

// Do not add #property strict to an MQL5 source file.
int OnInit()
  {
   return INIT_SUCCEEDED;
  }
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

    Confirm the target language

    Verify the file is .mq5 and is being compiled by MetaEditor 5.

  2. 2

    Remove #property strict

    Delete only the unsupported directive and preserve other documented program properties.

  3. 3

    Compile again

    Press F7 and read the new first diagnostic instead of assuming all errors came from strict.

  4. 4

    Test the migrated program

    Exercise initialization, event handlers, data access, and trade requests in the target MT5 environment.

Frequently asked questions

Does #property strict cause an error in MQL5 compilation?

It can. Current MQL5 documentation does not list strict as a supported program property, and compiler code 288 means unknown property.

Will removing #property strict hide type errors?

No. MQL5 compiler rules still apply. Type mismatch, invalid conversion, and function-contract diagnostics must still be repaired.

Should I remove every #property directive?

No. Keep supported properties such as version and the indicator window, buffer, and plot declarations required by the program.

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