Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Backtester Performance Issues
 Post subject: Backtester Performance Issues Post rating: 0   New post Posted: Wed 13 Jul, 2011, 09:23 
User avatar

User rating: 0
Joined: Wed 13 Jul, 2011, 09:06
Posts: 8
Location: Australia, Quakers Hill
Hi Support,

Here is a scenario, i am backtesting using M1 Bars (programmatically ignoring any other bars) over 2.5 years for Instrument EUR/USD.

1. If during the whole backtest no trades are open the testing finishes in 1.7 minutes.
2. If during the whole backtest only trade is left open for 2.5 years it takes 2.4 minutes to finish.
3. If during the whole backtest 500 trades are left open for 2.5 years it takes 20 minutes to finish.

4. For the last scenario if I add to it loops to go through open orders to identify profit trades then it takes about 60 minutes to finish.

Now first of all internal optimizations need to be done to fix point 3.

For point 4 I can immediately see that if I don't use the M1 timeframe then it's going to speed things up but the other problem then is that if an order doesn't get open let's say on a daily bar signal and it gets rejected for whatever reason then that bar is not going to repeat itself and an opportunity would be missed.

Do you guys have a solution for this?

The only thing I can think of is to may be make strategy actions somehow event driven but then I will be concentrating too much on optimization and maintenance rather than the strategy itself.

Regards,
Riz


 
 Post subject: Re: Backtester Performance Issues Post rating: 0   New post Posted: Fri 29 Jul, 2011, 08:26 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
It is rather straightforward that the more evolved the logic of your strategy the more performance-costly it is. What you can consider is creating and maintaining objects as little as possible, calling indicators only in necessary ranges, calling IHistory methods only when necessary (e.g. if you always need the time of the previous bar, instead of calling getBar(), just set a reference to the bar, for instance, IBar lastAskBar=askBar, at the end of each onBar call), etc.

Depending on your strategy, you should judiciously choose in Historical Tester any other period than Ticks. Since the bigger the chosen bar period in historical tester, the greater the approximation - in Historical Tester when you choose bars, they actually get approximated into a range of ticks (since the platform works with ticks). For multiple cases such approximation brings a significant difference in testing results, compared to results when all ticks option was selected. So the perfomance's trade-off is the precision of results.


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com