Different ranking methods for a monthly S&P500 Stock Rotation Strategy

Recently for my own trading, I have been researching rotational strategies on both the weekly and monthly timeframes. The most common indicator that I use for ranking stocks is Rate of Change (ROC) of the closing price. I read about using Rate of Change on the EMA to rank stocks. I liked a small twist on the idea and wanted to know how it compared to what I am using.

Then this led me down another path of trying other ranking methods with an interesting result using historical volatility (HV) that I did not expect.

Base Rules

Backtest from 1/1/2007-12/31/2020.

Buy

  • It is the last trading day of the month
  • Stock is a member of the S&P500 index
  • Stock is above the 200-day moving average (spreadsheet has results without this rule)
  • The $SPX is above the 200-day moving average
  • Rank stocks from high to low using the (63, 126, 189, 252) Rate of Change of close
  • Buy the 10 highest ranked stocks (spreadsheet has results using 5 highest)
  • Enter at the open on the next trading day

Sell

  • Sell all stocks on the open of the first trading day of the month

 

Base Results – Rate of Change on Close

Not exactly the best results but this gives us something to compare against. I will be using the average of these results to compare against the other rankings.

ROC on EMA

Now we will change the ranking to be the highest ROC of the EMA. We will use the same length parameter for ROC and EMA. In AmiBroker this would look like: ROC(EMA(C, 63), 63).

Well, that did not change the results much. I was not expecting a big change but I never know until I test it because half the time I am wrong.

 

ROC divided by HV

This then got me thinking about other twists on ranking methods. Maybe I wanted those stocks that have gone up the most with the least volatility. Basically, the smoothness of the returns. There are other methods like Sharpe Ratio and linear regressions that I have tried in the past with no success. Then I thought of my favorite ranking function, Historical Volatility. What if I did something simple and divided ROC by HV. If two stocks went up the same amount, this would favor the stock with the lower HV.

Here is the HV formula I use for AmiBroker

function HV(len)
{
     return StDev(log(C/Ref(C,-1)),len)*(252^.5)*100;
}

 

The AmiBroker ranking code then looks like this ROC(C,63)/HV(63)

That was a bust for the CAR and Sharpe Ratio. As expected, the MDD did come down since I was favoring lower HV stocks. But when I see negative results like this, then the next obvious thing is to try the opposite.

ROC times by HV

Now we try ROC times HV. Now if two stocks have gone up the same amount, now this favors the one with higher HV.

The AmiBroker ranking code looks like this ROC(C,63)*HV(63)

Wow this did better than expected. CAR is up 25%. Sharpe ratio is up 22%. While MDD & UI are slightly lower.

 

HV Only

At this point, comes the obvious test. What if you use HV only?

The CAR is almost as good at ROC*HV but the MDD is much higher. I was really expecting this one to do better.

Very interesting results. Not what I was expecting

 

Spreadsheet

Fill in the form below to get the spreadsheet with lots of additional information. See the results of all variations from the optimization run. This includes top drawdowns, trade statistics and more.

Final Thoughts

This is the way my research often goes. I start with one idea (using EMA on ROC), and then slowly morph to other ideas. And if I am lucky, I discover something interesting like I did this time. I have some rotation strategies that I trade now. I will have to check and see what ranking there are using and try instead using ROC*HV.

If you trade momentum rotational strategies, I would definitely try this.

Reader’s suggestions on this post: More ideas for ranking methods on a monthly S&P500 Stock Rotation Strategy

Other blog posts on rotational strategies: Monthly S&P500 Stock Rotation Strategy and S&P500 Monthly Rotation-Readers’ Ideas.

Backtesting platform used: AmiBroker. Data provider: Norgate Data (referral link)

Good quant trading,

Fill in for free spreadsheet:

spreadsheeticon

 

Click Here to Leave a Comment Below

Steve Petersen - May 14, 2021 Reply

captcha isnt working in chrome or firefox

    Cesar Alvarez - May 14, 2021 Reply

    Odd. I just tested under both and it worked for me. I think there may be a general Captcha problem because I have been seeing lots of spam coming in.

Bing - May 19, 2021 Reply

Hi Cesar,

Where is the flag for $SPX above 200MA and also when is Len (lastcolumn) in spreadsheet?

Isaac Perdomo - May 25, 2021 Reply

Great post, Cesar!

I’m about to start implementing Nick Radge’s Weekend Trend Trader with a few personal tweaks, one of them being 40 positions and another being a ranking method with the highest ROC/ATR.

No other ranking method I’ve tried comes even close. It works very reliably with trend-following systems.

Plus, since the system trades in the Russell 3000, by using ATR, it prioritizes lower-priced stocks aside from high momentum and low volatility.

Thanks for your insights! This helps me verify some of my own testing.

Cheers,
Isaac

    Cesar Alvarez - May 26, 2021 Reply

    Thanks for sharing that ranking method. I have had a couple of other people share ideas with me since the post. I might have to do a quick update post with the other ideas.

Pardha - August 7, 2021 Reply

Hi Alvarez,

can you please tell me in simple words how to calculate

1. Rank stocks from high to low using the (63, 126, 189, 252) Rate of Change of close
2. ROC(C,63)*HV(63) – the best ranking system

I am planning to try this out in python but i couldn’t understand this terminology. I am new to trading. Pardon my ignorance

    Cesar Alvarez - August 9, 2021 Reply

    Rate of change is the return of a stock over N-days. So a 63-day rate of change is the stock’s return over 63 days..

    HV = historical volatility. Read here about how to calculate that.

Wade - November 19, 2021 Reply

The calculation would be more complex but try calculating the upside volatility alone and used that instead of HV. Historical volatility and standard deviation treat positive and negative observations the same but most investors want to avoid the negative deviations and grab all the positive deviations they can. The HV calc in the ranked stocks probably has a temporary positive skew because the ROC already shows positive momentum. If it didn’t, the ROC wouldn’t be positive.

Thanks again for sharing your research.

    Cesar Alvarez - November 19, 2021 Reply

    Yes you are correct about the upside volatility. I like that idea. I will have to try it out.

Rajesh - November 25, 2022 Reply

Your Captcha does not seem to work ; Anyway you can share your excel sheet

    Cesar Alvarez - November 28, 2022 Reply

    It is working for me. Please try again or a different browser.

Leave a Reply: