Unexpected result while testing isConnected()

 

Hello everyone,

To start with I disconnected my internet connection from my computer, then started the test. After I got the result below I went back to the reference manual to see if I had interrupted something in the explanation.

"It returns true if connection to the server was successfully established, otherwise, it returns false


   Failed =IsConnected();
    if(!Failed==true) 
    { 
     Operation(); 
 
    } 
  // Expert body that needs the connection opened 
 
  // Result:          case 4105: Comment("\n No order selected. ");break; 
  // Expected result: case 6: Comment("\n No connection :");break;

Question is. What on earth happened with the switch statement to return incorrectly? 

   switch(GetLastError()) // Condition validation
     {
      case 0: Comment("\n Order Placed Sussesfully :"); break;
      case 1: Comment("\n No error returned, but the result is unknown :");break;
      case 2: Comment("\n Common error :");break;
      case 3: Comment("\n Invalid trade parameters :"); break;
      //case 4:  ERR_SERVER_BUSY Trade server is busy
      //case 5:  ERR_OLD_VERSION Old Version of the client terminal
      case 6: Comment("\n No connection :");break;
      //case 7:  ERR_NOT_ENOUGH_RIGHTS Not enough rights
      //case 8:  ERR_TOO_FREQUENT_REQUESTS Too frequent requests
      //case 9:  ERR_MALFUNCTIONAL_TRADE Malfunctional trade operation
      //case 64:  ERR_ACCOUNT_DISABLED Account disabled
      case 65: Comment("\n Invalid Account :");break;
      //case 128: ERR_TRADE_TIMEOUT Trade timeout
      case 129: Comment("\n Invalid price :");break;
      case 130: Comment("\n Invalid stops :");break;
      //  Invalid trade volume
      case 131: LOT=MarketInfo(Watch,MODE_MINLOT);break; 
      
      // Market is closed
      case 132: ExpertRemove();
      // Trade is disabled
      case 133: ExpertRemove();
      case 134: Comment("\n Selected Account doesn't have enough money :", (string)AccountNumber());break;
      //case 135: ERR_PRICE_CHANGED Price changed
     //case 4105: ERR_NO_ORDER_SELECTED No order selected      
      case 4105: Comment("\n No order selected. ");break; 
    
      //case 4106: ERR_UNKNOWN_SYMBOL Unknown symbol
      //case 4107: ERR_INVALID_PRICE_PARAM Invalid price
      //case 4108: ERR_INVALID_TICKET Invalid ticket
      case 4109: Comment("\n check box: ( Allow Live Trading ) must be checked. ");break;
      case 4110: Comment("\n Check the EA properties;  Only SHORT's are allowed. ");break;
      case 4111: Comment("\n Check the EA properties:  Only LONG's are allowed.  ");break;
 

Like your other post on no result, IsConnected is irrelevant. Unless you are not returning from OnTick (processing multiple symbols in your own loop,) or after a server function (that returned no result,) the function is useless.

You could have already lost connection on the first line of OnTick, but the terminal will not notice, that for ~30 seconds. Until that, the function will return true.