Error Handling. Does Anyone Have A Great Example - page 3

 
WHRoeder:

https://www.mql5.com/en/forum/133792

The biggest problem trying to handle ordersend errors is No Result. You don't know wither the trade opened or not. My approach is to just return after logging for all errors. On the next tick, the orderSelect loop will tell me what orders are open and I can retry failed ones. Also by then transient errors (server is busy) should be gone. I assume that as soon as I issue the orderSend call, my PC crashes/reboots. On the next tick, the EA must be able to recover.


Hello

In my code, there are trigger conditions (variables) for opening and closing orders that wont exist on the next tick. Am I correct in thinking that your approach above will not work with the logic in my code?

 

HarriMQL4:

In my code, there are trigger conditions (variables) for opening and closing orders that wont exist on the next tick. Am I correct in thinking that your approach above will not work with the logic in my code?


By itself, of course not. If you get an error, remember it. On the next tick, if the order hasn't opened, and you were an retry mode, and the market is near to your open point (not many candles later because of a disconnect) retry it. I personally don't bother, if I've missed it, I've missed it, I'll wait for a new opportunity.