Download MetaTrader 5

IsConnected()

To add comments, please log in or register
The entire MQL5.community history on a single page!
qjol
3243
qjol 2010.09.24 06:08 

Can someone explain to me how IsConnected() can work after int start()

if anything is written after int start() is execute only after a new tick How can the EA get to it at all

thanks

Philippe
201
Philippe 2010.09.24 06:54  

you can loop into start() to check new tick and...isconnected()

qjol
3243
qjol 2010.09.25 19:26  
Matutin:

you can loop into start() to check new tick and...isconnected()


But what would help me to loop into start(), if a new tick didn't comes

for example if automaticly i restart the terminal & is no connection than the EA didn't comes to the loop

Nikolay Panev
1072
Nikolay Panev 2010.09.25 19:30  
qjol:


But what would help me to loop into start(), if a new tick didn't comes

for example if automaticly i restart the terminal & is no connection than the EA didn't comes to the loop

Can help you in a script, not EA.
qjol
3243
qjol 2010.09.25 19:41  
robofx.org:
Can help you in a script, not EA.

in a EA into init() ?
Nikolay Panev
1072
Nikolay Panev 2010.09.25 19:59  
qjol:

in a EA into init() ?
Possible.
Viffer
614
Viffer 2010.09.25 20:59  
qjol
3243
qjol 2010.09.25 21:25  
robofx.org:
Possible.


sorry after int init() didnt't work i chack it out

#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#import "shell32.dll"
int ShellExecuteA(int hwnd,string Operation,string File,string Parameters,string Directory,int ShowCmd);
#import

int init()
  {
   Print ("starting count");
   Sleep(10000);
   Print ("chacking");
   if (!IsConnected())
   {
   Print ("restarting ap in 5 sec");
   Sleep(5000);
   ShellExecuteA(0, "Open", "d:\r_ap.bat", "", "", 1); 
   }

   return(0);
  }

Viffer
614
Viffer 2010.09.25 21:35  

Expanding on my link above... I run a seperate EA to monitor connection status. It basically has all the code for my test coded inside start with a sleep at the end. Start is basically a big loop, when it finishes, it goes back to the beginning. But rather than wait for a tick to trigger the start, I call start() inside init(). In this way start() continues to loop with the sleep and init() never finishes so the code runs based on time intervals from sleep rather than waiting for a tick... the link above shows the principal...

hth

V

qjol
3243
qjol 2010.09.25 22:34  
Viffer:

Expanding on my link above... I run a seperate EA to monitor connection status. It basically has all the code for my test coded inside start with a sleep at the end. Start is basically a big loop, when it finishes, it goes back to the beginning. But rather than wait for a tick to trigger the start, I call start() inside init(). In this way start() continues to loop with the sleep and init() never finishes so the code runs based on time intervals from sleep rather than waiting for a tick... the link above shows the principal...

hth

V


thanks
Philippe
201
Philippe 2010.09.25 23:54  
qjol:


But what would help me to loop into start(), if a new tick didn't comes

for example if automaticly i restart the terminal & is no connection than the EA didn't comes to the loop


Just call start() from init () ...and you will be in start() even no tick coming !
1234
To add comments, please log in or register