MQL4 Language Updates
Overview
MQL4 has been completely revised to reach MQL5 levels, enabling the development of trading robots using a unified MetaEditor, single style, libraries, and debugging tools. This revision integrates MQL5 features like OOP and native code compilation while preserving MQL4 functionality. The unified compiler supports both MQL4 and MQL5. MQL5 Storage and enhanced security for EX4 applications are now available.
Key Language Changes
char, short, long, uchar, ushort, uint, ulong, double. Typecasting is implemented.Volume is now long type. Time series for volumes are long type arrays.void type, and this keyword are supported. Features include Encapsulation, Inheritance, Polymorphism, Overload, and Virtual functions.OnInit(), OnDeinit(), OnStart(), OnCalculate(), OnTick(), OnTimer(), OnChartEvent(), OnTester().ArrayCopyRates()**: Behavior changed. New format uses MqlRates structure array. Old format (copying to double[][6]) performs real copying.RateInfo Structure**: Updated format includes fields for spread and trading volume. Old EX4 applications and DLLs based on old RateInfo will not work.#property strict Directive
Introduced for compatibility and enhanced control. When enabled:
datetime**: Depends on compilation mode (Unicode with #property strict).export modifier required for exported functions.File Operations
FILE_SHARE_READ, FILE_SHARE_WRITE).FileWrite* Functions**: Return type changed from int to uint (number of bytes written or 0 on error).File Structure Changes
\experts\ subdirectories.\MQL4\ subdirectories (e.g., MQL4\Experts, MQL4\Indicators, MQL4\Files).Compatibility Notes
RateInfo format require conversion.#include paths might need adjustment.Array out of range errors are more critical in strict mode.
Previous
arrow_back
Mql4 reference