What MQL4 error 4060 means
The official MQL4 runtime table names error 4060 ERR_FUNCTION_NOT_ALLOWED and defines it as “function is not allowed for call.” The operation is unavailable from the current MQL4 program type, handler, tester mode, or terminal context.
The error number is evidence about one failed call, not a diagnosis of the whole EA. Read the API sentinel first, then call GetLastError immediately because that function returns the current _LastError value and resets it.
