Here is a simplistic strategy that can add leverage to an IRA for better absolute and risk-adjusted returns. Inspired by the Seeking Alpha article, it uses just three funds and rebalances every 2 weeks. The article discusses UPRO, but I used TQQQ instead because I expect the recent outperformance of the underlying index to continue in the future. Even with the recent craziness, its worst drawdown is 26%.
Due to the 3x leverage, it's not for the faint of heart.
https://seekingalpha.com/article/4299701-leveraged-etfs-for-long-term-investing
Pangyuteng
Very nice! I couldn't help myself, I had to add TVIX (this used to be x3, but now it is just x2 leveraged!). Beta is reduced by 0.3.
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.
Taylor Robertson
Ted - the addition of TVIX is a great idea. I sell options as another part of my portfolio, so reducing beta (and improving a number of the other metrics), while adding some long vol is a win-win for me.
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.
Grant Forman
Great job! Changing the execution to weekly (+20 minute start) and applying the composite risk management model (MaximumUnrealizedProfitPercentPerSecurity = 0.13 % and MaximumDrawdownPercentPerSecurity = 0.17 %) Gets the PSR to 97% and a dd of 15.3% - which for 3x stuff aint too shabby...
...Adding the composite risk model (in my view) is a good secondary backstop against the volatility/bonds hedge which may not always follow past paradigms...:-)
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.
Grant Forman
....in fact one can also integrate a small % of UGLD and USLV (5% each) as a complementary yet distinctive portfolio hedge to keep a 95%+ 10 year PSR and bring the max dd down to less than 13%...
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
Grant thanks for usage of the risk modules
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.
Michael Boguslaw
Hi everyone, I'm still pretty new to algorithmic trading. I've heard that if something seems too good to be true, it probably is. A 25% Compounding annul return seems incredible, especially over a ten year span including the recent market crash. Am I missing something or is this algorithm really just that good?
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.
Eric Le Guerroué
I understand its good results are linked to past strong increase in both stock prices and long term bonds. If in the future both crash, results could be potentially catastrophic for portfolio with such strong lever. It could happen in the future if short term bond price rise combined with a lasting depression.
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.
Anthony FJ Garner
As per Wikipedia:
The Federal Reserve board led by Volcker raised the federal funds rate, which had averaged 11.2% in 1979, to a peak of 20% in June 1981. The prime rate rose to 21.5% in 1981 as well, which helped lead to the 1980–1982 recession,[22] in which the national unemployment rate rose to over 10%. Volcker's Federal Reserve board elicited the strongest political attacks and most widespread protests in the history of the Federal Reserve (unlike any protests experienced since 1922), due to the effects of high interest rates on the construction, farming, and industrial sectors, culminating in indebted farmers driving their tractors onto C Street NW in Washington, D.C. and blockading the Eccles Building.[23] US monetary policy eased in 1982, helping lead to a resumption of economic growth.
The long bond suffered a 40% collapse in price at that time.
Might I suggest that would not have been a good period to have been invested in leveraged bond funds? The trouble with back testing and back testers is that they usually fail to take the long view, to look back at history and see what has happened and could easily happen again.
One lesson people stubbornly refse to learn is the danger of leverage when it all goes tits up. Remember LTCM!
Another lesson people fail to appreciate is that at times the long bond is 90% or more correlated to US stocks. Stock price collapses have reached levels of 90% or more in the past. The period 1929 to 1933 would not have been an enjoyable time to be invested in geared equity funds.
It does not take much imagination to see that periods may arise when we could see a catastrophic decline in both equities and bonds.
The motto is: "Study History".
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.
Taylor Robertson
All good points about the danger of backtesting and history. I think the best solution to that is diversification of non-correlated strategies. As I said in my original post, 3x leverage is not for the faint of heart.
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.
Taylor Robertson
Also, I think the post GFC era of monetary policy is different than prior to that, as witnessed by the Fed never getting rates above low single digits in recent years, before dropping them again. Then again there are plenty of cautionary tales about, "this time is different" in the market and they usually end in catastrophe.
Which brings me back to, I think it's best to not try to predict where the market is going, rather I like to diversify across strategies.
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.
Anthony FJ Garner
Yes, I think that a refusal to predict or to have to predict is absolutely essential. The only protection in investment is diversification - although even that is looking suspect these days! I find myself wondering whether interest rates will have to rise with the massive amount of sovereign debt being raised or whether we will continue to print money and thus enter a Weimar Republic.
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.
Grant Forman
Yep - I agree - I would be in favor of an active system that ichooses one of GLD, TLT, QQQ based on a technical signal and includes cash as a 4th component if the signals for GLD, TLT and QQQ arnt green. That approach is likely more sustainable in the long run, since correlations/cointegration between GLD,TLT and QQQ/SPY can always change.
Is anyone up for a colab on this? Backtested since 2005 thus far I have an algo based on the above 4 way system as a PSR of 88%, weekly rebalance.
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.
Juhwan Kim
I am sorry for asking stupid question.. but in the original post, what does "self.rebalance" do?
It was used only one time..
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.
Bart van den Broek
Juhwan, the call to rebalance is scheduled by means of that self.Schedule.On(...) function call.
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
TVIX is not actually bought in most algorithms people use it in. This is because its price history is not adjusted for the many reverse splits in the past. I thought I had something great until recently realizing that I had not actually had enough money to buy TVIX at its theoretical price for the first 6 years of my backtest
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 Grant Forman, I have been working on a similar strategy to this (using Gold, Treasuries and Stocks based on a technical signal and includes cash as a 4th component) both with ETF's and using Futures. Would be more than happy to share knowledge and try a colab.
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
Good spotting Samuel Schoening.
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
Using the code below the first trade date I get for TVIX becomes 2/12/2013. RawData should fix the issue as we are not using any indicators with this strategy.
for t in self.tickers: self.Securities[t].SetDataNormalizationMode(DataNormalizationMode.Raw)
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 hatlan
Thanks for sharing Taylor.
This is a really good idea. I've liked leverage ETFs for years, but I haven't modeled a group like this. However this return doesn't show catastrophic drawdowns like in 2008-2009, so that is something to be aware of, but I've done something for that.
In a crash 3x lev ETFs can lose up to 99.9% of their value. Everyone should read "Leverage For The Long Run" to see the implications of holding 3x without a timing signal over a century of SPX: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2741701
Quite simply leverage is a great tool for long term investing as long as you avoid downward volatility, So i took Taylor's first model and built the logic to invest in all 3 leveraged ETFs if SPY>200 SMA, and go to cash if SPY<200SMA. I also used Ted's weighting to give TQQQ 50% allocation when invested to give returns a little boost.
This I would be very comfortable trading since it gets you out of the market just in case, but returns are still 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.
George Sanders
New here so apologies if these questions are dumb
I have been looking for something like this for ages - fascinating work
mark hatlan - apologies my reading of code is not fantastic - when SPY is below 200SMA do you dump the entire portfolio i.e. TQQQ and Bond ETFs and then allocate 100% to AGG until SPY is back above 200SMA
Also, why rebalance every week / 2 weeks and not yearly?
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 hatlan
Yes, when SPY's closing price is less than the 200 Simple Moving Average sell all Leveraged ETFs (if long) and go to cash. The code I put went to plain cash when SPY<200SMA down in the "Else:" line.
You could go to SHY, IEF, TLT or AGG, or any combination of those to move into risk off positioning for example. The point is to have a bull/bear market timer to get you to a risk off position to preserve capital. Once the market changes, you can back to a full risk on position. This is where the 3x leverage will give you good alpha over time.
As for the market timer logic it doesn't have to be SPY<200SMA. There are lots of ways to determine a bull/bear cycle. If the 6 month percent return is less than 0%, the number of down days over the last few months is greater than the up days, etc. Look for some white papers that include market timer logic for more examples.
I'm a trader tying to learn to code, so I hacked this together, I'm not 100% certain this code is error free ;)
The 2 week rebalance is not as critical in Taylor's version, instead it keeps the allocation consistent. But when there is a market timer involved the rebalancing schedule becomes critical. If you were to only rebalance every Jan. 1, then you will get out of bear markets too late and get in bull markets too late, so you may not achieve any alpha. Daily rebalancing is too often in this case. However when you switch to weekly, bi-weekly, or even monthly, then you get in that sweet spot to get out of a bear market in time and get in a bull market early enough to capture those gains.
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.
Jack Pizza
You guys might find this interesting similiar idea without all the 3X for potentially issues.
https://www.quantopian.com/posts/new-strategy-in-and-outThe 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 Elsid,
Thanks for sharing. Since Quantopian is shutting down, users can proceed to this thread instead.
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 hatlan
Thanks. I'll check the in and out thread.
Also after looking at the above backtests I found that TVIX is not bought until the last few years, there may be a data problem.
So I've put this together with futures (a simple version without complex rolling code that is out of my skill for now). This allows the /VX to be used instead of TVIX. Interesting thing is that the futures version doesn't perform as well as just the plain TQQQ/TMF 50/50 model.
I've even tried using TQQQ/TMF with /VX to help with volatility, and it doesn't help either long or short /VX.
After looking at this original strategy more closely I take back my original comment about a risk off signal being needed, I do think that this strategy is hedged enough to not need a long volatility or a go to cash 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.
Samuel Schoening
mark hatlan this is something I have found on previous renditions of this strategy. It is not buying TVIX or what is now UVXY because the data is not split adjusted. Therefore the price of those is over 1 billion dollars a share upon their inception lol. Also rip everyone using TLT and thinking that GLD was an inflation hedge. Last few months were absolutely brutal.
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
mark hatlan Feel free to check out my own exploration of this passive rebalancing concpet using the following hedges: SCO -2x oil, GLD (as inflation hedge *theoretically :( 2021), and TMF (3x long term treasuries). As equities we have QQQ, SPY, and IWM. It is a great plan long term but inflation poses biggest risk. I recommend a swap to UVXY or simply cash if you believe a high degree of inflation is coming.
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 hatlan
Yeah gold has been quite a ride the last 20 years. The recent commentary around how gold is not the inflation hedge it once used to be remains to be seen, at least if we ignore the last year and look ahead 10 years. If gold has truly changed its inflation correlation, then there has to be something large money managers are using to replace it. I haven't looked so I don't know what that could be.
Its interesting you have inverse oil in there, I haven't looked at that before as a hedge.
But why do you have SPY, QQQ and IWM? wouldn't it be simpler to have just 1? even if it was the one with the strongest upward trend.
Here is another example on stock and bond hedging using the last 100 days standard deviation, and using that as a timer to either be 100% in TQQQ or reduce TQQQ allocation and hedge with bonds. Really there are countless ways of putting in some sort of timer to hedge, I've only explored a handful.
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
@Mark Hatlan, Be careful with your use of STD - I believe what you want to compare is the STD of RETURNS not the STD of Prices. Obvisouly comparing STD of prices is pointless as the STD of a higher priced stock will almost certainly be higher - irrespective of their respective volatilities (of returns).
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 hatlan
Yes you are right in that a straight comparison of STD between two differently priced data sets is not apples to apples. STD of the % return is certainly a good way of doing that. Do you have an example of this we could look at with this strategy? Seeing that code would be a great help to us lesser experienced with python.
My example above was not a normalized method of comparing STD, but just an example that if one wants to switch the allocation around with this portfolio with a bull/bear trigger there are unlimited ways of doing so, perhaps STD in some way can help improve this strategy generally as opposed to a static 50/50 or other ratio.
It would also be helpful if someone with better coding experience than myself could take a stab at using /VX futures for the long volatility hedge, it may prove better than the TVIX and VXX that have astronomical historical pricing in the backtests.
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 Mark,
To get the STD of historical returns, we can use IndicatorExtensions.
IndicatorExtensions.Of(StandardDeviation(100), self.ROC("QQQ", 100, Resolution.Daily))
We just need to ensure we increase our warmup period to accommodate.
self.SetWarmUp(200, Resolution.Daily)
See the attached backtest for reference.
For an example adding the VIX futures index, refer to this related thread.
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 hatlan
Thanks Derek, I didn't know about the indicator extentions. I'll check out the VIX thread too.
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!