Terminated by Timeout Solution

 

Hello, is there a solution avaible what somebody can make when his Expert Advisor stop to work because of the error message "terminated by timeout"?

I know that i can start the metatarder new when that message happen, but when i am not at home and i dont see that the problem have happen is there no other solution how that can be automatic handeled?

 

All scripts must return from init() within 2.5 seconds. They must return from start() within 2.5 seconds when the chart is changed or closed (Uninitialize reason codes - MQL4 Documentation.) Otherwise they will be "terminated by timeout"

Your EA is broken. Probably infinite loop.

 
WHRoeder:

All scripts must return from init() within 2.5 seconds. They must return from start() within 2.5 seconds when the chart is changed or closed (Uninitialize reason codes - MQL4 Documentation.) Otherwise they will be "terminated by timeout"

Your EA is broken. Probably infinite loop.


Yes i did code a infinite loop with Sleep(500) because I want that the Expert Advisor work all the time and not just when i get a new tick into the chart.


Have you ideas how i can make my Expert Advisor run all the time without getin this problem from "terminated by timeout" that is by the way a very serieos problem, just think when you are a  few houers not looking to your metatarder and all the time your EA have not work because he have get that error message.

 
PlanandTrade:

Yes i did code a infinite loop with Sleep(500) because I want that the Expert Advisor work all the time and not just when i get a new tick into the chart.


Have you ideas how i can make my Expert Advisor run all the time without getin this problem from "terminated by timeout" that is by the way a very serieos problem, just think when you are a  few houers not looking to your metatarder and all the time your EA have not work because he have get that error message.

Why does it need to run when there is no tick ?
 
RaptorUK:
Why does it need to run when there is no tick ?


for example when you receive signals from outside then you want that your expert advisor execute that signals and not wait to long till a new tick comes.

when you use the standard oder mask from mt4 then you also can alays open or close orders no matter if a new tick has occur.

but the most important question in this topic is now how to handle the terminated by timeout" problem

 
PlanandTrade:

for example when you receive signals from outside then you want that your expert advisor execute that signals and not wait to long till a new tick comes.

when you use the standard oder mask from mt4 then you also can alays open or close orders no matter if a new tick has occur.

but the most important question in this topic is now how to handle the terminated by timeout" problem

Tick your charts yourself if you must . . . 
 
WHRoeder:

All scripts must return from init() within 2.5 seconds. They must return from start() within 2.5 seconds when the chart is changed or closed (Uninitialize reason codes - MQL4 Documentation.) Otherwise they will be "terminated by timeout"

Your EA is broken. Probably infinite loop.


Do those limits apply to other programme types too (EA, CA)?

The book (https://book.mql4.com/programm/special) only mentions a 2.5 second limit for Deinit.

 
alladir:


Do those limits apply to other programme types too (EA, CA)?

The book (https://book.mql4.com/programm/special) only mentions a 2.5 second limit for Deinit.

How do you expect deinit to close within 2.5 seconds of a chart change when it hasn't yet been called because start() is in an infinite loop ?
 
RaptorUK:
Tick your charts yourself if you must . . . 


if such think is possible, can you please show me where i can find infos abouth that?

But a solution for "terminated by timeout" problem i dont see yet anywhere, if such think happen, no matter why wich reason, i dont see a solution, if you are not at your pc then you cannot restart your metatarder to slove that.
 
PlanandTrade:

if such think is possible, can you please show me where i can find infos abouth that?

But a solution for "terminated by timeout" problem i dont see yet anywhere, if such think happen, no matter why wich reason, i dont see a solution, if you are not at your pc then you cannot restart your metatarder to slove that.

The solution is to write your code correctly and don't force it into problems . . .

You can find out information about ticking offline charts using the search or Google including "mql4" 

 
PlanandTrade: Yes i did code a infinite loop with Sleep(500) because I didn't understand how to do it properly
int start(){
   :
// while( true         ){ // infinite loop WRONG
   while( !IsStopped() ){ // exit on close
     :
Reason: