Download MetaTrader 5
To add comments, please log in or register
Do you have idle PCs? Connect them to MQL5 Cloud Network and earn money!
cdp21
36
cdp21 2015.03.31 13:41 

Is there an hierarchy between OnTimer and OnTick, with OnTick being "more important" than OnTimer?

I have 25 EAs running on 25 different charts with a OnTick function which takes less than 2 milliseconds to execute. I have another EA where I keep track of what's happening (I call it a review panel), which has a function OnTimer, with a 1 second timer activated. If I put on this last EA a graphical object showing me the time in seconds I notice that sometimes a delay of 4 or more seconds happens (meaning the time shown goes to 12:10:22 to 12:10:27 for example), which means that some OnTimer events got somehow skipped. However, if I change the OnTimer function to OnTick, as long as I receive a tick each second, time does not skip any second.

Has anyone else experienced this? The only explanation I could think of is of an internal queue management system where MT4 executes first all the OnTick events and only successively the OnTimer ones. Any other ideas? 

Ovo Cz
2953
Ovo Cz 2015.03.31 17:04  

I have it also unclear how the "events queue" works. Nevertheless I use timers a lot, and I rarely notice the OnTimer failed and I never noticed any extreme delay. So ChartRedraw() might fix it, if you do not use it. Try to keep a log if you are suspicious about the interval.

cdp21
36
cdp21 2015.03.31 22:23  
Ovo:

I have it also unclear how the "events queue" works. Nevertheless I use timers a lot, and I rarely notice the OnTimer failed and I never noticed any extreme delay. So ChartRedraw() might fix it, if you do not use it. Try to keep a log if you are suspicious about the interval.

Thanks for your reply Ovo. Yes you're right, it would be nice to know more exactly how queue management works internally..

After some tests, my problem was (I think) apparently due to the excessive amount of edit fields that were concentrated in one specific chart (I use it to change the inputs of the other 25 EAs), which was slowing down everything (even though I thought edit fields weren't taking too much "energy" in resources since I create them at initialisation). Do you know of any method to check how is resources consumption inside MT4? Logs don't help too much and Windows Task Manager doesn't show any excessive readings while everything is running..


/
To add comments, please log in or register