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

 
OK, yeah, I got it...well...we'll see if it comes back ;)
 

Hi Stringo,



unfortunately, this bug persists.

When running the test script from below and switiching around from one account to another (in my test case I used accounts from 2 or 3 different brokers and switched from one to another), you can see that after a few accountChanges (quite random number) the connectionState really does not change back to 1, it stays 0 even though the Terminal _is_ connected.


In your eyes, this might not be a critical bug. However, for some people developing scripts which display the connectionState, the results of the conducted tests are quite alarming.

That's why I were very grateful if you could have a look at this issue again.



Here's the testScript:


//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
{
   while(!IsStopped())
   {
      Print("test"+IsConnected());
      Sleep(500);
   }
}




Sincerely yours,


Daniel.

 
I can also confirm that this bug exists in build 216. It seems to occur after some number of 'connect failed' - login sequences.
 
Yes, this script is known. But we should reproduce environment to detect problem. However we cannot it reproduce
 

I must also confirm the same bug. In my EA i check simultaneously if connection exist. If not my script exits.

Have one found a workaround for this?

 

The script cannot determine problem because of endless loop and independence from incoming ticks.

Problem can show expert only. Simple expert with only one line of code - Print(IsConnected());

Tick incomes (it means terminal is connected) - start function runs - oops! IsConnected() returns 0 (ie false)

 

thanks

yes i use

int start()
{
 while(true)
 {
  if(IsConnected())
   {
    ....... i do my work 
   {
   else 
   {return(-1);} // so if connection was lost i break the infiny loop
 }
}

the problem is that letter when connection is back IsConnected() kepps the old value false and do not change to true! But i'm seeing the price moves and terminal is connected 100%. This is a bug because infinity loop was broken and start was executed as nothing was happened on the first tick after connection was restored. But for some reason Is Connected() still returns false. If i remove the EA from chart and put i again everthing works fine until next connection lost.



This makes me crazy. Please do something about it!

Thanks

 

Liliput - if above is outline of start() using, why stay in it with infinit loop?

I ask cause normal? way is to enter > do I wanna work? no:return > do work > return

(normal - is subjective of course ;o)

not telling you how to design - that's your biz, just asking ur reasoning, then I learn more/see different ways of doing things!

What caused me to ask?

I have no idea how Terminal behaves if for instance an EA refuses to return to it for perhaps many data ticks which, since EA not return - the Termial just does not make the call to start()... or - does it just not make the call and eventually due to many data ticks flowing by without having been able to call EA's start() the Terminal goes into uncharted depths and manifests the connected issue?

;)

 

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);
  }
 
ukt:

Liliput - if above is outline of start() using, why stay in it with infinit loop?

I ask cause normal? way is to enter > do I wanna work? no:return > do work > return

(normal - is subjective of course ;o)

not telling you how to design - that's your biz, just asking ur reasoning, then I learn more/see different ways of doing things!

What caused me to ask?

I have no idea how Terminal behaves if for instance an EA refuses to return to it for perhaps many data ticks which, since EA not return - the Termial just does not make the call to start()... or - does it just not make the call and eventually due to many data ticks flowing by without having been able to call EA's start() the Terminal goes into uncharted depths and manifests the connected issue?

;)


ukt, no problem i will answer. I do infinit loop because i need to do many operations and i do not want to wait for a new tick to do them. So i take the control from terminal this way and do my work when i need and want. I use RefreshRates() to get actual data.

So it is logical to chek if connection to broker exist because i send/close /modify orders and if no connection then no work. simple is that. there are also other checks to exit the loop i use. for instance IsStoped() and so on but the problem is not in my code it is in the IsConnected().

Reason: