Error handling - what to expect

 
It's been a week since i finished coding my ea and the only part that's been missing is the error handling, i do researched for error handlings in this forum but if not all-then most of them are more than 7+ years old and i think it wouldn't be a good idea to rely on them. 

For ea gods out there, what are the expected errors could i expect from running my ea live, and how do i start from error handling? Any leads and answers would be much appreciated. Thank you :)
 
Renz Carillo:
It's been a week since i finished coding my ea and the only part that's been missing is the error handling, i do researched for error handlings in this forum but if not all-then most of them are more than 7+ years old and i think it wouldn't be a good idea to rely on them. 

For ea gods out there, what are the expected errors could i expect from running my ea live, and how do i start from error handling? Any leads and answers would be much appreciated. Thank you :)

Besides the standard Error handling (_LastError) make sure your EA can handle a restart. IE resume trading normally after a disconnect.

 
Enrique Dangeroux:

Besides the standard Error handling (_LastError) make sure your EA can handle a restart. IE resume trading normally after a disconnect.

This is really helpful, thank you!
 
Sorry i mean terminal restart, not disconnect. This you can easily simulate by removing the EA after it has opened trades, and attaching the EA again. Or even simpler recompile while the EA is running.
 

Always check errors when you are retrieving a handle, by looking at return codes or if the handle is invalid, then query _LastError resp GetLastError() (it's the same).

Also check trade server return codes when opening or changing an order/position.

Reason: