Much depends on what is being done & when
Do some evaluate open or close only on first tick of a bar and others check each tick?
Is something being done ecah tick that you think is once per bar?
Do some have 'indicator code' in the EA & others sub the code to an external indicator?
These are the most common things I see with 'slow' EA's..
FWIW
-BB-
99.9% of the time, it is due to inefficient code.
As for the remainder, I'm not sure :)
int init() { if ( IsTesting() && !IsVisualMode() ) { Show.Objects = false; // test Show.Comments = false; } //... } //... if (Show.Comments) { Comment(//...
Backtest performance will be especially hampered if there is logic performed with each tick such as:
- repetitive logic eg. looping logic through order history
- logic with latency eg. file access, dll access
- heavyweight logic eg. complex calculations with many variables
- poorly written logic
Depending upon your EA, it can make sense to create a LIVE and TEST mode, configurable by an extern variable, in order to allow certain functionality to be bypassed for strategy tester runs.
CB
BB/WHRoeder/CB: Thank you for your support.
My reference time was 62 seconds for 1 month in the backtest.
What I've found out this afternoon:
- deleted unused code (code that will never be executed) --> -2 sec
- deactivated all kinds of graphical objects --> -3 sec
- added an exit at the very beginning when I can be sure that there's "nothing to do" on this tick --> -12 sec
- removed some unneccessary function calls --> -4 sec
- (don't know if that's correct english:) I've interleaved connected boolean operators --> -4 sec
--> all in all i nearly doubled the performance
what I've found out: MQL does not handle connected boolean operators like i.e. Java.
example:
if (cond1 && cond2 && cond3...)
--> all conditions will be checked, even if cond1 is false
so what I did is this:
if (cond1) {
if (cond2) {
and so on ...
}
}
ugly, but so is MQL...
also unnecessary function calls are able to reduce the execution speed significantly- I always underestimated this fact. but again, it's MQL...
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Has anyone found out, what it is that's slowing down the strategy tester?
On the one hand I have rather complex EAs that I can backtest in around 10 sec / month. Some other EAs really slow down the strategy tester exponentially and take >1 min/month. I haven't yet ofund out what it is: RAM usage stays on a constant level so it's not a memory leak then.