Alejandro Legarda

Systematic ETF rotation research

Designed a trading research protocol that keeps the backtest honest. Rules for leveraged technology ETFs are tuned on the past alone and judged on years they never saw, and the simplest survivor faced a sealed holdout exactly once. Its worst drawdown was 26%, against 59% for holding the ETF.

Private repository. The forward test will run live on this site.

How the system runs, stage by stage Daily bars: Daily and minute bars from 2016, adjusted for splits and dividends, cached so a fresh clone runs with no credentials. Holdout boundary: Everything before 1 January 2025 is sandbox. Every tool truncates to that date by default, so no design decision sees the holdout by accident. Walk-forward: Rolling folds. Parameters are picked on two years of history and scored on the six months after, which they never saw. Rotation rule: Hold the leveraged ETF while the index closes above its moving average, and hold cash otherwise. The grid is two assets by three lengths. Backtest engine: A signal on one bar fills at the next open, and costs are charged on turnover. Tests mutate the future and check that nothing in the past changes. Gates: A design must beat buy and hold on drawdown-adjusted return, and beat a passive mix with the same average exposure. Most designs fail here. Holdout, once: The frozen design is scored on the holdout exactly once and reported as it came out: the drawdown gate passed, the return gate failed. Live parity: Before any order is placed, the live signal code must reproduce the committed backtest series to within one part in a billion. Forward journal: One immutable record per trading day: weights, orders, fills, equity, and benchmarks. Writing the same date twice raises an error. DAILY BARS HOLDOUT BOUNDARY WALK-FORWARD ROTATION RULE BACKTEST ENGINE GATES HOLDOUT, ONCE LIVE PARITY FORWARD JOURNAL
RUN 0001T+0.00 sREADY Daily bars Daily and minute bars from 2016, adjusted for splits and dividends, cached so a fresh clone runs with no credentials.

What it does

Holds a leveraged technology ETF while a broad technology index sits above its long moving average, and holds cash otherwise. The question was never whether such a rule can look good in a backtest. It was whether the protocol around it can stop me from fooling myself.

How it works

Evaluation is walk-forward. The history is cut into folds, and inside each fold the asset and the moving-average length are chosen on the prior two years only, then scored on the fold they never saw. A design has to clear two gates: beat buy and hold on drawdown-adjusted return, and beat a mix with the same average exposure on raw return. Six designs cleared both gates in the sandbox. The simplest one, with two parameters and an untuned macro veto, was selected on parsimony, because the differences between the six were inside fold-to-fold noise.

Everything after the first day of 2025 is a holdout. Design decisions were restricted to data before it, the tools truncate every run to that boundary by default, and the final design was scored on the holdout exactly once, reported as it came out.

What I measured

The holdout passed the drawdown gate and failed the return gate. The veto that controls drawdown sat out exposure that a static allocation would have captured in a chop-then-rally window. Read honestly: the repeatable edge is drawdown control, and the return edge is not established. That sentence is the result.

Limits

The universe is hand picked from the winners of one decade, and the sample holds one market regime. Designs explored before the holdout protocol existed had already seen later results, so the holdout is lightly contaminated for them. Forward paper trading is the only pristine test, which is why the rule will run live here with its parameters frozen and its record published as it accrues.

Back to the start