A function (and variable _LastError
) that returns the last runtime error code in an MQL program. After any MQL call that may fail (e.g. trade functions), check GetLastError()
to see if an error occurred and what code was returned. This helps catch issues like trade execution failures or invalid parameters.