Will operation of OrderSend and OrderClose successfully done but return false due to bad network in MT4?
In MT4, OrderSend() and OrderClose() send instructions to server, the server do the trade instructions and return a response. But, if the server do the trade instructions successfully but the response come back to client lost due to bad network, OrderSend() and OrderClose() should return false. This means the operations successfully done but functions get a bad return code. What should an EA do when this happen to avoid such bad logic? Thanks!
- Register a Server - Virtual Hosting for 24/7 Operation
- Extended Authentication - Accounts - MetaTrader 5 for iPhone
- Types of Execution - Trading Principles - Trade - MetaTrader 5 for iPhone
OrderSend() returns a ticket number if successful or -1 if it fails.
So if there is no connection OrderSend() will return -1 and you can get additional information by calling the GetLastError() function.
OrderClose() returns true or false and will also return false in case of no connection.
Some robots will keep trying to close the order or will give off Alert() or Playsound() depending on how it was coded.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register