Here's a slight modification I've made to Tomer Borenstein's "Global Market Rotation". I've altered it slightly to help beginners (like myself) more easily play around with different combinations of three different ETFs and momentum time period. Beginner coders will enjoy the simplicity of this script. The default settings are a rotation between SPY, IWM, and SHY based on the best 50 day price change. The script selects the ETF which returned the highest gain over the previous 50 day period.

IWM is the largest small cap ETF and the second most active ETF next to SPY. Since 1978 the S&P 500 returned 11.7% annualized with 15% volatility. The Russell 2000 returned 10.3% with 19.5% volatility. During different time periods large caps or small caps may outperform the other.

During periods of weakness in SPY and IWM, money is moved into the iShares 1-3 Year Treasury Bond ETF which has a 10 year standard deviation of 1.35% and return of 2.35%. Alternatively considering current rates you could likely just move to cash for similar results!

Currently the results are promising with 68% win / 32% loss ratio, 8.45% CAGR from 2007 to current, 20.8 drawdown, and 0.6 sharpe. Although this strategy returns a lower CAGR than a 10 year SPY 'buy and hold' return of 10.64%, the drawdown is much lower compared to the 55% drop in the SPY during the last recession.

I've limited coding skills so please make suggestions!