Join Tallinex - Trade Smarter!

MQL4 Reference MQL4 programs Runtime Errors

Runtime Errors

The executing subsystem of the client terminal has an opportunity to save the error code in case it occurs during a MQL4 program run. There is a predefined variable _LastError for each executable MQL4 program.

Before starting the OnInit function, the _LastError variable is reset. In case an erroneous situation occurs during calculations or in the process of internal function calls, the _LastError variable accepts a corresponding error code. The value stored in this variable can be obtained using the GetLastError() function.

There are several critical errors in case of which a program is terminated immediately:

division by zero

going beyond array boundary

using an incorrect object pointer