EA works intermittently

 

Hi,

I wrote an EA which is applied to 24 pairs of currencies. MY EA is fairly complex which has many routines calling each other. I notice that sometimes my EA will complete the tasks but sometimes it is kind of stopped halfway, making the EA works intermittently. Can someone please enlighten me how EA is executed on MT4? Specifically, does EA starts all over from the beginning when there is a new tick comes in, thus abandoning whatever it is doing in the middle of the EA? Does EA get pulled away from one currency to another while the EA is half way through its running? Please advise. Many thanks.

 

You didn't say if your EA was working on 24 charts or one chart accessing data from 24 pairs . . .

start() is called for each tick, but if it is still doing something when the next tick comes along it is not interrupted . . it continues till finished . . then when the next tick arrives it is called again.

If the EA is applied to each of 24 charts then you have 24 instances of it running . . . each responding to ticks on their own charts . . . asynchronously

 
RaptorUK:

You didn't say if your EA was working on 24 charts or one chart accessing data from 24 pairs . . .

start() is called for each tick, but if it is still doing something when the next tick comes along it is not interrupted . . it continues till finished . . then when the next tick arrives it is called again.

If the EA is applied to each of 24 charts then you have 24 instances of it running . . . each responding to ticks on their own charts . . . asynchronously


Hi RaptorUK, thank you very much for your help. My EA is applied to all 24 charts. They don't draw data from other pairs(or charts). Thanks for confirming my understanding of start() function, and therefore I expect the task to be completed once it has begun. Perhaps let me rephrase my question. The way my program works is based on appearing of a new bar. Is it possible to have a couple of new bars (on M15 chart) without having any tick coming in? If this is the case, then I can understand why my EA did not act on the new bars as start() was not triggered. If it is not possible, then I am back to square one. Thanks ....
 
novalight:

Is it possible to have a couple of new bars (on M15 chart) without having any tick coming in? If this is the case, then I can understand why my EA did not act on the new bars as start() was not triggered. If it is not possible, then I am back to square one. Thanks ....
I only look at Forex, what you are describing is possible but in my experience not likely . . I have seen missing M1 bars, i.e. no ticks for a minute or two, on Forex pairs . . . if you are using instruments other than Forex then it might well be possible to have missing M15 bars . . . but I couldn't confirm it. But you should be able to confirm this by looking at your data in the history center.
 
RaptorUK:
I only look at Forex, what you are describing is possible but in my experience not likely . . I have seen missing M1 bars, i.e. no ticks for a minute or two, on Forex pairs . . . if you are using instruments other than Forex then it might well be possible to have missing M15 bars . . . but I couldn't confirm it. But you should be able to confirm this by looking at your data in the history center.

Hi RaptorUK, thanks again for your help. I am also looking at Forex only. I have confirmed that there are ticks coming in between bars for M15 chart and higher. That is why I am puzzled that EA tasks were not completed or work intermittently. Any other suggestions/ideas as to how to address this kind of problems ? Thanks....
 
Check any loops you have, make sure they aren't counting to the max value of an int . .
 
RaptorUK:
Check any loops you have, make sure they aren't counting to the max value of an int . .

Will do. Thanks again for your help.
Reason: