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
Just call start() from init () ...and you will be in start() even no tick coming !
thanks u 2
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
Just call start() from init () ...and you will be in start() even no tick coming !
neither of this solve the problem because init() also didn't start if there is no connection
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
neither of this solve the problem because init() also didn't start if there is no connection
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
Let have a look at MT4i.com tools. I use them to monitot connexion and send alert by mail or sms.
http://www.mt4i.com/mtdashboard.aspx
Just call start() from init () ...and you will be in start() even no tick coming !
NO! This is not allowed. init() is expected to return after 2 seconds. Init is not allowed to block! All kinds of problems might (and will) arise from that.
Just do the loop in start and expect start to be called automatically on the next available tick after loading the EA. There were ticks before the connection dropped so your loop will be already running when this event occurs.
If you really need to trigger a start() from within init() because you need it to run on the weekend then the only correct way is to use the PostMessage() trick to enforce a tick. You post the message and then you let init return! MT4 will then call start() the normal way and init() won't block.
See the next posting for an example.
And this is the same as the script above but implemented as an EA, demonstratig both concepts in one EA.
In init() it will enqueue the very first tick to trigger the first start() and then in start() it will produce more ticks in an infinite loop.These ticks will then be picked up by all indicators on the same chart.
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.
try to put this EA on a chart, close the terminal, than disable your internet conection & turn on your terminal (While the connection to the internet is turned off) & You'll see it does not work
try to put this ea on a chart close the terminal than disable your internet conection & turn on your terminal (While the connection to the internet is turned off) & You'll see it does not work
But it should continue running once it has been started under normal conditions (which should be the normal use case). Try to disconnect after it has been started.
And it serves as an example of how to avoid a blocking init() and run it as an EA instead of a script.
But it should continue running once it has been started under normal conditions (which should be the normal use case). Try to disconnect after it has been started.
And it serves as an example of how to avoid a blocking init() and run it as an EA instead of a script.
You're right, but I'm not looking for a solution to the situation you describe, I'm looking for a solution to the situation I describe, and right now the only solution I found, that, external software, will run a script