Inspired by T Smith idea to implement Gary's Antonacci's dual momentum approach to ETF
selection in "IN OUT" strategy.
-The execution code has been completely changed to keep levarage under control and avoid
insufficient buying power warnings.
-To calculate returns I used widely used in industry momentum with excluding period.
-Modified components that are more in line with the strategy.
-The IN OUT part of the strategy has not changed except for some cosmetics
to make it more readable for myself.
"DUAL MOMENTUM IN OUT" nearly doubled "IN OUT" Net Profit while maintaining risk metrics at the same level.
Compounding Annual Return
30.164%
Sharpe Ratio
1.667
PSR
97.773%
Beta
0.057
Drawdown
19.300%
Annual Standard Deviation
0.154
Here is my second version of "DUAL MOMENTUM-IN OUT".
Carsten
Hi Vladimir
good to see you again here...just some off topic question...i arrived as well from quantopian and try to translate/learn porting an algo from zipline. I did the tutorial and the framework they are using looks far better than quantopian but the warming up and other stuff is a bit nerve ripping...
Do you thnik it would be difficult to move that algo aboue into the quantopian framework concept?
# Universe Model self.SetUniverseSelection(MyUniverseSelectionModel()) # Alpha Model self.SetAlpha(MOMAlphaModel()) # PortfolioConstruction Model self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel()) # RiskManagement Model self.SetRiskManagement(MaximumDrawdownPercentPerSecurity(1)) # Execution Model self.SetExecution(ImmediateExecutionModel())
I translated already an algo with pre-set ticker, filtering and ranking, if you are intersted i dont mind to post it here. It still has some issus with warm up.
For me alone its quite hard, but I know that you are a very experienced programmer..
Moving to the framework it might a lot easyer to contribute as one only need to improve some modules and don't need to touch the whole code, and one can reuse a lot from other algos.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Vladimir
Hi, Carsten,
For zipline, you can skip warm-up and consolidation because they are built-in features.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Vladimir
Hi Carsten,
if you are intersted i dont mind to post it here
I have created thread Transition from Quantopian to QuantConnect.
You can post it there.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
T Smith
Great work. Adjusting the tradeout scheduling and using hourly rather than daily resolution for our signal instruments, I've managed to reduce drawdown.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Vladimir
T Smith
Thank for the improvement.
"Many a little makes a mickle".
There was a typo in the code on line 154.
I deleted the second "if".
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Vovik
In this backtest I used the original T Smith setup:
IN and OUT assets determined by momentum (IN: QQQ/IWF, OUT: TLT/IEF), 100 day simple return
Net Profit 2097.037%; Sharpe Ratio 1.743; PSR 97.247%; Drawdown 17.900%; Beta 0.026;
It also sufficiently beat the setup of Peter Guenther.
IN: QQQ:1, OUT: TLT:0.5 + IEF:0.5
Great job Vladimir and T Smith.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Nathan Swenson
Hello Vovik,
Did you fix the issue with the original T.Smith algo? It has many error in the log with invalid trades due to margin violation. I believe Vladimir's has fixed those issue, but trades different instruments.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
T Smith
Yeah, Nathan Swenson he is using Vlads corrected trade logic to ensure sells are placed before buys and leverage doesn't go beyond 1. He is also using the updated sheduling and resolutions. This gets us out the market quicker, but avoids over trading/rebalancing whilst 'IN'.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Vovik
Nathan Swenson,
In this backtest I have no margin violation warnings.
Here is the full log.
Algorithm Initializa: tion: Data for symbol DBB has been limited due to numerical precision issues in the factor file. The starting date has been set to 1/4/2007.
Algorithm Initializa: tion: Data for symbol UUP has been limited due to numerical precision issues in the factor file. The starting date has been set to 2/19/2007.
Algorithm Initializa: tion: Data for symbol DBB has been limited due to numerical precision issues in the factor file. The starting date has been set to 1/4/2007.
Algorithm Initializa: tion: Data for symbol UUP has been limited due to numerical precision issues in the factor file. The starting date has been set to 2/19/2007.
Algorithm Initializa: tion: Warning: when performing history requests, the start date will be adjusted if it is before the first known date for the symbol.
2008-01-01 00:00:00 : Launching analysis for b3e5c2897bc5099bb64e69aa0ecedcca with LEAN Engine v2.4.0.0.10016
2007-08-28 10:00:00 : Algorithm warming up...
2008-01-01 00:00:00 : Algorithm finished warming up.
2020-12-11 16:00:00 : Algorithm Id:(b3e5c2897bc5099bb64e69aa0ecedcca) completed in 631.42 seconds at 3k data points per second. Processing total of 2,197,238 data points.
Perhaps the problem is something else.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
T Smith
Vladimir regarding your comment on using more than one indicator to trigger the out of market. I have had a go at implementing it here:
Would appreciate your feedback!
Nathan Swenson this seems to solve the issue of SHY taking us out the market without another signal.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Goldie Yalamanchi
That's really great T Smith I am not a huge fan of FDN or QQQ but this strat looks great! Quick question...
Are these the only changes to code to change if you don't want 5 signals as the IN/OUT? Say 4 or 3 for example...
pctl = np.nanpercentile(mom, 5, axis=0)
if self.no_signals > 5:
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
EllaHamilton
a great algorithm, we will test it on a large scale, and then leave you a review.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Guy Fleury
This strategy, like its predecessors in the other 2 or 3 “...In Out...” threads, is totally dependent on its up/down trend declarations. And the first question to ask should be: How reliable is this trend definition?
I see the strategy as a variant to a 60-day over a 252-day moving average crossover to bond switcher, but still responding to daily price variations. The advantage goes to being long for longer periods than being in bonds. And this translates - in an upmarket - to taking a higher average percent profit than when it loses a trade (about 2:1). And there, even with a hit rate in the 50s, you are bound to make some overall profits just for playing the game.
The above chart illustrates where I'm at presently. There was some leveraging (1.4x). Not excessive when compared to the 89.86% CAGR. The strategy could more than afford to pay the leveraging fees. 3x-leveraged ETFs were used which made the strategy behave the same as if leveraged by 4.2x. The initial capital was set at 100k as most here. Increasing the initial capital to 1 million did increase performance about 10-fold since the strategy is fully scalable.
To get there, I modified a few things. One of interest might be the following section:
mom['S_G'] = (mom[self.SLV] - mom[self.GLD])*0.0 mom['I_U'] = (mom[self.XLI] - mom[self.XLU])*0.0 mom['A_F'] = (mom[self.FXA] - mom[self.FXF])*0.0
which flatlined most of the momentum signals leaving only UUP. Why do this? It resulted in higher profits. It also said that those signal components were not needed or could be considered as irrelevant to the task at hand. There is a lot that could be said about this strategy's strengths and weaknesses.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Hannes R
Hello Vladimir and all,
I see your many contributions and I am still a complete newbie, thank you for sharing all these invaluable insights and your experience online for everyone to learn from and contribute too (me too hopefully, one day).
I will need to spend several hours to understand your code and the logic behind , (would be great if there were comments in the code explaining the logic =D) but have some question around lookback bias in the meantime. This strategy is almost too good to be true - what are some of the items in here that may have lead to over-optimization? I see Guy Fleury's expert critique on the MA crossover periods defined a fixed value, what are some of the other things? Would you say that the asset selection could also be biased?
Thank you for your teachings!
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Vladimir
Guy Fleury,
I am aware of your incredible ability to send any profitable strategy into the sky since we
discussed Andreas Clenow's momentum in 2017.
It's no secret, but simple math, that if you use 3x tools and apply a 1.4 leverage to
a strategy with 30% CAGR you should get much more than 150% CAGR.
You got 89.86% CAGR because these 3x instruments only started trading in 2010.
The decision to use 3x tools and a leverage greater than 1.0 is usually made
at the last stage of development strategies.
Before that, we must use 1x tools and use 1.0 leverage for compatibility of results.
I can also see that you are starting to improve the strategy in the right direction by
cutting half the sources.
Hopefully I can see results where you apply pressure points and other tools from your
toolbox.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
T Smith
Hi Guy Fleury
Great to see you in the discussion,. I have played with using just dollar as our signal, and have decrease sharpe considerably. whilst bring beta to 0.5.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
T Smith
Vladimir totally agree. Best to build an algo with no leverage and just look to improving sharpe ratio. Leveraging later is then an option. Have you had much of a look into the concept of requiing more than 1 signal to exit the market?
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Vladimir
T. Smith,
I don't have a solution right now, but I definitely want to either change the decision logic or reduce the number of sources.
Two months ago, this algorithm had only 4-6 sources and much fewer parameters.
I have played with using just dollar as our signal.
USD in this strategy has a negative sign.
mom[self.UUP] = mom[self.UUP] * (-1)
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Guy Fleury
@Vladimir, your version of this trading strategy was already tested with 1.0x leverage. My task is to find out if it can scale up and do more, including to see if it can support leveraging in order to find the strategy's operational limits. Something I need to know before the end of the testing process. Otherwise, I will be wasting my time if those limits are found nearby, later, or much worse, after going live.
The way we test trading strategies, they have to generate all their profits from within, no matter what trading methods we use. There are no external funds added during a simulation. The tools we have are part of better stock selection, better timing, better gaming, better process amplification, better trade modulation, better protective measures, etc...
Leverage can be used over selected time periods where you anticipate for whatever reason that it will increase the potential return on your trade. It is like saying: you do not use it all the time, but can use it where you think it might count.
Nonetheless, it is a CAGR game, and basic math will matter. You can apply limited leveraging when your added alpha exceeds leveraging costs (here, the alpha being the excess return over the market average).
You want to know the strategy's limits before your “feasibility” simulation study ends. I have looked at many strategies that do not pass these basic tests. I usually lose interest quite rapidly and expedite their journey to file 13.
Here is a fun observation. After flatlining 3 of the signal components, we are left with a minus UUP. The thing is that if you reverse this signal to +UUP you should see the strategy lose a lot of money. But, if you do this, you get about the same profits, within 0.5% of each other on my 1 million initial capital scenario. Putting into question the “real” value of that signal? Note that you still get a little more with the negative signal (-UUP).
What kind of signal, that it be negative or its reverse, can produce about the same results? I would venture one that does not matter which side it is on.
How about flatlining UUP making the strategy having no switching signal, no trend definition? What would be the result? Such a move reduced overall profits by almost half (-49%). But still managed a +91.25% CAGR compared to the 98.73% and the 98.49% CAGR in -UUP and +UUP respectively. Therefore, UUP's presence was worthwhile, while its predictive powers were nil since you made about as much that UUP declared the trend up or down.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Vladimir
Guy Fleury,
This strategy yields good results, but I don't like just one word in the code in line 124,
and that word is any()
if (extreme[self.SIGNALS + self.PAIR_LIST]).any():
Just imagine that you are the president of the United States.
You invited the top twelve generals of the country to help you make decisions whether to start
a war with country x or not.
Eleven generals said no, but one said yes.
What will be your decisions?
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
HughStryker
Thanks for the update!
I'm happy that Jovad included an options straddle, as I was planning to replace VXX in the Dragon portfolio with a rolling straddle on SPY to serve as the long vol component. As I haven't used options in QC before, Jovad's algo is very useful as a starting point.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Sairaj Patil
This is amazing Derek Melchin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Jovad Uribe
Hi everyone,
This week Derek built a strategy he heard on episode #10 of the Better System Trader podcast. The guest, Perry Kaufman, explained the strategy idea came from George Douglas Taylor in the '50s, but Derek reversed the strategy rules. The strategy trades IWM and QQQ, and the backtest can be viewed here. It generates a 0.845 Sharpe ratio and a drawdown of 2.7% when backtested over the last several years.
Adding this strategy to the InternFund algorithm increases the diversification as we do not currently trade IWM or QQQ. Although the historical Sharpe ratio decreases slightly from 1.931 to 1.902, the compounding annual return increases from 6.845% to 7.019%, and the max drawdown decreases from 3.8% to 3.3%. With this new deployment, our backtest has a max drawdown of just $1,379. This deployment (with an increased max drawdown limit) is attached below.
Shile also built a Risk Parity strategy inspired by this article. During his research, he noticed that the drawdown was a whopping 43.4%, outlined in this backtest. To reduce this drawdown, the effects of risk parity were increased by shorting TBT, a -2x 20+ Years ETF, which gives us a positively leveraged position. Then, the dip of SPXL was bought, then sold using the Risk Management inspired by this Strategy Library Addition. See the results of the strategy here.
Previously, Ernest mentioned that our 60:40 strategy would exceed a 100% allocation ratio. We added an update to this strategy ensuring that it does not exceed this ratio. The line we updated is:
quantity = self.CalculateOrderQuantity(ticker, weight * self.SF_AR / sum(self.weight_by_ticker.values()))
Tamim Fund pointed out that our Fibonacci Option Straddle was primarily purchasing Apple. We converted the strategy to the algorithm framework and added a dynamic universe selection model to remove look-ahead bias. To further clarify the strategy's logic, if the market sentiment of a stock is down, the bid price for the call option will decrease and fall below the retracement level, causing a sell. If market sentiment is up, then the bid price may cross above the retracement, causing a buy. Many TA traders use this strategy, but their execution may take some time. The strategy attempts to enter the same position but quicker. I have attached the backtest here. As we cannot implement this in the InternFund, we will not continue with it.
As for the InternFund's performance, here is a screenshot of our latest track record.
This week our strategy lost 0.099276% of its value while SPY gained ~1.8%. Although this is a small setback, we aim to improve our algorithms alpha of 0.067.
Our backtest produces a whopping Treynor ratio of 2.298. It is no surprise that this ratio is high because the current risk-free rate (10YR Treasury Rate) is at a low 0.69%, and our beta of 0.031 is also low. However, this is one indication that our algorithm is a worthwhile investment.
Thanks for tuning in for this week's update. Constructive criticism and feedback help us build better strategies for the fund. Stay tuned for more updates!
Cheers,
Jovad Uribe
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Shile Wen
Hi Everyone!
We are planning on continuing the InternFund past summer!
This week, we are allocating 5% of our portfolio to Taylor Robertson’s post on using Leveraged ETFs. This led to a .4% decrease in drawdown as well as a 1.7% increase in the CAGR. Furthermore, our strategy is now very close to a Sharpe of 2.0, sitting at 1.98. After that, we increased the ratios of our existing strategies to take advantage of the cheap leverage offered by IB, and the new deployment algorithm is attached below.In addition, I also implemented a very simple seasonal strategy described in this article, and the results can be seen here. The high drawdown of 11.4% did not justify the returns of only 4.356%, so this strategy will not be making it into our InternFund algorithm.
Derek implemented an ETF rotation strategy that was sourced from RotationInvest. During each monthly rebalance, it calculates the trailing 3-month Sharpe ratio of SPY, EFA, and GLD. For the top-ranking ETF, it'll invest in it only if it's trading above its 150-day simple moving average. Otherwise, it allocates 100% of the portfolio to a bond ETF (TLT).
When backtested since 2015, this strategy generates a 1.218 Sharpe ratio and an annual standard deviation of 0.118. By comparison, the S&P 500 produces a 0.712 Sharpe ratio and 0.185 annual standard deviation over the same period. See the backtest results here. We will add this strategy to the deployment algorithm next week.
Furthermore, Jovad implemented the Golden Butterfly Portfolio from this article in this backtest. After a few alterations, he achieved a relatively low drawdown at 4.4% and a CAGR of 3.9%, and the updated backtest can be found here. Unfortunately, when added to our algorithm, the drawdown increases while the CAGR decreases (backtest), so it will not be making it into our live deployment.Our updated track record can be seen here:

And we are only $1 away from a new equity high!
Best Regards,
Shile Wen
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
HughStryker
Thanks for the update, Shile. What the InternFund is doing is very cool and I'm learning a lot.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Derek Melchin
Week 7: A Little Turbulence
Hi everyone,
The InternFund had a sharp increase in volatility this week. However, we are still within our allowed max drawdown of $1000. Here's an image of our live track record over the last 7 weeks.
This week, we built a few more strategies with the hope of adding more to the InternFund algorithm.
Shile worked on a trend following strategy that measured the strength of the trend using an Ordinary Least Squares (OLS) model. When the past 50 days of close data have an r2 > .7, and the (current price - the average of the absolute values of the residuals) is at least the predicted value from the OLS model, we hold SPY, else, we liquidate our position. This model only had a Sharpe of .475 with a large drawdown of 34.2%, so this strategy will not be making it into the InternFund. The backtest can be found here.
I built a strategy that was inspired by Scott Andrews (aka "The Gap Guy"). Each market open, it fits a linear regression model using overnight gaps as the independent variable and the open-to-close returns as the dependent variable. It trains the model using the previous 10 weeks of data, using only weekdays that match the current trading day. After the model is trained, it predicts the direction of the current day's intraday return given the overnight gap and places its trade. The strategy achieves a 0.488 Sharpe ratio when backtested since 2015. See the backtest for reference. Since this strategy underperforms our benchmark, we didn't integrate it into the InternFund algorithm.
I also built a strategy I sourced from InvestiQuant that takes advantage of the long-bias in traders after a bull market breakout. Whenever the SPY has a multi-month breakout during a bull market rally but then gaps down into the next open, the strategy longs from the open until 15 minutes before the close. Backtesting the strategy since 2015 generates a 0.991 Sharpe ratio, outperforming the buy-and-hold Sharpe ratio of 0.742. See the backtest results here. After integrating this strategy into the InternFund algorithm, the Sharpe ratio of the algorithm backtest increases from 2.103 to 2.161. See the attached backtest for a copy of our latest deployment (with an extended drawdown limit).
In regards to the ETF rotation strategy we published last week, there was actually a bug in it. Line 71 should have read
if data[top_symbol].Price >= sma:
instead of
if data[symbol].Price >= sma:
After fixing this, the strategy underperforms the SPY, so we did not add it to our live deployment.
Thanks for tuning in for our weekly update!
Best,
Derek Melchin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Mark Reeve
Hi guys,
I am wondering is it possible to combine several strategies like this using the algorithm framework?
Is there a reason you chose to avoid using the Algorithm Framework, other than simplicity?
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Shile Wen
Hi Mark,
It would be possible to combine these strategies using the Algorithmic Framework, however, we chose to stick with the classic algorithm because it is easier to account for multiple strategies.
From my experience, an algorithm developed using the Algorithmic Framework is best suited to a single signal type, however, our algorithm is a Frankenstein’s monster of various strategies that aren’t related. If we were to divide up our algorithm strategies into separate projects, then it would totally be viable for us to use the Algorithmic Framework on the strategies individually.
Best,
Shile Wen
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Samuel Schoening
You guys have helped me a lot so I just wanted to reach out and make sure you know that the orders for VXX may not be executing as you go back in history. This is because the price was over 30,000 in 2010 due to countless splits. Same goes for UVXY. The data is not adjusted so the order will not fill. That is why I just trade with 1 or 100 billion dollars in my backtests lol. With that said, this is very compelling research and do please keep up the good work!
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Josh M
It has been a few months -- any live trading update from the intern team?
Cool project and great work!
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Zicai Feng
hey interns, your self.max_dd is a fixed amount, should change it to a ratio as a % of the portfolio value. Because as your portfolio gets bigger due to profitable trades, a fixed amount that was set during a smaller AUM will just terminate your strategy randomly. I am sure Jared would understand and let you risk a fixed % of AUM rather than a fixed dollar amount with a fluctuating n growing AUM
Keep up the good work and build those RenTech libraries!
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Derek Melchin
Hi Zicai,
Thank you. We will adjust the drawdown limit if the InternFund is launched again this summer.
Best,
Derek Melchin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Zicai Feng
Hope it gets launched again :). Btw, similarly, your stop loss limit in your tesla example is a fixed amount. Similar reason to above, it should be a % number not a fixed $ amount as tesla price is all over the place depending on the price of dogecoins
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!