AMD: 10% below 3-month high and RSI below 30
Shared by priya_longterm · Oct 27, 2026 Example
A weekday email when AMD’s latest close is more than 10% below its highest adjusted close in the prior three calendar months and its 14-session Wilder RSI is below 30. This tracks the stated price conditions; it is not a buy recommendation.
- When
- Checked every weekday, after the market data refreshes (about 7am New York time); emailed only when AMD’s latest daily close is more than 10% below its three-month adjusted closing high, and its 14-session Wilder RSI is below 30
- Emails when
- AMD’s latest daily close is more than 10% below its three-month adjusted closing high, and its 14-session Wilder RSI is below 30
The query it runs
WITH RECURSIVE
latest AS (
SELECT MAX(date) AS latest_date FROM prices_daily WHERE symbol = 'AMD'
),
base AS (
SELECT p.date, p.adjClose AS close_price,
ROW_NUMBER() OVER (ORDER BY p.date) AS rn,
p.adjClose - LAG(p.adjClose) OVER (ORDER BY p.date) AS change
FROM prices_daily p CROSS JOIN latest l
WHERE p.symbol = 'AMD'
AND p.date >= l.latest_date - INTERVAL 250 DAY
AND p.date <= l.latest_date
),
changes AS (
SELECT date, close_price, rn,
GREATEST(change, 0) AS gain,
GREATEST(-change, 0) AS loss
FROM base
),
seed AS (
SELECT AVG(gain) AS avg_gain, AVG(loss) AS avg_loss
FROM changes WHERE rn BETWEEN 2 AND 15
),
rsi_path(rn, date, close_price, avg_gain, avg_loss) AS (
SELECT c.rn, c.date, c.close_price, s.avg_gain, s.avg_loss
FROM changes c CROSS JOIN seed s WHERE c.rn = 15
UNION ALL
SELECT c.rn, c.date, c.close_price,
(r.avg_gain * 13 + c.gain) / 14,
(r.avg_loss * 13 + c.loss) / 14
FROM rsi_path r JOIN changes c ON c.rn = r.rn + 1
),
current_rsi AS (
SELECT date, close_price,
CASE WHEN avg_loss = 0 THEN 100
ELSE 100 - 100 / (1 + avg_gain / avg_loss) END AS rsi_14
FROM rsi_path
QUALIFY ROW_NUMBER() OVER (ORDER BY date DESC) = 1
),
three_month_high AS (
SELECT MAX(p.adjClose) AS high_price
FROM prices_daily p CROSS JOIN latest l
WHERE p.symbol = 'AMD'
AND p.date >= l.latest_date - INTERVAL 3 MONTH
AND p.date <= l.latest_date
)
SELECT 'AMD' AS symbol, c.date AS observed_date,
ROUND(c.close_price, 2) AS latest_close,
ROUND(h.high_price, 2) AS three_month_high,
ROUND(100 * (h.high_price - c.close_price) / h.high_price, 2) AS decline_pct,
ROUND(c.rsi_14, 2) AS rsi_14
FROM current_rsi c CROSS JOIN three_month_high h
WHERE 100 * (h.high_price - c.close_price) / h.high_price > 10
AND c.rsi_14 < 304 comments
tommyriskExampleOct 27
checked, AMD is already ~18% off the high rn but RSI is ~43 so it doesn't fire. needing both is strict
priya_longtermExampleOct 27
That's the point. I don't want every 10% dip, only when it's actually washed out. Fine if it fires twice a year.
dan_k_buildsExampleOct 27
copied it. would be nice to watch a whole list of tickers in one alert instead of making one per stock
ravi.sExampleOct 27
RSI under 30 on a mega cap doesn't happen often. Curious how many times this would've fired in the last 5 years, a backtest version would be cool.
Sign in to join the discussion.