Build 216 bug ? isConnected() = false but metatrader still connected

 

Hi

I m just sitting in front of my trading PC, My EA just detected a Buy signal and try to open a Long Position... Funny thing is it keeps on reporting IsConnected()= false error but the MT4 platform actually is connecting to my broker. My EA kept on retry to open trade with delay and refresh rate() call. but it doesn"t work. Endup I key in the order manualluy and it gone through and accepted by the broker...while my EA stills reporting IsConnected()= false error..

Anyone knows what could be the problem, I saw other posts reporting a similar problem, but seems no solution

Best Regards

Tom

 

for me this certainly is a known bug of MT4. However, the MT4 DevTeam hasn't been able to reproduce and fix it yet.

Btw, did you use the hiberating (also called suspend or sleep mode) of you Windows prior to encountering this issue? From my tests I assume that MT4 does not set isConnected back to true after waking up again...

 
tradeigel wrote >>

for me this certainly is a known bug of MT4. However, the MT4 DevTeam hasn't been able to reproduce and fix it yet.

Btw, did you use the hiberating (also called suspend or sleep mode) of you Windows prior to encountering this issue? From my tests I assume that MT4 does not set isConnected back to true after waking up again...

Hi Tradeigel

Hiberating is off for my trading PC, because I don"t want my PC go into sleep mode or Hiberating during the trading session. In fact when I spot this issue, I m just right sitting in front of my trading PC. My EA try to wait..then refresh the quote, then sent the order for max up to 12 retries but just cannot make it,, then I tried sending the order manually, it was accepted.. We are suppose to build a EA to trade automatically when we are not able to sit in front of the PC to look at the chart. Now I have to manual key in the order instead.

Regards

Tom

 
well....for a quick work-around you just have to take out the if-statement checking for IsConnected(). If you do that the EA doesn't care about isConnected()'s state and just pipes the order through to the tradeServer.
 
tradeigel wrote >>
well....for a quick work-around you just have to take out the if-statement checking for IsConnected(). If you do that the EA doesn't care about isConnected()'s state and just pipes the order through to the tradeServer.

Hi tradeigel,

Thanks for your information, it maybe the only solution to work around this issue for the time being, hopefully, MT4 dev team can fix this bug as soon as possible

Tom

 
I don't know if they're really working on it though. Stringo says it cannot be reproduced...I hope they're stillt trying.
 
tradeigel:
I don't know if they're really working on it though. Stringo says it cannot be reproduced...I hope they're stillt trying.

Hi,

   Yeah the isConnected works and doesn't work it depends on wind. I trade with an ea that uses the data from thick and i also needed an endless loop on disconnects/reconnects i had to reset some things in the ea because i could get wron entries depending on values before disconnects. Anyway here is my sollution to the problem:

bool Connected(){
  int distance = 2;
   
  if (MathAbs(TimeLocal() - TimeCurrent()) - timeDifference > distance){
  return(false);
  }
   
  return(true); 
}

TimeCurrent will stop when disconnected while TimeLocal still goes. Distance is 2 seconds for me, mabe for better internet connections you can use 1.

timeDifference i initialize to MathAbs(TimeLocal() - TimeCurrent()) in the init function. (ea init).

   This way when i get a 2 or more seconds difference i am in disconnected mode. When the difference goes back i'm connected and can trade.

while(true){

   if (connected()){

      ...bla bla
   }

   else{

     ... disconected

   }

}
   To MQL team: you can use my code further in the next patch of MetaTrader :). IsConnected when works has a delay of more than 10 seconds(checked on clock) so my code is better :P.

 
A ping function would also work if you can add into metatrader. (ping server) - check repaly/timeout. I think it's not a hard thing to do.
 

Greetings,


I have recently started using Pandela as my VPS service and have been running some EA's on my MIG Bank demo account and have had the same issue. I'm using build 225 and I have had my EA's not function because of the server connection not being what it should be, green over red bars. I am still running my EA's for other reasons, but when I see the green and red bars, I can get them to go to green over blue-green bars by logging off and logging back into the server. It kind of defeats the purpose of having a VPS if you need to monitor the connection status and do the log off - log on routine as needed.

In an EA of my own design, I do not have any code in it to check for the connection status, so the idea that removing such code will get around the problem seems to be in error from my experience. Also, since the connection status can change at random times (with an open trade), I would find it much more useful to have an auxiliary EA running that automatically prods the server to re-establish a full connection when I get the green over red bars of EA DEATH. I see that the last entry made for this thread is quite old. I may be wrong, but it would appear that a solution to this issue has been found. Please share any recent developments that has made it possible to reliably use EA's on a VPS with MIG Bank as the broker. Thanks.


Glenn

 
dkblue69:

Greetings,


I have recently started using Pandela as my VPS service and have been running some EA's on my MIG Bank demo account and have had the same issue. I'm using build 225 and I have had my EA's not function because of the server connection not being what it should be, green over red bars. I am still running my EA's for other reasons, but when I see the green and red bars, I can get them to go to green over blue-green bars by logging off and logging back into the server. It kind of defeats the purpose of having a VPS if you need to monitor the connection status and do the log off - log on routine as needed.

In an EA of my own design, I do not have any code in it to check for the connection status, so the idea that removing such code will get around the problem seems to be in error from my experience. Also, since the connection status can change at random times (with an open trade), I would find it much more useful to have an auxiliary EA running that automatically prods the server to re-establish a full connection when I get the green over red bars of EA DEATH. I see that the last entry made for this thread is quite old. I may be wrong, but it would appear that a solution to this issue has been found. Please share any recent developments that has made it possible to reliably use EA's on a VPS with MIG Bank as the broker. Thanks.


Glenn

Look at your journal's log. Do u have any of the following errors:

DataCenter connecting failed [6]
unknown command C6