ResetLastError()?

 
What is the work of the ResetLastError() function? Must one get an error to call the ResetLastError() or is it called in anticipation of an error or is it called where an error cannot be tolerated, e.g. where an open order has to close whatsoever in order to open another order to avoid multiple open orders?
 
macpee: What is the work of the ResetError() function? Must one get an error to call the ResetError() or is it called in anticipation of an error or is it called where an error cannot be tolerated, e.g. where an open order has to close whatsoever in order to open another order to avoid multiple open orders?

Do you mean ResetLastError?

It is to "clear" the previously reported error, so that you can detect and respond to the next error going forward.

ResetLastError - Common Functions - MQL4 Reference
ResetLastError - Common Functions - MQL4 Reference
  • docs.mql4.com
ResetLastError - Common Functions - MQL4 Reference
 

Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (MT5/MT4+strict), it is trying to help you.
          What are Function return values ? How do I use them ? - MQL4 programming forum (2012)
          Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles (2014)

Only those functions that return a value (e.g. iClose, MarketInfo, etc.) must you call ResetLastError before in order to check after.

 
Fernando Carreiro #:

Do you mean ResetLastError?

It is to "clear" the previously reported error, so that you can detect and respond to the next error going forward.

Thanks for the correction. I mean ResetLastError(). Thanks for the answer.