Backtesting Speed / Optimization Techniques

Jun 8, 2013 at 4:34 PM

First of all--great product. No problem getting it up and running and understanding the structure of the framework (albeit with a little help from some of the posters on here :).

Being a newer user to the platform, today was the first time I experimented with backtesting through MT4's Strategy Tester. I am using 1M bar data and the testing process appears to be very slow. For example, it took 2 minutes and 40 seconds to run through one week (2013-05-27 to 2013-05-31) of data, executing the example MACrossExpert EA.

I'm wondering if there's anything I can do to speed the process up (e.g. disable console logging, adjustments to configuration/setup, etc.), or any other way to backtest that may be more efficient.

I'm wondering if other posters are seeing similar results or if I have something configured incorrectly.

Any tips or advice that anyone has would be much appreciated.
Jun 16, 2013 at 8:44 PM
Hi postrema,

I encountered this problem too. I agree TradePlatform is a great product but unless I'm missing something, it doesn't currently support any kind of meaningful optimization due to the slow execution speed.

I've been considering a solution: write an ExpertAdvisor that calls a local source of tick data (e.g. SQL Server/local memory) rather than MT4. I believe this would make testing much faster.

Amongst other things, MqlHandler.CallMqlMethod calls would need to be overridden and a custom GUI would be required to output results. I haven't worked it out completely yet but would welcome other developer suggestions on how we might build a back testing and optimisation suite that was compatible with TradePlatform.

Or perhaps there is already a solution out there I'm not aware of?
Jul 8, 2013 at 8:59 PM
I think I've found a couple of solutions to the problem of slow backtesting and optimization. I document them here in case others have any comments/improvements I could make. Neither solution makes direct use of the TradePlatform framework but both are standalone back testing methods for C# strategies - which can then be used via TradePlatform for live trading or real-time forward testing.
  1. Use
    This is fine for light testing but I haven't yet managed to get it to run multiple tests and aggregate the results.
  1. Download tick data to a SQL Server (e.g. from; run your given trading strategy against it; and use a custom results application or use an off the shelf package (e.g.
If anyone has some experience of QuantConnect, ModulusFE BackTester or an alternative solution I'd be very happy to hear from you :)
Aug 8, 2013 at 1:52 PM
But if you create a dll and small EA script and optimise from MT4 - is that not faster than MT4 optimisation?
Either all logic in dll or just the tick-by-tick calcs.
Apr 25, 2014 at 3:43 AM
Hey! I'm the founder of QuantConnect, I'd love to collaborate with you guys. It would be nice to use TradePlatform algorithms inside QuantConnect.

Let me know if you have any issues backtesting in QuantConnect --