Hello,
I am experiencing a critical compiler bug in MetaEditor build 5147. The compiler consistently fails on 100% syntactically correct MQL5 code, producing basic errors like "object required" and "; - unexpected token".
I have performed extensive troubleshooting to isolate the issue, including the following steps:
-
Tested multiple versions of a complex Expert Advisor. The error persisted, appearing on different, but always correct, lines of code.
-
Performed a full, clean reinstallation of the MetaTrader 5 platform using the latest installer from the official website. This was done after restarting the PC and with antivirus software disabled. The problem remained.
-
To definitively isolate the failure point, a minimal validation script ( SystemValidator.mq5 , code provided below) was created.
This minimal script also failed to compile. The error occurs specifically when trying to access the predefined __MQL5__ structure, which is a fundamental part of the MQL5 language. This proves that the compiler itself is faulty and cannot process basic language constructs on my system. The issue is not with the MQL5 code, but with the compiler environment's interaction with my OS.
Please investigate this issue.
Technical Details:
-
MetaEditor Version: Version: 5.00 build 5147
-
Operating System Information:
-
Edition: Windows 11 Pro
-
Version: 24H2
-
OS Build: 26100.4652
-
Installation Date: 13.07.2025
-
Error Messages and Proof:
The error occurs on line 19 of the
SystemValidator.mq5 script.
-
The Failing Line: PrintFormat("MQL5 Version: %d", __MQL5__.version);
-
Error Messages: object required ,
';' - unexpected token
(I have attached the screenshot of the compilation log for SystemValidator.mq5 which shows these errors.)
Minimal Code That Causes the Error:
The issue is with the use of MQL5. __MQL5__ is not a structure (struct) with members (.version, .build) in MQL5, but only a macro defined for conditional compilation (#ifdef). Therefore, accesses such as __MQL5__.version result in a compilation error.
To obtain version and build information, you need to use the TerminalInfoInteger() function. Modify the relevant lines as follows:
// INCORRECT:
PrintFormat(“MQL5 Version: %d”, MQL5.version);
PrintFormat(“MQL5 Build: %d”, MQL5.build);
// CORRECT:
PrintFormat(“Terminal Build: %d”, TerminalInfoInteger(TERMINAL_BUILD));
PrintFormat(“Program Name: %s”, MQLInfoString(MQL_PROGRAM_NAME));
In short, MQL5 is only used in controls such as #ifdef _MQL5_ and has no submembers. The TerminalInfoInteger() and TerminalInfoString() functions are the correct way to obtain terminal/build information.
//////////////////////////////////////////////////
The format required for the sample line of code you shared is as follows.
//+------------------------------------------------------------------+ //| SystemValidator.mq5 | //| A minimal script to test core MQL5 compiler functions. | //+------------------------------------------------------------------+ #property version "1.00" #property description "Tests compiler stability for basic functions." //--- Global Variables string G_LABEL_NAME = "ValidatorLabel"; int g_tick_counter = 0; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { // --- Test 1: Terminal ve Program Bilgileri --- Print("--- System Validator Script Started ---"); PrintFormat("Terminal Build: %d", TerminalInfoInteger(TERMINAL_BUILD)); PrintFormat("Terminal Name: %s", TerminalInfoString(TERMINAL_NAME)); PrintFormat("Program Name: %s", MQLInfoString(MQL_PROGRAM_NAME)); // --- Test 2: Basic Object Creation --- ObjectCreate(0, G_LABEL_NAME, OBJ_LABEL, 0, 0, 0); ObjectSetInteger(0, G_LABEL_NAME, OBJPROP_CORNER, CORNER_RIGHT_UPPER); ObjectSetInteger(0, G_LABEL_NAME, OBJPROP_XDISTANCE, 20); ObjectSetInteger(0, G_LABEL_NAME, OBJPROP_YDISTANCE, 20); // Cleanup ObjectDelete(0, G_LABEL_NAME); Print("--- System Validator Script Finished ---"); }Good Luck !
- Ücretsiz alım-satım uygulamaları
- İşlem kopyalama için 8.000'den fazla sinyal
- Finansal piyasaları keşfetmek için ekonomik haberler
Web sitesi politikasını ve kullanım şartlarını kabul edersiniz
Hello,
I am experiencing a critical compiler bug in MetaEditor build 5147. The compiler consistently fails on 100% syntactically correct MQL5 code, producing basic errors like "object required" and "; - unexpected token".
I have performed extensive troubleshooting to isolate the issue, including the following steps:
Tested multiple versions of a complex Expert Advisor. The error persisted, appearing on different, but always correct, lines of code.
Performed a full, clean reinstallation of the MetaTrader 5 platform using the latest installer from the official website. This was done after restarting the PC and with antivirus software disabled. The problem remained.
To definitively isolate the failure point, a minimal validation script ( SystemValidator.mq5 , code provided below) was created.
This minimal script also failed to compile. The error occurs specifically when trying to access the predefined __MQL5__ structure, which is a fundamental part of the MQL5 language. This proves that the compiler itself is faulty and cannot process basic language constructs on my system. The issue is not with the MQL5 code, but with the compiler environment's interaction with my OS.
Please investigate this issue.
Technical Details:
MetaEditor Version: Version: 5.00 build 5147
Operating System Information:
Edition: Windows 11 Pro
Version: 24H2
OS Build: 26100.4652
Installation Date: 13.07.2025
Error Messages and Proof:
The error occurs on line 19 of the
SystemValidator.mq5 script.
The Failing Line: PrintFormat("MQL5 Version: %d", __MQL5__.version);
Error Messages: object required ,
';' - unexpected token
(I have attached the screenshot of the compilation log for SystemValidator.mq5 which shows these errors.)
Minimal Code That Causes the Error: