Back

A Simple Tactical ETF Strategy

The strategy logic is simple but sound: aim to stay invested in stocks (better long-term returns), but switch to bonds (safety) during market crisis.

This is an implementation of a strategy I published at my blog. It is not exactly as described at the blog post, but it does not materially impact the results. See the original strategy at: This Simple Strategy Can Beat The Stock Market.

The code is very simple and self-explanatory but be warned that my python skills are not great... so my coding style might be a bit "unusual".

Any feedback is welcome. I'd appreciate.

If you have any questions, I'd be glad to answer.

Have fun!

PS: I am new to QuantConnect strategy testing... so I could not manage to have a daily equity curve ploted... the benchmark curve is also missing... anyone knows how to solve those little issues? Thanks!

Update Backtest








I am not 100% but I was having the same issue. I think it may have to do with setting SPY at Resolution.Daily. Try setting the resolution for both of the ETFs to Resolution.Minute and then add self.SetBenchmark("SPY") after you do self.AddSecurity. Then you should be able to go to the chart and select "Benchmark" from the dropdown to display correctly.

2

Thanks, now I can see the correct benchmark!

0

A Short Disclaimer​​​​​​​​​​​​​​​​​
Note that I am not a financial advisor, and all content (strategies, code, ec.) is presented here “as is” and on an educational and informational basis only.

0

ricardo_ribeiro your website/webserver is not working.....

i wanted to check what kind of other strategies you posted :)

1

hummm... strange,,, it seems fine to me...

PS: also look at the menu link "app"

0

ah... there is some issue with the redirects using firefox... i am looking into it...

0

looks like it is taking a while to update the redirects...

you can use new link:

https://www.upbias.com/blog/simple-strategy-can-beat-the-stock-market/

0

Thank you michael_manus for pointing out the redirect issue! I hope it is solved now...

0

Hey all, 

I've just put a link at my blog post pointing back to this discussion... i hope it is not a problem... 

but if it is, please tell me... so i can remove that link.

0

No problem Ricardo; we welcome unique/new strategy sharing & discussion from commercial entities as long as its about the science not sales (so you're fine). I recommend copying the embed code from the bottom of the backtest result (on sharing tab) and then you can embed the backtest result directly into your blog. 

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.


Great, thanks!

0

Update Backtest





0

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.


Loading...

This discussion is closed