Based on my Twitter post, here is the complete RealTest code for the SPX momentum rotational system. The backtest is done using Norgate Data and includes commissions and delisted stocks.
The code is for registered users only (but registration is free).
The logic is as follows: we first check a market regime filter. If there are more stocks with positive longer momentum than those with negative momentum, we consider opening new positions. We can then open up to 10 positions based on longer momentum. A position is closed once its short momentum turns negative. This process is repeated every month.

Current backtest indicators show a MAR of 0.32 and a Sharpe ratio of 0.81. However, I encourage you to experiment with the logic and different indices to optimize these results further.