Algorithms

Ruby

Flagship

Regime-aware US equities quant trend system

Ruby is Vectopian’s flagship quantitative trading algorithm for US-based equities, expressed primarily through liquid levered, non-levered, and inverse products, with a small set of companion bond sleeves when the regime calls for them. Leverage and short exposure are implemented via products like TQQQ and SQQQ rather than margin or direct shorting, which helps reduce the risk of account overruns. It is live now, running in a fully automated manner with a small capital allocation, which we plan to ratchet up once we fully understand its live behaviour.

At its core, Ruby is a regime-aware trend system — not a pure mean-reversion bot, and not a static buy-and-hold of leveraged Nasdaq. Each day it classifies the broad market backdrop (risk-on versus risk-off), then tilts the book toward the posture that historically earned its keep in that backdrop: participate when the tape supports trend, step down or hedge when it does not. Momentum and trend filters do most of the directional work; shorter-horizon exhaustion signals act as a tactical overlay — for example pulling risk when an up-move looks stretched, rather than fading every dip as a classic mean-reversion strategy would.

What Ruby tries to capture is straightforward to state and hard to harvest cleanly: the Nasdaq equity risk premium when conditions favor it, without accepting the full drawdown profile of sitting permanently in 3× leverage. Volatility targeting caps how hard the book leans into any single sleeve. A separate intraday execution layer refines when inside the session to trade, without changing the daily mandate of what to hold. Occasional discount tilts lean a little more aggressively when the index itself is cheap relative to its own recent range — still inside the same regime framework, not a separate strategy.

The pages that follow are the locked research configuration we call V11: walk-forward backtest first, then Monte Carlo, then parameter sensitivity. Formulae and branch logic stay off-page; the numbers are after costs unless noted.

1. Backtest results

Results below cover 7 September 2012 through 24 July 2026, starting from $100,000. The window does not begin earlier because several ETFs the live book needs — especially the levered and inverse Nasdaq products — did not exist before then; a tradable backtest cannot invent fills in instruments the market had not yet listed. Separately, we have stress-tested the signal logic on synthetic series back to 1986, constructed as if those products had existed, so we can see how the decision rules behave through earlier bull and bear regimes. Those long-history runs validate signal robustness; they are not a claim that the modern ETFs could have been traded in the 1980s, and the figures on this page remain the live-instrument sample from 2012 onward.

Indicators warm up on 300 completed daily bars before the first live rebalance, so early session noise does not enter the equity curve. Price series for performance testing are split-adjusted; we ignore dividends — signals and P&L are driven by price moves alone, not total-return reinvestment. Execution costs follow an Interactive Brokers–style schedule: $0.005 per share (minimum $1, capped at 1% of trade value), plus two basis points of slippage on each side of a fill. All headline figures are after those costs.

Growth of $100,000 — vs buy & hold

Same start date. Ruby after strategy costs; buy-and-hold paths are uncosted buy-and-hold references on their tickers.

Growth of $100,000 — Ruby vs buy & holdFull sample 2012-09 → 2026-07. Log scale. After costs for Ruby; buy & hold has no strategy costs.$100K$300K$1M$3M$10M$30M20122014201620182020202220242026SPYQQQTQQQRuby$32.3M$9.8MSource: Ruby V11 · 2012-09 → 2026-07 · after costs
Figure 1. Growth of $100,000 — Ruby vs TQQQ, QQQ, and SPY buy & hold (log scale).
SeriesFinal valueCAGRMax drawdown
Ruby$32,316,33951.89%−31.97%
TQQQ buy & hold$9,760,67139.31%−81.75%
QQQ buy & hold$977,99217.97%−35.62%
SPY buy & hold$508,07412.52%−34.10%

Ruby finishes well ahead of holding TQQQ outright, with less than half the max drawdown.

Full-sample path

Full-sample equity — locked Ruby settings2012-09 → 2026-07. Start $100,000 → end $32.3M. Log scale. After costs.$100K$300K$1M$3M$10M$30M20122014201620182020202220242026$32.3MSource: Ruby V11 full sample · 2012-09 → 2026-07 · after costs
Figure 2. Full-sample equity for locked Ruby settings (log scale).
Drawdown — full samplePeak-to-trough depth. Deepest print −31.97%.0%-10%-20%-30%20122014201620182020202220242026Source: same full-sample path · after costs
Figure 3. Full-sample drawdown. Deepest print −31.97%.
MetricValue
CAGR51.81%
Sharpe1.494
Sortino1.434
Max drawdown−31.97%
Annualised volatility31.30%
Win rate64.59%
Loss rate35.41%
Profit factor2.342
Expectancy (per closed trade)$27,145.56
Average win$73,338.41
Average loss−$57,100.43
Closed trades (round trips)1,282
Average hold (days)31.4
Total fills2,542
Final equity$32,316,338.55
Total return32,216.34%
Total fees$348,943.59
Total slippage (est.)$507,591.94
Profit siphons0
Ending cash vault$0.00

Drawdown episodes (peak-to-recovery)

Ruby is not unique in suffering deep loss of peak equity. Passive buy-and-hold of the same broad market — SPY, QQQ, and especially leveraged Nasdaq via TQQQ — is also prone to severe drawdowns and long recoveries. Levered products amplify both the climb and the crash; sitting through them is not a gentler alternative to an active risk mandate.

Notes for the tables below:

  • An episode counts at a threshold if its trough reaches that depth.
  • Recovery min / median / max are recovery times in calendar days — from the trough of the drawdown back to the prior equity peak (recovered episodes only).
  • Same calendar window as the full sample (2012-09 → 2026-07).

Ruby

ThresholdEpisodesRecoveredUnrecoveredRecovery min (days)Recovery median (days)Recovery max (days)
≥ 5%49481214246
≥ 10%21201864246
≥ 15%161602170246
≥ 20%111102181246
≥ 25%66080110246
≥ 30%110134134134

QQQ buy & hold (max drawdown −35.62%)

ThresholdEpisodesRecoveredUnrecoveredRecovery min (days)Recovery median (days)Recovery max (days)
≥ 5%26251835352
≥ 10%141401673352
≥ 20%4407798352
≥ 30%110352352352

TQQQ buy & hold (max drawdown −81.75%)

ThresholdEpisodesRecoveredUnrecoveredRecovery min (days)Recovery median (days)Recovery max (days)
≥ 5%54531111714
≥ 10%30291629714
≥ 20%161511573714
≥ 30%99025126714

SPY buy & hold (max drawdown −34.10%)

ThresholdEpisodesRecoveredUnrecoveredRecovery min (days)Recovery median (days)Recovery max (days)
≥ 5%181801648464
≥ 10%66080146464
≥ 20%330126148464
≥ 30%110148148148

TQQQ alone logged nine separate ≥30% episodes in this window, with a longest recovery of 714 calendar days — almost two years underwater for a “set and forget” leveraged holder. SPY and QQQ each saw a ≥30% scar whose recovery stretched for many months. Passive for a passive investor is not the absence of drawdowns; it is choosing to hold through them without a mandate that can step down risk.

Walk-forward (rolling 3y in-sample / 1y out-of-sample)

A single full-sample backtest can flatter a rule that only worked because it peeked at the whole tape. Walk-forward is how we refuse that: on each fold we fit (or lock thresholds) using only the prior three years, then trade the next calendar year as if that year were live — without revising the settings after seeing it. Rolling the window forward year by year forces the same mandate through bull months, crash months, and quiet months. Twelve annual hold-outs below (2026 partial through the study cut-off). OOS end equity is fold-local (each fold restarts at $100,000). The stitched curve in the next section is those hold-outs joined with capital carried across — the continuous book we treat as the headline out-of-sample result.

Walk-forward out-of-sample returns by yearEach bar is a 1-year hold-out after a 3-year training window. 2026 is partial through the study cut-off.0%50%100%150%151617181920212223242526Source: Ruby V11 walk-forward · rolling 3y in-sample / 1y out-of-sample · after costs
Figure 4. Out-of-sample return by walk-forward year.
FoldIS CAGRIS SharpeIS MDDOOS CAGROOS SharpeOOS MDDOOS end equity
Y201527.7%1.02−27.9%18.0%0.72−18.3%$118,013
Y201634.6%1.21−18.5%16.0%0.64−18.1%$115,971
Y201714.4%0.61−27.2%82.0%3.14−7.8%$181,543
Y201834.4%1.21−27.2%−3.9%0.02−30.5%$96,086
Y201935.9%1.22−28.2%65.9%1.85−21.9%$165,935
Y202052.2%1.65−29.1%164.5%3.48−25.4%$265,486
Y202166.5%1.83−30.5%62.2%1.73−18.3%$162,173
Y202297.5%2.34−25.6%11.8%0.48−30.2%$111,725
Y202368.3%1.72−30.5%123.4%2.81−20.5%$222,013
Y202459.5%1.57−31.7%49.3%1.41−23.0%$149,286
Y202553.4%1.42−31.5%41.6%1.39−22.7%$141,175
Y202666.7%1.80−26.0%24.7%0.89−11.6%$113,044

Stitched out-of-sample equity

Hold-out years joined with capital carried across folds — the continuous book we treat as the headline OOS result.

MetricValue
CAGR55.28%
Sharpe1.553
Sortino1.485
Max drawdown−31.96%
Annualised volatility31.61%
Win rate65.68%
Loss rate34.32%
Profit factor2.339
Expectancy (per closed trade)$15,377.74
Average win$40,904.26
Average loss−$33,475.89
Closed trades1,116
Average hold (days)30.7
Final equity$15,987,254.22
Total return15,887.25%
Profit siphons0

Stitched OOS drawdown episodes

ThresholdEpisodesRecoveredUnrecoveredRecovery min (days)Recovery median (days)Recovery max (days)
≥ 5%44431214246
≥ 10%17161867246
≥ 15%141402168246
≥ 20%101002180246
≥ 25%5508088246
≥ 30%110134134134

2. Monte Carlo simulation

A walk-forward equity curve is one ordering of history. Monte Carlo asks a colder question: if the same observed daily returns had arrived in many other sequences, how often does the edge survive, and how ugly do the drawdowns get?

We ran 10,000 simulations on the stitched out-of-sample daily return stream of the locked settings (2,906 sessions; fixed seed). No method invents returns outside that observed pool. What changes is only the sampling dependence between days — three different lenses on the same tape.

How each sampler builds a pathAll three redraw from the same observed daily returns — they differ only in dependency structure.A · IIDDays drawn independentlyAny return can follow anyother. Destroyed: clusteringof calm and storm days.B · Vol regimeDays drawn within volatility statesFirst classify days intocalm / normal / storm.Resample with the observedtransition matrix betweenstates.C · Macro regimeBlocks drawn by economic eraKeep multi-day stretchesfrom similar macro eras, soboom–bust structure is notshredded.None invents returns outside the observed set. Monte Carlo tests path dependency of a fixed return stream — not look-ahead or overfitting.
Figure 5. Three ways to rebuild paths from the same daily returns.

Method A — IID reshuffle

Concept. Treat every session as an independent draw from the historical return distribution. Tomorrow’s return does not “know” whether today was calm or violent.

Sampling. Shuffle (or sample with replacement from) the observed daily returns independently for each day of the 2,906-day horizon. Serial correlation and volatility clustering are destroyed.

What it is good for. A pure ordering stress: does the edge survive when path dependence is erased? It is the optimistic drawdown lens for strategies that live in clustered risk — calm and storm days are mixed too evenly, so deep drawdowns are often understated.

Method A equity fan — IID reshuffleUltra-thin hairlines = sample alternate paths.$100K$300K$1M$3M$10M$30M2015201720192021202320252026Sample paths (50 hairlines)Outer band = P5–P95Inner band = P25–P75Magenta line = median (P50)Cyan line = realized OOS pathSource: Ruby V11 Monte Carlo · stitched OOS · 10,000 sims · all alternate-path samples shown
Figure 6. Method A equity fan (IID reshuffle). Ultra-thin hairlines = all 50 sample alternate paths; outer band = P5–P95; inner band = P25–P75; magenta = median (P50); cyan = realized OOS path.

Method B — Volatility regime

Concept. Real markets alternate between quiet and violent stretches. Days should be more likely to follow days like themselves.

Sampling. Classify each historical day into a small number of volatility states (calm / normal / storm). Resample returns conditional on state, advancing the state with the empirical transition matrix estimated from the sample.

What it is good for. The realistic statistical lens: it restores clustering without inventing new economics. Edge confidence intervals on this page are quoted primarily from Method B. Limitation: it can only replay transition frequencies that appear in this sample.

Method B equity fan — volatility regimeUltra-thin hairlines = sample alternate paths.$100K$300K$1M$3M$10M$30M2015201720192021202320252026Sample paths (50 hairlines)Outer band = P5–P95Inner band = P25–P75Magenta line = median (P50)Cyan line = realized OOS pathSource: Ruby V11 Monte Carlo · stitched OOS · 10,000 sims · all alternate-path samples shown
Figure 7. Method B equity fan (volatility regime). Same legend as Figure 6 — hairlines, P5–P95 / P25–P75 bands, median, realized OOS.

Volatility transition metrics

Persistence on the diagonal is what IID destroys and Method B restores:

From → ToCalmNormalStressed
Calm90.9%3.3%5.8%
Normal3.4%96.6%0.0%
Stressed5.7%0.1%94.2%
RegimeDaysShareMean / dayVol / dayContribution
Calm96833.3%0.149%2.04%24.5%
Normal96933.3%0.199%2.16%33.6%
Stressed96933.3%0.235%1.76%41.9%

Method C — Macro regime

Concept. Boom and bust are not just higher variance — they have multi-week economic shape. Shuffling day-by-day can still shred that structure.

Sampling. Draw blocks of days from similar macro eras in the sample (and, in scenario variants, eras labelled as analogues of older crises). In-sample variants stay inside periods the strategy actually traded; scenario variants can inject harsher historical analogues and are never the headline edge verdict.

What it is good for. Preserving economic structure by era. It often produces a fatter drawdown left tail than A or B — useful as a stress, not as a claim that history will literally repeat those blocks.

Method C equity fan — macro regimeUltra-thin hairlines = sample alternate paths. Background tints = macro eras.$100K$300K$1M$3M$10M$30MReflationFed-pivot late…StimulusDisinflation / AI megacap bullRecent2015201720192021202320252026Sample paths (50 hairlines)Outer band = P5–P95Inner band = P25–P75Magenta line = median (P50)Cyan line = realized OOS pathSource: Ruby V11 Monte Carlo · stitched OOS · 10,000 sims · all alternate-path samples shown
Figure 8. Method C equity fan (macro regime). Background tints and dividers mark macro eras on the real timeline; hairlines = all 50 sample alternate paths; bands / median / realized as above.
Macro eraDaysMean / dayVol / dayEra MDDContribution
ZIRP grind-up bull1460.099%1.77%−9.5%2.5%
Oil crash & global growth scare134−0.081%2.31%−27.2%−1.9%
Reflation / late-cycle melt-up4930.232%1.54%−18.2%20.2%
Fed-tightening vol regime229−0.010%2.10%−28.7%−0.4%
Fed-pivot late-cycle bull2890.374%1.98%−22.9%19.1%
COVID crash23−1.174%2.37%−25.7%−4.8%
Stimulus / ZIRP mega-bull4450.378%2.00%−18.6%29.8%
Inflation & rate-hike bear2000.111%2.45%−30.3%3.9%
Disinflation / AI megacap bull5770.224%2.08%−23.3%22.8%
Recent / policy-uncertainty3700.134%1.93%−23.1%8.7%

Results across all three

Shared setup: 10,000 paths each, starting equity $100,000, horizon matching the OOS stitch. Realized path: terminal ~$16.0M, CAGR 55.3%, max drawdown −32.0%, Sharpe 1.55.

MethodMedian terminalMedian CAGRMedian MDDP5 MDDP(profit)90% CI on mean daily returnEdge ≠ 0?
A · IID reshuffle$16,086,34155.4%−37.2%−52.4%100%0.136% … 0.255%Yes
B · Volatility regime$16,001,18155.3%−37.3%−53.0%100%0.134% … 0.255%Yes
C · Macro regime$18,357,76257.1%−41.5%−57.2%100%0.141% … 0.257%Yes

All three clear zero on the 90% confidence interval for mean daily return. Every simulated path finished profitable on this horizon. Method C’s median is a little richer and its drawdown left tail a little worse — exactly the pattern you expect when macro blocks keep storms bunched together.

Three sampling lenses — CAGR and max drawdownBars show P5–P95; tick is median. Dashed line = realized OOS path. Same 10,000 sims each.Terminal CAGR30%40%50%60%70%80%A · IIDB · Vol regimeC · MacroMax drawdown-60%-50%-40%-30%A · IIDB · Vol regimeC · MacroSource: Ruby V11 Monte Carlo · 10,000 paths per method · stitched OOS returns
Figure 9. P5–P95 ranges and medians for terminal CAGR and max drawdown under Methods A, B, and C. Dashed tick = realized OOS path.
CAGR distributions — Methods A, B, and CSame return pool, different reshuffle rules. Highlighted bin contains the realized path.A · IID reshuffle10%49%94%133%B · Volatility regime12%46%84%118%C · Macro regime14%48%85%119%Source: Ruby V11 Monte Carlo · 10,000 paths each · terminal CAGR
Figure 10. Terminal CAGR histograms for each sampler. Realized path marked on every panel.
Distribution of max drawdown — same 10,000 pathsMedian ≈ −37%. Realized −32% sits better than the median (78th percentile). Left tail still matters.-74%-63%-51%-40%-28%Max drawdownrealizedSource: Ruby V11 Monte Carlo · volatility-regime method · 10,000 paths
Figure 11. Max-drawdown histogram under Method B. Realized −32% sits better than the median (~−37%); P5 still reaches roughly −53%.

We do not tune the model to these Monte Carlo figures. They are a post-walk-forward stress on a frozen return stream: useful for sizing honesty, useless as a fitting target.

3. Parameter sensitivity analysis

The locked V11 line has eight hyperparameters — thresholds and lengths that shape the daily mandate. We do not name them here. Locking any such set is only defensible if the neighborhood around it is a plateau, not a single lucky spike.

How we test sensitivity. Around the locked point we build a local grid that nudges each dial across nearby values (one combination of all eight at a time). That produces 22,500 neighbor configurations. Every neighbor is re-run on the same walk-forward stitch used for the headline OOS book (rolling 3y in-sample / 1y out-of-sample), so we compare apples to apples — not in-sample fantasy. We then look at the cloud of stitched Sharpe and CAGR: where the lock sits in that distribution, how wide the P5–P95 band is, and (anonymized) which dials move the result most when varied alone.

Stitched OOS Sharpe across that neighborhood: about 1.01 at P5, 1.21 at the median, 1.41 at P95. The selected settings land at ~1.56 — the right tail, not an island with empty bins beside it.

Walk-forward Sharpe across 22,500 nearby settingsNeighborhood sweep around Ruby's locked configuration. Median ≈ 1.21. Selected settings at the right tail.0.810.971.131.291.45Stitched OOS SharpeselectedSource: Ruby V11 neighborhood sweep · 22,500 configurations · walk-forward
Figure 12. Walk-forward Sharpe for 22,500 nearby settings. Dashed cyan = selected lock; faint gray = neighborhood median.
Walk-forward CAGR across the same neighborhoodP5–P95 ≈ 31–49%. Selected settings ≈ 54% — far-right tail, with a dense plateau behind them.23%30%37%44%52%Stitched OOS CAGRselectedSource: Ruby V11 neighborhood sweep · 22,500 configurations
Figure 13. Walk-forward CAGR for the same neighborhood. P5–P95 ≈ 31–49%; selected ≈ 54%.
Which knobs actually move results?Range of mean walk-forward Sharpe when each knob varies and the others average out. Wider = more sensitive.1.151.201.251.301.35Lower gateUpper gateHorizon AHorizon BSignal speedTilt strengthMarket filterMean stitched out-of-sample Sharpe as each knob varies · Ruby V11 neighborhood
Figure 14. Range of mean walk-forward Sharpe as each anonymized knob varies. Wider bars = more leverage on the result.

What we want from that picture: evidence that performance is not a one-point miracle, that several nearby books still clear a useful floor, and that we know which dials are worth watching — without publishing the dial labels. The median neighbor is closer to Sharpe ~1.2 and CAGR near 40% — still a serious book, and a healthier number to carry when the lock has a good month.

4. Research history — from V1 to V11

In early 2026 we shipped a first durable version of Ruby we still call V1: already a complete daily decision system with honest costs and a walk-forward calendar we were willing to trust. Full-sample it printed roughly 34% CAGR and a Sharpe near 1.1, with a deepest drawdown around −35%. That was good enough to keep — and good enough to beat up on.

What followed was not a straight climb. We used AI to generate large volumes of candidate ideas — regime overlays, risk haircuts, defensive gates, timing twists, portfolio tilts — constrained to our style of trading and risk tolerance, not random alpha soup. Each idea was fed into our specialized backtest engine and scored on the same walk-forward metrics we trust for promotion. The loop was fully automated: propose, backtest, validate metrics, keep or reject. We ran thousands of ideas that way. Most looked clever in-sample and failed out of sample. Some never beat V1 in more than one walk-forward year. A few were simply broken. We kept the register of rejects on purpose — so the same idea does not quietly come back dressed as something new.

Two families of work did survive. One sits inside the day: treating execution as its own research layer rather than a fixed clock fill — sizing a perfect-timing ceiling, then closing a modest slice with a session VWAP posture (Intraday fills and VWAP). The other sits on the book: modest portfolio tilts that earn their keep when glued to a robust daily engine rather than a fragile one.

By mid-year those pieces had recombined into a cleaner architecture (V8 in the research line): stronger than V1 on return and risk-adjusted return, still honest about drawdown. V11 is not a new mechanism. It is that architecture with thresholds locked from a careful walk-forward sweep — the settings stressed in the sections above.

Research journey — full-sample CAGR by generationEarly February V1 through rejected experiments to V8 architecture and V11 locked settings. After costs.0%10%20%30%40%50%60%34%V1Early Feb29%V2–V3Overlays27%V5–V7Wrong base41%V8Architecture52%V11Locked paramsSource: Ruby research register · full sample 2012-09 → 2026-07 · after costs
Figure 15. Full-sample CAGR across research generations. Dim bars are rejected or superseded lines; V1, V8, and V11 are the ones we still talk about.

V11 is a frozen snapshot of the best-understood lock we have today — earned from V1 in early 2026 through a long automated stack of rejected ideas, a surviving architecture, and a neighborhood that does not fall apart when you nudge it. If there is one thing we are proud of in this journey, it is not a single version number — it is the dark factory behind them: the system that generates candidate algorithms and signals, runs them through the specialized backtest engine, and validates every keep-or-reject decision on walk-forward metrics with essentially no hand-holding. Research does not end when capital goes live; the next section is that frontier.

5. Going live

Backtests, walk-forwards, and Monte Carlo answer questions about expected behaviour. Live markets answer the only question that ultimately matters: does the system do what it claims when money is on the line? There is no better test than running with live capital.

We first put V1 into production in the early part of 2026. Over roughly two months it returned about 10%, then we paused deployment — not because the signal thesis failed, but because execution needed harder work: fill quality, edge cases in the session, and plumbing we would rather fix with small mistakes than large ones.

On 3 August 2026 we brought Ruby (the locked V11 line) live again — this time with small capital on purpose. Position size will ratchet up only as we identify, measure, and close execution risks. That is a feature of the plan, not a lack of conviction.

Live trading exposes a different stack than research. The fill algorithm is complex: timing inside the day, partial fills, fallbacks when the preferred print never appears, and the obligation to still land the day’s target weights. Around that we are building guardrails so the book does what the mandate says — kill-switches, exposure caps, sanity checks on quotes and sizes, and failure modes that degrade safely rather than inventing unintended risk.

The toughest failures are not a single missed indicator. They are market-structure shocks — flash crashes, broken liquidity, exchange glitches — and political or geopolitical turmoil such as wars that move risk assets faster than any daily decision loop was calibrated for. No historical sample owns those events completely. Guardrails and conservative sizing are how we refuse to pretend otherwise.

Ruby will keep evolving in research. In production it will grow only as fast as its execution discipline earns. That is the deal we make with live money.