questions on EA run timelimits and deinit() always running - IF system for any reason pulls plug on EA
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
hello all MQLers
i ask as confused over writings about 2.5s cutoff and deinit() handling.
these are worries bout 24/7 unattended EA workings and trying cover all possibilities can think of - lol
ok, i been dream bout this much - not any way clear in mind, on mql4 info - needing help, as running of deinit() is most important for my EA
maybe no issue - not know so must try describe below a possible event series for u to see wat in my mind?... :)
.
example:
execution errors such as 6,129,130,134,136 and also vip for my work is runtime error 4066
i read they mostly all should need wait time b4 retry and 5s or maybe more needed
.
(X) EA has rule that ANY 'issue' like (3) which causes deinit() entry means that 100% cleanup done
eg, clear out all Trade Pool orders belong to EA + logging to disc files + Print()s + flush/close disc files + maybe do (Y) [1big or 10small?] ...
this could maybe take >2.5s ?
.
(Y) perhaps better to not only do its logging when ok tradeOperation done but also send Email ???
a kinda 'offsite' backup log which can always get to and so do manual MarketOrder closure... if can get online of course ;)
i worry if should do 1big email if sequential tradeOperations done or 1small email as each done ok.
ie, if concatenate or watevr each tradeOperation email text 'waiting' until all done b4 sending email - maybe EA get chopped b4 email sent... but if do loop of: tradeOperation -> send email; this maybe wasting time sending emails when should be only concentrate on getting orders out of TradePool... i think is catch 22 ?
.
(Z) guess all depends on ur feedback but 'what if' EA had Sleep() policy of not do one long Sleep() but break down into loop of: short Sleep() + check system state; so can react faster to any system state change needing start() to return() immediately.
.
(0) let us assume EA at time of (1) already has 10 open/active market orders on 10 sym,period combinations
(1) EA now wanna do #11 marketOrder and gets invalid price/129 so need sleep b4 retry
(2) EA enter Sleep(5000)
(3) maybe, say sometime after (2) started, system decides pull plug on EA - for watevr reason
(4) wat happen when (3), and EA code at (2) ?
well, i appreciate much u getting down here :) and so much like hear from others on their understandings about this deinit() calling AND just how much time it gonna be allowed to have for (X) if any at all...
Best to all