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×4
A 10% trail ratcheting under AAPL's high-water close, January to mid-March 2022series ·
2026-10-08 · 50×5
How far SPY's open sat from the prior close, every session since 2006ranking ·
2026-10-08 · 6×3
The ten deepest gap-down opens in SPY since 2006, and where those sessions tradedranking ·
2026-10-08 · 10×4
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
| label | first_trigger_day | days_into_window | closes_at_or_below_trail |
|---|---|---|---|
| 5% trail | Jan 6, 2022 | 3 | 104 |
| 8% trail | Jan 19, 2022 | 16 | 82 |
| 10% trail | Jan 21, 2022 | 18 | 65 |
| 15% trail | Mar 14, 2022 | 70 | 38 |
| 20% trail | May 12, 2022 | 129 | 25 |
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
More from this analysisTrailing Stop vs Trailing Stop-Limit Orders
A 10% trail ratcheting under AAPL's high-water close, January to mid-March 2022
series 50×5
→
The ten deepest gap-down opens in SPY since 2006, and where those sessions traded
ranking 10×4
→
How far SPY's open sat from the prior close, every session since 2006
ranking 6×3
→
SPY minute-bar movement and volume by ET clock time
series 32×3
→
See all 3,214 queries →