Best practice to speed up backtesting
How to get backtesting faster ? - MT4 - MQL4 and MetaTrader 4 - MQL4 programming forum
Try to reduce the input parameters to optimize. Can some be calculated in init() based on symbol?
Here are some lessons learned:
- don't use the optimizer if your EA reads every tick
- use the open bar whenever possible. Most of the time, it's enough. If not, then go to lower timeframes. M1 opening time is far better than every tick. But then you need more history, that's another (tick) story... ;-)
- avoid using external indicator. If you ever do this, it is better to have the code in your EA directly
- don't look at anything on the chart, better to have everything in memory (array or simple variables)
- don't look back in the chart if you can. If your EA can stick to the current bar information, it's the fastest
Here are some lessons learned:
- don't use the optimizer if your EA reads every tick
- use the open bar whenever possible. Most of the time, it's enough. If not, then go to lower timeframes. M1 opening time is far better than every tick. But then you need more history, that's another (tick) story... ;-)
- avoid using external indicator. If you ever do this, it is better to have the code in your EA directly
- don't look at anything on the chart, better to have everything in memory (array or simple variables)
- don't look back in the chart if you can. If your EA can stick to the current bar information, it's the fastest
What do you mean by dont look at anything on the chart?
I am using an external indicator currently, is it easy to copy it into my EA, it seems somewhat complicated.
What do you mean by dont look at anything on the chart?
I am using an external indicator currently, is it easy to copy it into my EA, it seems somewhat complicated.
As my EA gets more robust it inevitably is taking longer to backtest.
What operations should I avoid to help speed up the bot, are there certain things I should/should not be doing.
I know that I will have to optimize my code somehow I just dont know where I should be looking.
Thanks