Run so much slower on strategy tester than during a simple backtest

 

Hello,


I was wondering if someone could help me understand why when I'm doing a genetic optimization, a run could take up to 3 hoursto complete, but when I'm making a simple backtest, it takes only 30 min. I'm usingusing the exact same modelling, exact same period or timeframe. I really don't understand. The optimization is not supposed to be faster than a simple backtest ? 

Also, is there a way to stop a run if the drawdown reach 30% (for example) ? Hi think it would speed up the optimization process.


Many thanks for you help !

 

The optimization actually helps you find the best optimal parameters for your EA; it doesn't mean the backtest will be 'faster'. I believe you're misunderstanding the tool.

When you run a simple backtest, you're running a single pass. When you run a fast optimization, you're running about 10,000 passes (may be more, may be less). When you run a slow optimization, you're running as much passes as possible, calculated from the selected parameters (it may be billions of those).

 
Emanuel Cavalcante Amorim Filho #:

The optimization actually helps you find the best optimal parameters for your EA; it doesn't mean the backtest will be 'faster'. I believe you're misunderstanding the tool.

When you run a simple backtest, you're running a single pass. When you run a fast optimization, you're running about 10,000 passes (may be more, may be less). When you run a slow optimization, you're running as much passes as possible, calculated from the selected parameters (it may be billions of those).

Hello, thank you for your reply.


Yes I understand that, but the passes on the optimization take almost 3h to complete, but when performing a single pass it takes only 30 minutes.

I understand that the CPU during an optimization is under a lot of stress but 6 times more times to complete a pass, it's a lot. 

 

It's not. If you take 30 min for a single pass, imagine how much time it would take to complete a fast optimization test under the same conditions for 10,000 passes (or even less; 1,000 passes) should take way more than 30 minutes. Maybe even days.

In theory, considering a inexistent time linearity, it should take passes * single_pass_time to complete the optimization. If a single pass takes 30min, 1,000 passes should take 30,000 min (500 hours or 21 days) to complete. The time is not linear, though, because some passes may execute more or less trades, in different time windows, etc., and thus some may take more time, whilst others may take less time.

Note that a single test will never be faster than an optimization run.

The ideal thing here is to use the profiler and check where your code needs to be improved to take less time to complete the passes. Also, if your EA doesn't need to check every single tick, try to use 1 minute OHLC or Open Prices modelling types, as they should increase the performance a lot. IMO, it's a good thing to optimize your code using those modelling types and then, when you have good passes, try each one using real ticks data to see if they match or at least are close to the results obtained in the optimization.