Good work Saba. Easily written and quick.
I actually made a quick adjustment to the metrics that made a decent improvement. Thanks for making the algo easy to read and organized to do so.
Summary:
- Raised the beta by 0.01,
- Lowered the max drawdown by about 4%
- 4% Higher returns.
- Better sortino with SPY.
Made the adjustment all based on a twitter quote I saw years ago by a hedge fund manager. And he got the quote from another hedge fund manager even more years ago, "Amateurs trade before 10:30." Now taking that with a grain of salt and taking out the egotistical sentiment behind it, in practice, I've seen volatile trades happen in the first hour or so, and likely mean revert later on in the day. I at least believed this held true. I believe it definitely holds true in high volume large caps after an earnings jump. With a mean reversion volatility strategy like this, I felt it might actually make a quantifiable difference and appears as if so. Simply had the trading occur 2 hours and 29 minutes into the market open. (29 minutes because of maybe other algos out there trading at the 30 minute mark back then, because it's a nice round number). Here it is!
Note: May play around some more with extra changes, but here is a small change you can incorporate into this and many other algorithms to get seemingly better results, rather easily.