Back

Simple Global Rotation Strategy

Here's a simple global rotation strategy I threw together this afternoon. The idea here is to have a set of 'growth' equities that are geographically dispersed and to rotate through them each 'rotation interval' (nominally set to 30 days) based on some Objective value function. The given objective value function here is very simple. I'm just looking at the recent monthly performance of each of our 'growth' equities, but we could make anything part of our objective score. If all of our 'growth' equities signal that they aren't growing (that is, an objective score of less than zero) then we should just hold cash (or some other 'safety' asset). You'll notice on the curve there's some delayed weakness around local topping events. This effect could be removed through a better objective function. In the future I'll throw together another example using some indicators as objective function inputs (EMA ratios, RSI, MACD)
Update Backtest








I am new and I am interested in extending your algo as a sector ETF rotation strategy. However, there are something I don't get, like this, in 2003-02, the algo uses all cash to buy SHY, I am not sure why it'll try to buy more in 2003-03. Is that intentional? Or should it just hold when the top symbol is the one you have?

2003-08-06 09:31:00 MDY $77.4250 Market 95 Long Filled
2003-07-07 09:30:00 MDY $77.9410 Market 189 Long Filled
2003-06-04 09:31:00 MDY $76.1790 Market 386 Long Filled
2003-06-04 09:31:00 IYF $61.3630 Market -480 Short Filled
2003-05-05 09:30:00 IYF $58.5420 Market 480 Long Filled
2003-05-05 09:30:00 ILF $6.5770 Market -4288 Short Filled
2003-04-04 09:32:00 ILF $5.8610 Market 4288 Long Filled
2003-04-04 09:32:00 SHY $65.1340 Market -577 Short Filled
2003-03-05 09:31:00 SHY $65.1160 Market 191 Long Filled
2003-02-03 09:30:00 SHY $64.7560 Market 386 Long Filled
0

Glad to see your interest in this one!

So it turns out that the reason this is happening is due to the algorithm not using all of its buying power to make the purchase. In the algo I use cash/close to determine a quantity. I think use the Order function to order that number of shares. The problem here is that the default leverage is set to 2x, so when I order those shares, it only uses half of my capital!! Because of this, there's cash left over to spend on more shares later.

You can resolve this issue by using the SetHoldings function or by using the GetBuyingPower(symbol, direction) function on the Portfolio object instead of the Cash property.

Let us know how it works out and maybe post your algo when you're happy with it!!
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