A problem I have been chasing for some time is probably caused by the timer interrupts a vital history data update or a follow up routines for new data.
I have been thinking of different ways to handle this problem.
The timing is not crucial, it just a way to refresh data on regular intervals.
1. Doing the update asyncronously by a subtask. Have not looked into the possibilities for this in MQL4.
2. Use another EA to store updated data in a file or SQL database. I have used the SQL method in another project. It works, but feels a bit overkill.
3. Keep the Timer but only set a flag and use that together with a routine that checks it a regular intervals that are determined by looking at elapsed by checking time
by retriving current time with last time.
An assumption for some of the solutions is that execution that are interrupted by the timer is continued after the interrupt.
Suggestions are welcome !
There are no interrupts in MT4/5. OnTimer will only run after OnTick and OnEvent have finished. You're over thinking it.
You can use OnTimer to "refresh data on regular intervals." The question is what data, Nothing on the chart has changed until OnTick runs.
Well, thanks for your comments.
The EA I am developing uses 5M 15M 1H 4H 1D 1W on the major pairs. So there is a lot of data transfer. The number of periods can be set between 10 to 30 periods.
The individual strength on each pair is calculated by using linear regression. So. There is a lot of data and a fair amount of processing. Looking at my results I can see that I get
some conflicts between the various processes. One way would be to do the 5 min data on every 2, 7,12,17 .... the 15 min data on 4,18, 23.... and so fort. Feels clumsy.
I am beginning to favor a split to 2 EA:s and establish some kind of transportation (one way) Data retrieval and pre processing in one and a analysis and trade in the other.
I am running my own server 24/7 and it has MySQL installed. The major part of the code to do this I have. It is a bit of overkill to use MySQL but I tried some other means of
communication but did not like them. It also makes it easier to develop the trading part with MQL5 and use it for other purposes like logging and doing processing of results.
Yes, I am a professional programmer since 1970 in various areas :-)