How to Screen for Momentum Leadership with AI

Compute an O'Neil-style Relative Strength Rating across the US market. Weighted quarterly returns, percentile ranked 1-99

← Back to shibui.finance

The Relative Strength Rating is the simplest useful momentum signal. It asks one question: is this stock outperforming the market? William O'Neil made it the centerpiece of growth stock selection by weighting recent performance more heavily (40% on the last quarter, 20% on each of the prior three) and ranking every stock from 1 to 99. A rating of 80 means the stock beat 80% of the market. O'Neil set 80 as the minimum for CAN SLIM stocks, and the strongest leaders typically score 90 to 99 before their biggest advances.

This guide walks through computing the RS Rating step by step: the basic market-wide ranking, combining it with fundamental quality, detecting RS divergence, integrating it into a CAN SLIM screen, and backtesting RS-based strategies. For the screener overview and comparison table, see the Relative Strength Rating Screener.

Step 1: Compute the RS Rating

The RS Rating is a market-wide percentile rank of weighted quarterly price returns. Claude needs four data points per stock: the closing price now, 63 trading days ago, 126 trading days ago, 189 trading days ago, and 252 trading days ago. From these five prices, it computes four quarterly returns, applies the 40/20/20/20 weights, and ranks every stock.

On Shibui, you ask

"From daily prices over the last 400 days, compute an O'Neil-style Relative Strength Rating for all US common stocks above $1 billion market cap. For each stock, calculate four quarterly returns (63 trading days each): Q1 (most recent), Q2, Q3, Q4. Weight them: RS = 0.4×Q1 + 0.2×Q2 + 0.2×Q3 + 0.2×Q4. Rank all stocks by this weighted return as a percentile from 1 to 99. Show the top 20 by RS Rating with their quarterly returns."

The top 20 will be a mix of whatever is leading the current market cycle. Biotech names with clinical trial wins, semiconductor stocks riding an AI spending wave, gold miners in a metals rally. The RS Rating does not care why a stock is outperforming. It measures the fact that it is. The quarterly breakdown shows whether the outperformance is recent (Q1 driven) or sustained (all four quarters positive).

Step 2: Add a quality overlay

Momentum alone is not a strategy. A stock can have RS 99 because of a speculative squeeze, a low-float short covering, or a one-time catalyst that will not repeat. Adding fundamental quality filters separates durable momentum from noise. The Piotroski F-Score is the simplest overlay: a score of 6 or higher means the business fundamentals are at least stable. Earnings growth is the next filter.

On Shibui, you ask

"From daily prices over the last 400 days, compute the O'Neil-style RS Rating (weighted quarterly returns: 0.4×Q1 + 0.2×Q2 + 0.2×Q3 + 0.2×Q4 over 63-day quarters, percentile ranked 1-99) for US stocks above $2 billion. Filter to RS 80+, quarterly EPS growth above 15%, and Piotroski F-Score 6 or higher. Show the RS Rating, EPS growth, F-Score, and sector."

This is the momentum + quality intersection. Stocks that pass are both outperforming the market and getting financially stronger. The EPS growth check ensures the price performance is backed by real business improvement, not just multiple expansion. Typically 20 to 40 stocks pass all three criteria at once.

Step 3: Detect RS divergence

The most interesting RS signal is divergence: a stock whose RS Rating is high but whose price has pulled back from its 52-week high. This means the stock is still outperforming the market on a weighted basis, but price has corrected. Growth traders interpret this as a potential entry point. The RS line holding up while price consolidates is the setup that precedes many VCP breakouts.

On Shibui, you ask

"From daily prices over the last 400 days, compute the O'Neil-style RS Rating (0.4×Q1 + 0.2×Q2 + 0.2×Q3 + 0.2×Q4 over 63-day quarters, percentile ranked 1-99) for all US stocks above $500 million market cap. Find stocks where the RS Rating is above 90 but the price is more than 10% below its 52-week high. Show the RS Rating, the percentage below the 52-week high, and market cap."

Not all divergences lead to breakouts. Some are the start of a larger decline where the RS Rating eventually catches down to price. The RS Rating uses trailing data, so it lags current price action. A stock that just dropped 10% in the last two days still carries three months of prior outperformance in the Q2, Q3, and Q4 components. The divergence is worth investigating, not automatically worth buying.

Step 4: CAN SLIM integration

The RS Rating is the L criterion in O'Neil's CAN SLIM system. O'Neil required an RS Rating of 80 or higher. The full CAN SLIM screen combines this with C (quarterly earnings growth), A (annual earnings growth), N (new highs), S (supply and demand, via volume and float), I (institutional ownership), and M (market direction). Running the complete screen in one query is what traditional tools cannot do.

On Shibui, you ask

"From daily prices over the last 400 days, compute the O'Neil-style RS Rating (0.4×Q1 + 0.2×Q2 + 0.2×Q3 + 0.2×Q4, percentile ranked 1-99). Then filter US stocks above $2 billion for: RS Rating 80+, quarterly EPS growth above 25%, annual earnings growth above 20% over 3 years, within 15% of 52-week high, institutional ownership above 40%. Show the RS Rating, EPS growth, distance from high, and institutional ownership."

This is the full CAN SLIM filter set minus the M criterion (market direction), which you check separately by looking at SPY versus its 200-day SMA. See the CAN SLIM screening guide for the complete methodology. Typically fewer than 20 stocks pass all criteria at once, which is the point. CAN SLIM is designed to produce a short, concentrated list.

Step 5: Backtest RS strategies

The ultimate question: does buying high-RS stocks actually produce better returns? Shibui has 60+ years of daily prices, so you can compute the RS Rating at any historical point and measure what happened next.

On Shibui, you ask

"From daily prices, compute the O'Neil-style RS Rating (0.4×Q1 + 0.2×Q2 + 0.2×Q3 + 0.2×Q4, percentile ranked 1-99) as of December 31, 2023, for all US stocks above $5 billion market cap. Group stocks into RS buckets (90-99, 80-89, 70-79, below 70). What was the average and median return 6 months later for each bucket?"

Important caveats. Survivorship bias applies: delisted companies are not in the dataset, so the worst outcomes are missing. The backtest does not account for trading costs, slippage, or the difficulty of buying into extended stocks at the quoted close. Momentum works until it reverses, and the backtest shows average returns, not the drawdowns along the way. These are historical observations, not investment recommendations.

What Shibui cannot do

The RS Rating on Shibui is computed from O'Neil's published methodology, not the proprietary IBD formula. It does not include:

  • IBD's proprietary smoothing or universe adjustments. The exact numbers will differ from MarketSmith for borderline stocks.
  • The EPS Rating, Composite Rating, or Accumulation/Distribution Rating that are part of the IBD ecosystem. These are separate proprietary metrics, not part of the RS calculation.
  • Real-time alerts or automated daily notifications when an RS Rating changes. The data is end-of-day.
  • Pattern recognition for VCP setups, cup-with-handle formations, or other O'Neil chart patterns. You define the numeric criteria and Claude evaluates them.

If you need IBD's proprietary ratings and automated pattern detection, MarketSmith is the purpose-built tool for that. Shibui's advantage is flexibility (define any RS criteria, combine with any other filter), depth (60+ years of historical data for backtesting), and price (free).

Frequently asked questions

What is the 40/20/20/20 weighting in the Relative Strength Rating?

The RS Rating divides the trailing 12 months into four quarters of approximately 63 trading days each. The most recent quarter gets 40% weight, and the three prior quarters get 20% each. This recency bias is deliberate. O'Neil observed that the biggest stock market winners accelerate in the quarter before their major advance. A stock that gained 30% in the last quarter and was flat the prior three will rank higher than one that gained 10% per quarter evenly. The 40% weight captures that acceleration.

Why is recent performance weighted more heavily?

Momentum is not constant. A stock that was a leader six months ago may have stalled, while a new leader may have started accelerating two months ago. The 40% weight on the most recent quarter ensures the RS Rating reflects current momentum, not stale outperformance. Without the recency weight, a stock that gained 100% in Q4 and lost 20% in Q1 would still rank as a leader. With the 40/20/20/20 weighting, the recent decline pulls the rating down faster, which matches how growth traders evaluate stocks.

Can AI compute the RS Rating for every stock at once?

Yes. On Shibui, Claude computes the weighted 12-month return for every stock in the database from daily closing prices, then ranks all of them using a percentile function. The result is a 1-99 RS Rating for each stock. The entire computation runs in a single query. Traditional tools either require a subscription (MarketSmith) or only compute RS per chart (TradingView Pine scripts). Shibui does it market-wide in plain English.

How do you combine the RS Rating with CAN SLIM?

The RS Rating is the L criterion in CAN SLIM (Leader or Laggard). In one query, you can compute the RS Rating and then filter by CAN SLIM's other criteria: quarterly EPS growth above 25% (C), annual earnings growth above 24% (A), stock near a 52-week high (N), institutional ownership above 40% (I), and market direction above the 200-day SMA (M). On Shibui, you describe all of these in plain English and Claude checks them in one pass.

Connect Shibui to Claude in 2 minutes

Shibui is free. Connect it to Claude (free or paid plan) and rank every US stock by momentum leadership. Compute the RS Rating, combine with CAN SLIM or VCP criteria, and backtest across 60+ years, all in plain English.

Connect to Claude →