How to check _LastError variable while debugging?

 

In new versions of MetaTrader 5 it is impossible to check system variables from the debugger.

How to check _LastError variable while debugging? Or do you need to print it after each line of code?

 
As _LastError (like _Point) is not (any more) recognised by the debugger you have to declare a global variable and assign _LastError to it. This variable you can track in the debugger.
 
In MetaTrader 5, the _LastError system variable cannot be directly checked in the debugger because it is an internal system variable that updates after certain function calls.

The easiest way to track _LastError while debugging is to print its value right after the function calls. Sample code...

int result = OrderSend(request);
Print("OrderSend result: ", result, " | _LastError: ", _LastError);