STRASMORE/EXPLORE 3,214 QUERIES 22Y EQUITIES · 12Y OPTIONS

3,214 answered market questions

every one with its exact SQL, its result and the date it was computed · free, no signup

Trailing Stop vs Trailing Stop-Limit Orders
When each trail width would first have been reached, same position, January to June 2022series · 2026-10-08 · 5×4Preview: a 5-point series, ending lower. A 10% trail ratcheting under AAPL's high-water close, January to mid-March 2022series · 2026-10-08 · 50×5Preview: a 16-point series, roughly flat. How far SPY's open sat from the prior close, every session since 2006ranking · 2026-10-08 · 6×3Preview: 6 ranked values, smallest first. The ten deepest gap-down opens in SPY since 2006, and where those sessions tradedranking · 2026-10-08 · 10×4Preview: 10 ranked values, largest first.
When each trail width would first have been reached, same position, January to June 2022

When each trail width would first have been reached, same position, January to June 2022

most recentas of series 5×4read in context →
When each trail width would first have been reached, same position, January to June 2022 — 5 rows by 4 columns, computed from US exchange, SIP and OPRA data.
labelfirst_trigger_daydays_into_windowcloses_at_or_below_trail
5% trailJan 6, 20223104
8% trailJan 19, 20221682
10% trailJan 21, 20221865
15% trailMar 14, 20227038
20% trailMay 12, 202212925
the exact SQL behind every number
WITH daily AS
(
    SELECT
        date,
        toFloat64(any(close)) AS close_px
    FROM global_markets.stocks_daily_aggs
    WHERE ticker = 'AAPL'
      AND date >= '2022-01-03'
      AND date <  '2022-07-01'
    GROUP BY date
),
marked AS
(
    SELECT
        date,
        close_px,
        max(close_px) OVER (ORDER BY date ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS peak_close
    FROM daily
),
widths AS
(
    SELECT arrayJoin([5, 8, 10, 15, 20]) AS trail_pct
)
SELECT
    concat(toString(w.trail_pct), '% trail')           AS label,
    formatDateTime(min(m.date), '%b %e, %Y')           AS first_trigger_day,
    dateDiff('day', toDate('2022-01-03'), min(m.date)) AS days_into_window,
    count()                                            AS closes_at_or_below_trail
FROM marked AS m
CROSS JOIN widths AS w
WHERE m.close_px <= m.peak_close * (1 - w.trail_pct / 100)
GROUP BY w.trail_pct
ORDER BY w.trail_pct ASC
$