EA always stop working after several hours, why is this?

 

hi, guys I got a question. my EA stop working after several hours. Thing is, I can't find certain answer as to why the EA stopped working. It just did. Once every several hours I have to restart my terminal. I dont know why and I really want to know what's blocking the EA to work continuously. Basically the EA generate logs after every candle close. for example if I use the EA on GBPUSD M15, then after the candle close the EA will write a log in experts tab like "GBPUSD M15 label: any, heikenashi: sell, ..." bla bla something like that. But if I let it run continuously, let's say 6 hours later, the EA then wouldnt generate log again by then. i can confirm it's not just log problem but the EA just stopped working completely (because the signal stopped working too since it didnt generate log). If i restart the terminal it would work again.

So what I did was testing the EA in different brokers (4-5 different platform) and I can confirm that the EA stopped working in all brokers. At IBFX it stopped working after about 5 hours. At FXPro it stopped working after about 6 hours. and at Pepperstone it stopped working after about 6 hours and half. the longest time i could find was on Vantage FX. EA worked for about 8 hours but then it stopped working too. I dont know why. I thought it had bug with making/modifying an order but i dont think so because at Pepperstone and FXPro i couldnt find any error/attempt to make an order. They just randomly stopped working after X hours online.

also this issue is not related to internet connection at all because yesterday when the problem occured I was here sitting in front of my computer so im pretty sure it's not internet related. Is there any thing I can do? Like changing the terminal files or settings maybe? Or is it my EA problem?

For more information, my EA is using one custom indicator (pivots indicator) and other are just standard indicators. However i think the problem is not related to the pivot indicator because pivot lines dont change once every few hours so i think that's not the problem.

 
Rdy203 :

hi, guys I got a question. my EA stop working after several hours. Thing is, I can't find certain answer as to why the EA stopped working. It just did. Once every several hours I have to restart my terminal. I dont know why and I really want to know what's blocking the EA to work continuously. Basically the EA generate logs after every candle close. for example if I use the EA on GBPUSD M15, then after the candle close the EA will write a log in experts tab like "GBPUSD M15 label: any, heikenashi: sell, ..." bla bla something like that. But if I let it run continuously, let's say 6 hours later, the EA then wouldnt generate log again by then. i can confirm it's not just log problem but the EA just stopped working completely (because the signal stopped working too since it didnt generate log). If i restart the terminal it would work again.

Sounds like your code is broken . . . what are the last messages in the experts log before the EA "stops working" ? it's hard to give specific advice with seeing the code, if you want to post it please use the SRC button . . . . How to use the SRC button.
 

usually when I meet this problem the code stops with "division by zero" error, as the result of meeting with not correctly handled data.

check the expert logs what are the last (error) messages before the uninit at the end.

a faster way of finding this may be running the ea in the strategy tester.

 

I am working on a similar issue in a set of 4 levels of stops that work when the MT4 is restarted but after a while no errors or anything it just seems to stop acting and ignores the code more the longer the EA is on the chart.

I looked at the memory usage in the Task Manager for the computer (Control - Alt - Delete). Memory seems to change but sometimes it reduces and edges up but nothing seen that is alarming or indicative of a memory leak.

I converted the code from basic loops to a system that uses arrays thinking that the "client --> server" interaction is off. But that didn't fix the issues.

I have looked at the trade info in my arrays and it appears to be accurate to the trades.

I asked about this issue on another forum and was told that MT4 is not able to deal with a lot of trades and in my experience that would be where trades are greater than about 30.

I can't say I have a memory leak, it is more like MT4 gets tired...but that is not a very scientific.

The EA itself is about 100 printed pages long...so not sure if the length of the code is an issue.

My assumption right or wrong is that if the code works sometimes it should continue to work.

I suspect we are dealing with different sides of the same issue which may be our code or in the MT4 system itself.

 
Forex5x: My assumption right or wrong is that if the code works sometimes it should continue to work.

If your code is broken it stays broken until you fix it. Just because you didn't see a symptom yet means nothing.

You were previously asked two questions. If you don't want to answer them, then stop wasting our time. There are no mind readers here.

 
Forex5x:

I am working on a similar issue in a set of 4 levels of stops that work when the MT4 is restarted but after a while no errors or anything it just seems to stop acting and ignores the code more the longer the EA is on the chart.

You started a thread about your issue: https://www.mql5.com/en/forum/146442 use it instead of hijacking a different thread . . .