Here’s a question from Hanns K. (name used with permission) about optimizing based on time of day.
Hanns K.
About brute force vs. Strategy Cruncher: the speed of optimization is impressive and definitely faster than brute force by several orders of magnitude.
Using my systems for intraday futures trading, I found that time filters are among the most powerful ones. So I allow trading during a certain time window each day only and also close trades at a certain time. I was wondering if you see a possibility to incorporate time filters into the approach. Of course it would be possible to filter out certain trades completely based on the opening time of the position but I think this would not give the complete picture.
Dave
You’re right, time of day is an important filter to consider.
If you’re not considering time of day, I can guarantee you’re taking a lot of trades that you shouldn’t be.
So how do you determine what the cutoff should be for time of day? And is using a cutoff for time of day even worth it when considering other columns that could be even MORE predictive?
Here’s the approach I use.
For time of day, I don’t use a timestamp (which doesn’t help much), I use the number of seconds since the market open.
So, for example, if the trade enters at 9:31:00, the value for the seconds since open column is 60 since the market opens at 9:30:00.
Premarket numbers are negative (which is fine), so a trade that enters at 9:20:00 is -600 (-10 minutes X 60)
.
This normalizes time of day into an integer that you can feed to the cruncher.
Now, the cruncher can tell you how relatively predictive time of day is compared to dozens of other columns in your backtest.
Once you see how important (or not) time of day is compared to other columns, you can decide to use it or not in your strategy.
It can also lead you to completely new strategies based on the findings.
For example, if time of day is predictive, you can restrict your strategy to a tighter window of time and loosen the remaining filters to find more profitable trades during the most profitable time of day.
Great question, Hanns K., and thanks for sharing this with the group.
-Dave