Speeding up backtest & optimization w/ hybrid bar intervals

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
User avatar
fbertram
Posts: 166
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 36 times
Been thanked: 76 times
Contact:

Speeding up backtest & optimization w/ hybrid bar intervals

Postby fbertram » 04 Jul 2016

I am working on a strategy that - for the most part - emits trades once a day. Unfortunately, these trades happen at the beginning of the session, so I can't use daily bars.

Instead of simulating with 5 minute bars and taking a huge hit in processing time, I am using a hybrid bar interval, with 3 bars per day:
* 9:35 - the 1st 5 minutes of the session
* 9:40 - the 2nd 5 minutes of the session
* 16:00 - everything from 9:40 to the end of the session

This allows me to simulate quickly while maintaining the intended accuracy. I have attached a little C program that converts 5 minute bars to the format mentioned before. It should be mostly self-explanatory and easy to tailor to your specific needs.

Cheers, Felix
Attachments
convert_interval.cpp
(6.56 KiB) Downloaded 518 times

Return to “User Contributed Studies and Indicator Library”