- GetLastError()=0
- Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6.
- The Only Pivot
How would you distinguish the source?
How would you distinguish the source?
Yes, that was my thought that the old code will be present until a new error occurres.
I do not understand what you mean with "How would you distinguish the source?"
Don't look at the last error unless your function call returns an error; you always know the source.
Only those functions that return a value (e.g. iClose, MarketInfo, etc.) must you call ResetLastError before in order to check after.
Only those functions that return a value (e.g. iClose, MarketInfo, etc.) must you call ResetLastError before in order to check after.
- You call a function that sets Last Error.
- You then call iClose, MarketInfo, etc.
- If you now attempt to see if that call failed, you will read the № 1 error code when it succeeds.
You must you call ResetLastError before in order to check after. For all the other calls, they return a status value. You only need to check Last Error if you actually have an error.
What are Function return values ? How do I use them ? - MQL4 programming forum 2012.05.20
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles 25 March 2014

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use