-
EAs : Don't do per tick that you can do per bar, or on open.
If you are waiting for a level, don't reevaluate, wait until price reaches it (or a new bar starts, and you recalculate.)
If you are waiting for an order to close, only look when OrdersTotal (or MT5 equivalent) has changed.
How to get backtesting faster ? - MT4 - MQL4 programming forum 2017.08.07 -
Indicators: Code it properly so it only recomputes bar zero (after the initial run.)
How to do your lookbacks correctly. 2016.05.11
Or, reduce Tools → Options (control+O) → Charts → Max bars in chart to something reasonable (like 1K.)
-
EAs : Don't do per tick that you can do per bar, or on open.
If you are waiting for a level, don't reevaluate, wait until price reaches it (or a new bar starts, and you recalculate.)
If you are waiting for an order to close, only look when OrdersTotal (or MT5 equivalent) has changed.
How to get backtesting faster ? - MT4 - MQL4 programming forum 2017.08.07 -
Indicators: Code it properly so it only recomputes bar zero (after the initial run.)
How to do your lookbacks correctly. 2016.05.11
Or, reduce Tools → Options (control+O) → Charts → Max bars in chart to something reasonable (like 1K.)
Hi,WIlliam
Thank you for your comments.
By the way, if I need to do backtest in everytick mode, like an order is places during current bar is forming,
the reason why backtest speed is so slow is due to using icustom with some indicator file?
Hi,
it depends on the possible value of var a - if it is negative, the second statement will print "OK" the first one not.
But I doubt that there will be measurable differences in the backtest with these two instructions.
Best regards
Thank you. Maybe I don't need to think about both code is not so different.
I got it. Thank you.
I use icustom but everytick mode gives me so much stress... Speed is so slow.
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the file.
I wonder there is a difference between below code.
because I want to make backtest speed faster.
It is valid to mention, that the compiler does code optimizations, example:
If you code something like:
int a = 0; int b = 1; if(a != b) Print("lalala");
During compilation, the optimization will know that this comparison will always be true, so it substitutes de above code to:
Print("lalala");
The "if", will never exist during execution.
Just the Print command, since the comparison was useless, the the compiler rewrite it during optimization phase.
The optimization phase, makes thousands of adjusts like the above example, and much more complex ones, specially for loop and while situations.
So you don't have to worry about micro-optimizations or situations like this, while writing the code.
It is much more important, to follow what William Roeder proposed.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I wonder there is a difference between below code.
because I want to make backtest speed faster.
If you know some other ideas to make backtest faster even in everytick mode with icustom.
Please tell me.
Thank you.