_LastError

Type

int

Description

The _LastError variable holds the error code of the most recent operation executed by the MQL4 program. This allows developers to check for and handle errors that occur during program execution.

Resetting

The value of _LastError can be explicitly reset to zero using the ResetLastError() function.

Retrieval

Alternatively, the error code can be obtained using the GetLastError() function, which provides the same information as _LastError.

Related Functions/Variables

  • ResetLastError(): Resets the last error code to zero.
  • GetLastError(): Retrieves the last error code.
  • Error Codes: A reference to predefined error codes.
  • Context

    This variable is part of the MQL4 language, used for developing trading robots, custom indicators, and scripts on the MetaTrader 4 platform.