I'm working on a project right now using data from four custom indicators on 9 timeframes in mql4. Currently I make use of the iCustom function to get data from necessary buffers and bar indexes. As you can imagine, I have over 60 iCustom calls and its slowing down processing considerably. Is there a better way to optimize my indicator calls for speed?
Yes! Only read the data when a new bar forms on that particular time frame, and cache the data so that you don't have to call the iCustom function again later.
Also, pay careful attention to how the indicator calculates its values. You may devise a more efficient way of calculating the data in combination over the various time-frames.
Several calls are not a problem as long as indicators works efficiently by itself.
For sure good improovements can be:
1 - make indicator calculates only last closed candle and not every tick.
2 - set a 'max history' bars to calculate to reduce the calculations.
Point 2 can be done without problems almost always, point 1 depends on your indicator.
PS. You are talking about using a lot of calls and on several timeframes and you are still on MT4. You should consider to move to MT5, where the process is a long way better (indicator handles initialized at EA startup and then you just copy buffers of indicators)
Yes! Only read the data when a new bar forms on that particular time frame, and cache the data so that you don't have to call the iCustom function again later.
Also, pay careful attention to how the indicator calculates its values. You may devise a more efficient way of calculating the data in combination over the various time-frames.
Several calls are not a problem as long as indicators works efficiently by itself.
For sure good improovements can be:
1 - make indicator calculates only last closed candle and not every tick.
2 - set a 'max history' bars to calculate to reduce the calculations.
Point 2 can be done without problems almost always, point 1 depends on your indicator.
PS. You are talking about using a lot of calls and on several timeframes and you are still on MT4. You should consider to move to MT5, where the process is a long way better (indicator handles initialized at EA startup and then you just copy buffers of indicators)
Hi Fabio! Thanks for your suggestions. That’s a good point with Max History Bars. Thing is I can’t exactly tell every user to change their max history setting. But it’s a good idea for optimization.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello Everyone
I'm working on a project right now using data from four custom indicators on 9 timeframes in mql4. Currently I make use of the iCustom function to get data from necessary buffers and bar indexes. As you can imagine, I have over 60 iCustom calls and its slowing down processing considerably. Is there a better way to optimize my indicator calls for speed?