You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
It can be checked, just run the check in an infinite loop. how to start this loop when starting the terminal during a connection outage is a completely separate problem. Once you got your loop running it will do what is expected.
Your problem has nothing to do with the IsConnected() function. With the same argument you could also complain about Print() or Alert() or any other function that you cannot call because you could not start the entire code in the first place because of some completely different reason.
ok, Let me explain something Because I'm useing a lot Terminlas All along my cpu useage is rising up to 100 prcent that is why i need to turn off a few terminals
And when I turn them on (of course automatic) I saw a few times that they are not connected & the EA was running on them did not report that there is no connection,
that is y i started this topic & so far the only way that i found is like i said above whit an external program
Maybe it is related to the "feature" that was first introduced with Windows XP SP2 that it refuses to have more than only a handful of half-open connections at any time, mainly to annoy people who want to use networking intensive applications. AFAIK there exist methods to patch this annoying "feature" away and restore normal operability: http://blog.davidkaspar.com/archives/2005/04/windows-xp-sp2-and-event-id-4226.php
Look for the 4226 event in the windows event log.
This is the only correct way to force a start() from within init() in an EA. You are not allowed to do this in an indicator since there start() will run in the GUI thread.
This is nice but it doesn't always work because the tick may be gone even before initi() has returned, in which case the tick is discarded. To highlight this, if you add a 5ms pause after
then start() will not be executed.
Is there a better solution to have start() execute on load of the expert advisor without requiring a real tick from the broker?
I little old but looking for a solution to the same problem I got on this topic.
In fact, assertion of qjol that "the only way to do this is whit a script; the problem is that there is no way to open the terminal with a script Loaded" is partially true. With a script ok, but there is a way to start a script with client terminal. This is documented in metatrader help (F1, Tools, Configuration at Startup). May be it's not same at the time of this topic was started.
So I developped a little script to do the job. Use this with a startup script, example :
And lauch terminal with something like :
"...\Metatrader 4\terminal.exe" config\start.ini
Hi guys,
Do you know any of you, why not work script fake ticks - https://www.mql5.com/en/forum/128803/page2#373539 (page 2) this thread for build 600++?
My OS is Vista. Thank you.
Hi guys,
Do you know any of you, why not work script fake ticks - https://www.mql5.com/en/forum/128803/page2#373539 (page 2) this thread for build 600++?
My OS is Vista. Thank you.
Since build > 600 you have to replace "A" for ansi with "W" for unicode
why is it use 2 and 1 in parameter
why is it use 2 and 1 in parameter
It is out of scope of MQL, chet the function here:
In case someone else is searching for information regarding IsConnected() function.
So yes, the function will not work under start() function or OnTick() function, because if there is no connection, then no new tick will arrive, and the function will not trigger anyway....
So what should we do?
Use the OnTimer() function, to regularly check for connection, regardless of incoming ticks.
fridayda13:
So yes, the function will not work under start() function or OnTick() function, because if there is no connection, then no new tick will arrive, and the function will not trigger anyway....
So what should we do?
Use the OnTimer() function, to regularly check for connection, regardless of incoming ticks.
You should do nothing, because there is nothing you can do. It takes 30+ seconds before the network times out and the function changes value. What are you going to do when nothing has changed and you have no connection?
It's only useful if you never return from start/OnTick (check it before a OrderSend.) Or after OrderSend for retries within the same tick.
Instead, if OrderSend fails, log it, return and test/retry on the next tick. Done.