The window and the cross counts behind the text
Answered against 22 years of US equities and 12 years of US options data and published with the query that produced it. This result is stored as of 2026-11-01, from Can a Death Cross Be Bullish? The SPY Record.
- Rows × columns
- 1 × 11
- Computed
- Completeness
- No missing values
- Source
- US exchange, SIP and OPRA market data
- Licence
- Strasmore terms · free, no signup
What each column holds
| Column | Type | Range | Notes |
|---|---|---|---|
first_session |
text | 1 distinct value (Sep 10, 2003) | |
last_session |
text | 1 distinct value (Oct 30, 2026) | |
session_count |
number | every row is 5,823 | count |
median_off_high_pct |
number | every row is 10.2 | percent |
min_off_high_pct |
number | every row is 5.2 | percent |
max_off_high_pct |
number | every row is 22.7 | percent |
death_cross_count |
number | every row is 11 | count |
golden_cross_count |
number | every row is 11 | count |
min_sessions_to_golden |
number | every row is 37 | |
median_sessions_to_golden |
number | every row is 77 | |
max_sessions_to_golden |
number | every row is 377 |
Computed from Strasmore's warehouse of US exchange, SIP and OPRA market data. Equity prices are delayed; options greeks and implied volatility are end-of-day. This result is stored, not recomputed on load — it is exactly the numbers that were returned on , and the query below is what returned them.
Run it yourself
This is the exact query behind the result above. Change a ticker, a date or a column and run it against the warehouse — no account, no key. The no-signup tier is smaller than the one this page was computed on; a query that reaches past it comes back saying which plan runs it.
WITH
bars AS
(
SELECT
date,
toFloat64(argMax(close, _ingest_time)) AS px
FROM global_markets.stocks_daily_aggs
WHERE ticker = 'SPY'
GROUP BY date
),
smas AS
(
SELECT
date,
px,
row_number() OVER (ORDER BY date) AS rn,
avg(px) OVER (ORDER BY date ROWS BETWEEN 49 PRECEDING AND CURRENT ROW) AS avg_50,
avg(px) OVER (ORDER BY date ROWS BETWEEN 199 PRECEDING AND CURRENT ROW) AS avg_200,
max(px) OVER (ORDER BY date ROWS BETWEEN 251 PRECEDING AND CURRENT ROW) AS high_1y
FROM bars
),
states AS
(
SELECT
*,
(avg_50 < avg_200) AS below,
lagInFrame((avg_50 < avg_200), 1) OVER (ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS prev_below
FROM smas
),
flags AS
(
SELECT
*,
(rn >= 201 AND below = 1 AND prev_below = 0) AS is_death,
(rn >= 201 AND below = 0 AND prev_below = 1) AS is_golden
FROM states
),
events AS
(
SELECT date, rn, is_death
FROM flags
WHERE is_death OR is_golden
),
paired AS
(
SELECT
rn,
is_death,
leadInFrame(rn, 1) OVER (ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS next_rn
FROM events
),
cross_stats AS
(
SELECT
countIf(is_death) AS death_cross_count,
countIf(NOT is_death) AS golden_cross_count,
minIf(toInt64(next_rn) - toInt64(rn), is_death AND next_rn > 0) AS min_sessions_to_golden,
quantileExactIf(toInt64(next_rn) - toInt64(rn), is_death AND next_rn > 0) AS median_sessions_to_golden,
maxIf(toInt64(next_rn) - toInt64(rn), is_death AND next_rn > 0) AS max_sessions_to_golden
FROM paired
),
span AS
(
SELECT
concat(formatDateTime(min(date), '%b'), ' ', toString(toDayOfMonth(min(date))), ', ', toString(toYear(min(date)))) AS first_session,
concat(formatDateTime(max(date), '%b'), ' ', toString(toDayOfMonth(max(date))), ', ', toString(toYear(max(date)))) AS last_session,
count() AS session_count,
round(quantileExactIf((1 - px / high_1y) * 100, is_death), 1) AS median_off_high_pct,
round(minIf((1 - px / high_1y) * 100, is_death), 1) AS min_off_high_pct,
round(maxIf((1 - px / high_1y) * 100, is_death), 1) AS max_off_high_pct
FROM flags
)
SELECT *
FROM span, cross_stats
Work with this data in your AI assistant
Opens ready to query, with this page's data. Free, no account.