The Open-Source TradingView Optimizer
Buy-and-hold SPY: the same rule, scored year by yearranking ·
2026-09-22 · 9×2
In-sample rank versus out-of-sample Sharpe, same 24 cellsranking ·
2026-09-22 · 24×4
The parameter surface: Sharpe by fast length, one line per slow lengthranking ·
2026-09-22 · 6×4
A 24-cell moving-average grid on SPY, ranked by Sharperanking ·
2026-09-22 · 24×2
Can an LLM Find Alpha Factors?
Training rank against holdout result: 240 trials cut into fifthsranking ·
2026-08-02 · 5×3
240 coin flip factors scored on real prices: annualized Sharpe, Jan 2016 to Jun 2021ranking ·
2026-08-02 · 8×3
The twelve best trials in training, re-scored on five untouched years (Jul 2021 to Jun 2026)ranking ·
2026-08-02 · 12×3
The best score climbs with the size of the search: best and average Sharpe by trials runranking ·
2026-08-02 · 9×3
Buy-and-hold SPY: the same rule, scored year by year
Buy-and-hold SPY: the same rule, scored year by year
| year | spy_sharpe |
|---|---|
| 2016 | 0.77 |
| 2017 | 2.67 |
| 2018 | -0.3 |
| 2019 | 2.08 |
| 2020 | 0.62 |
| 2021 | 1.9 |
| 2022 | -0.78 |
| 2023 | 1.73 |
| 2024 | 1.73 |
the exact SQL behind every number
WITH daily AS
(
SELECT
d,
px / prev_px - 1 AS ret
FROM
(
SELECT
date AS d,
toFloat64(close) AS px,
lagInFrame(toFloat64(close)) OVER (ORDER BY date ASC ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) AS prev_px
FROM global_markets.stocks_daily_aggs
WHERE ticker = 'SPY'
AND date >= '2015-12-31'
AND date <= '2024-12-31'
)
WHERE prev_px > 0
)
SELECT
toString(toYear(d)) AS year,
round(avg(ret) / stddevPop(ret) * sqrt(252), 2) AS spy_sharpe
FROM daily
GROUP BY year
ORDER BY year
More from this analysisThe Open-Source TradingView Optimizer
In-sample rank versus out-of-sample Sharpe, same 24 cells
ranking 24×4
→
A 24-cell moving-average grid on SPY, ranked by Sharpe
ranking 24×2
→
The parameter surface: Sharpe by fast length, one line per slow length
ranking 6×4
→
US tickers trading in a June week, and how many still traded in June 2026
ranking 11×4
→
See all 3,256 queries →