NavigationUser loginWho's new
Who's onlineThere are currently 1 user and 60 guests online.
Online users:
|
Checkup FunctionsHi folks, Today we are going to study some of important function that MetaTrader has grouped them under the topic "Checkup Functions". The Checkup functions are a set of functions that are telling you some of useful information about the current statue of the client terminal (for example is dlls calling allowed or not and is the expert advisor allowed or not ) and the MQL4 environment (for example what's the last error has been occurred and is the trade context busy or not). Let's go ahead and study this group of functions!
GetLastErrorSyntax:
Description: The GetLastError function returns the code last error occurred during the execution of the MQL4 program or zero if there was nor errors. After that (after calling it) the last error be set back to zero. We are going to set aside a separated article for MQL4 error tracking! Note: To get a text representation of the error code you can use the function ErrorDescription(), but don't to forget to include stdlib.mqh Note: All of the Checkup functions don't take any parameters, see the examples! Example:
IsConnectedSyntax:
Description: The IsConnected function tells you if the terminal is connected to the server (True) or not (False). You can use it before any code of your Expert Advisor that needs to be connected to the server first. Example:
IsDemoSyntax:
Description: The IsDemo function tells you if the expert advisor runs in demo (True) or live (False) account. You can use this function for instance to protect you trial expert advisor from working in a live account and work only in a demo account. Example:
IsDllsAllowedSyntax:
Description: The IsDllsAllowed function tells you if the expert advisor is allowed to call dlls (True) or not (False). To allow dlls calling you go to Tools -> Options -> Expert Advisors then check "Allow DLL Imports" . Example:
|