Build 216 bug ? isConnected() returns false but metatrader still connected - page 3

 
edddim:

Does this could solve the problem..?

string FILE[1];
int MOVE[1];
 
void init() { FILE[0]=Symbol(); }
 
int start()
  {
//---- check connection
   if ( !Connection() ) return(0);
//---- 
   return(0);
  }
 
bool Connection()
  {
   int d;
   bool connect;
   RefreshRates();
   for ( d=0; d<ArraySize(FILE); d++)
    {
     if ( MOVE[d] != MarketInfo(FILE[d],5) )
      {
       MOVE[d] = MarketInfo(FILE[d],5);
       /* if ( !connect ) */
       connect=1;
      }
    }
   return(connect);
  }

thank you edddim!


would you explain your idea in also with words?

 

the problem is not in my code it is in the IsConnected().

Thank you for illumination of your reasons why stay in infinit loop.

Yes, I realize not your code - I was postulating as to series of events which caused Terminal to get itself into code area where it executed some code that precipitated the connection issue.

Since you state that you indeed stay in loop, then is it not possible that Terminal cannot handle this correctly... who knows? but unless one publicizes these ideas nobody will think to consider likelyhood of such an happening, yes?

Again, thanks for your reply.

The support team cannot emulate your issue - so sometimes the sideways thinking is of use...

;)

 

would you explain your idea in also with words?

The idea is to be checked, ...little more complicated presented because it will check incoming tick with time. More can be checked with ArraySize(FILE) bigger, and more accurate would be checking MOVE[d] > MarketInfo(FILE[d],5) as set of other possible functions included with exact pointed change. More simpler version of checking if just connected could be:

int incomeTime = TimeCurrent();
Sleep(1000);
if ( incomeTime <= 0 ) return;
RefreshRates();
if ( incomeTime >= TimeCurrent() ) return;

The situation is if it is more than 1000 Sleep pause would be inaccurate as precision, but if less could be result in receiving the same time as previous, because the time received is in seconds.

The next checking could be if tick is changed, than to be done followed operations.

That is from my point of view.

 
Thanks for this idea, Edddim.

But unfortunately, this doesn't solve the problem since it's pretty inconvenient and not really reliable.

Also, it is checking if the market is open and is not checking the connection to the trading account (If I understood your solution).


I friendly ask you, MetaQuotes, to put some more effort into getting this fixed since it's a critical issue and I am not the only one encountering this.

However, please do not take offense at my requests if you're already working on it.


kind regards,


Daniel.

 

Today, I installed an observer script on my Virtual Server which tells the state of two MT4 station's IsConnected(). With the one of them, MIG Investment, MT4 it stays on !isConnected() after one or two short disconnects eventhough it really is connected.

Could you please, dear MT4 Dev Team, make a bigger test-setup with several different broker's MT4 stations and obverse the isConnected()-state? I am more than certain that you will be able to reproduce this if you put some effort into it!

Most of the available scripts and EAs depend on IsConnected() returning the correct connection status, restarting MT4 all the time is not the work-around I am happy with.

 

Once more. For determinig this problem You should use simple expert

void start()
  {
   if(!IsConnected()) Print("Alarm!!! Connection is lost!");
  }

NOT SCRIPT OR EA WITH ENDLESS LOOP!!!!!!!

If your script reports connection lost, but our EA (see above) keeps silence, then You have global problem with internet (for instance problem with your internet provider's last mile)

If EA prints "Alarm" then we have problem with our connection routine

 

yeah! Stringo is answering again, thanks a lot.

However, this is what it is! I tried it with this kind of simple loop-less EAs/scripts.

Btw, I am definitely positive that I am not having a problem with my internet since it's tested on my private network and on a virtual server.

The thing is that I can trade and everything seems and _is_ ok but isConnected() still returns FALSE

 

Trade operation initializes its own connect with trade server.

IsConnected() shows pumping data connection status.

1. Is connection indicator (right-bottom corner) red or dark?

2. What broker are You connected to?

3. What operating system installed on your virtual server?

 

thanks for your quick reply, here my answers:

1. It's green-red as usual

2. MIG Investments

3. On my virtual server, Windows Server 2003 is installed. On my home desktop which occasionally shows the same issue WinXP.

 
stringo:

Once more. For determinig this problem You should use simple expert

void start()
  {
   if(!IsConnected()) Print("Alarm!!! Connection is lost!");
  }

NOT SCRIPT OR EA WITH ENDLESS LOOP!!!!!!!

If your script reports connection lost, but our EA (see above) keeps silence, then You have global problem with internet (for instance problem with your internet provider's last mile)

If EA prints "Alarm" then we have problem with our connection routine

I have tried the following:

void start()
{

if(IsConnected()) Print("Connected!");
if(!IsConnected()) Print("Alarm!!! Connection is lost!");
}

Connected is printed when there is connection but when the connection is lost the EA went dead. I think the reason is because there is no more incoming ticks to trigger the the code !IsConnected() and so it will never detect a lost connection!!!

Reason: