A TradingView Pine v6 strategy — a 7-band standard-deviation grid of chained limit orders with martingale sizing and an SMA-basis exit — ported to the QuantConnect LEAN engine and tested on 5.5 years of Alpaca BTC/USD minute data. The headline experiment is the one you'd actually run: every period, re-optimize on the trailing month and trade the winning parameter set forward (weekly and monthly cadence), out-of-sample over 2025-01 → 2026-06 — a window in which BTC itself fell 37%.
The walk-forward result below survived two kill experiments — and then failed the decisive one: the edge does not exist in the prints of any venue where the strategy can actually be executed. Re-run on Binance's own BTCUSDT minute data (the only wired venue that permits shorting), every profitable window inverts to a loss. The profit measured on Alpaca/Coinbase prints was thin-venue wick noise: those bars have ~35–40% wider minute ranges, and half of the grid's limit-order fills never print on the deep venue. Details and the estimated return on investment are in the follow-up section.
15 real hours of the LEAN backtest (Pine-default parameters, Jan 2–3 2025). Price walks down through the lower bands: each band it touches fills a resting limit buy ~1.5× larger than the last; the whole stack exits the moment price recovers to the moving-average basis. Dot size = order size.
BTC/USD 2021 → mid-2026 covers four regimes. Everything before 2025 was fair game for optimization; 2025-01 → 2026-06 was locked away for the walk-forward only.
Indexed to 100 on 2025-01-01. Walk-forward curves are stitched from per-fold LEAN backtests (each fold trades the config that won the trailing month, P&L rule). Fixed configs hold one parameter set throughout.
Bars: out-of-sample return of each fold (%). Strip below: which candidate won the trailing month and traded that fold. The 2026 gains come from folds where the optimizer switched to the shorts-capable, unfiltered config (agg-bs-noMTF) during the crash — a config that was mediocre in-sample.
Best 6-month net P&L (%) achievable in each SMA-length × band-width cell (best across sizing and filter variants) — bull half-year vs bear half-year. Blue = profit, red = loss. 0 of 108 configurations were positive in both regimes: the strategy's sign flips with the market, which is exactly what the walk-forward layer exploits — and why any single "optimized" setting is fragile.
The 4-year in-sample runs. The as-published Pine defaults lose −91.8% (21,891 trades, ~$85k of fees on $100k — TradingView's default backtest charges zero commission, which is why it looks fine on-platform). But fees are not the whole story: the zero-fee diagnostic still loses in bear windows — a long martingale grid under a falling basis is structurally unprofitable.
An independent quant review found the walk-forward wrapper adds no selection skill (always-on agg-bs-noMTF beat the 10-candidate optimizer: +15.4% vs +14.7% over the same months), and that the config is an intermittent-regime harvester, not a crash harvester: all in-sample profit sits in 4 months of 47 (−10.1% excluding them). It pre-registered kill experiments; here is the complete scorecard.
| Experiment | Window | Fees (mk/tk bps) | Net P&L | Sharpe | Max DD | Verdict |
|---|---|---|---|---|---|---|
| Mechanism on full history | 2021-02 → 2024-12 | 15 / 25 | +82.8% | 0.64 | 23.4% | survives (but: 1-of-5 stress events harvested; profit in 4 of 47 months) |
| Cost-stress, crash window | 2025-11-17 → 2026-04-13 | 15 / 25 | +21.2% | 4.98 | 2.3% | survives +20 bps |
| 25 / 35 | +15.0% | 3.40 | 2.3% | |||
| 35 / 45 | +9.0% | 1.79 | 2.6% |
Binance BTCUSDT minute klines 2021→2026 were downloaded and quality-checked (closes track Coinbase within 2–7 bps on average — same asset, same path). The pre-registered bar: both profitable regimes must reproduce at ≥50% magnitude, full-span Sharpe ≥ 0.6 and CAGR ≥ 10%, off-regime bleed ≤ 5%/yr.
| Window | Thin-venue prints (Coinbase/Alpaca) | Binance prints, perps fees (2/4.5 bps) | Kill bar | Result |
|---|---|---|---|---|
| ON regime 1 · Feb 23 → Mar 24 | +156% | −5.4% | ≥ +75% | FAIL |
| ON regime 2 · Nov 25 → Apr 26 | +21.6% | −3.2% | ≥ +10% | FAIL |
| Full span 2021-02 → 2026-06 | ≈ +100% (est.) | −22.0% (CAGR −4.5%, Sharpe −1.71, DD 22.5%) | Sharpe ≥ 0.6, CAGR ≥ 10% | FAIL |
| OFF-regime bleed | −7…−11%/yr | −4…−6%/yr | ≤ 5%/yr | FAIL |
Why: Alpaca/Coinbase minute bars carry ~35–40% wider high-low ranges than Binance (11.7–14.4 bps vs 7.7–10.5 bps average). The band-grid's limit fills live in exactly those extra wicks — on Binance, trade count drops ~55% and the surviving fills are adversely selected. Cheaper fees can't rescue fills that never happen. Funding, for the record, was measured and is negligible (+0.02% of equity over the crash window); it was never the problem.
Estimates anchor on the backtests above; "executable" means a venue where the required side (shorts) can actually trade. Estimates, not promises — and the honest estimate is negative.
| Deployment path | Executable? | Est. annual ROI | Est. max drawdown | On $100k / year |
|---|---|---|---|---|
| Binance USDT-M perps or cross-margin, always-on (full-span replication) | yes (shorts OK) | ≈ −4.5%/yr | ~22% | ≈ −$4,500 |
| Binance, crash-regime only (best observed window) | yes | −3…−5% per regime | ~5% | negative |
| Alpaca spot, long-only fixed IS-winner | yes (no shorts needed) | ≈ −0.8%/yr | ~2% | ≈ −$800 |
| Walk-forward paper number (thin-venue prints, needs shorts) | no | +9.1%/yr (Sharpe 1.5) — unrealizable | ~2% | n/a: fills don't exist on an executable venue |
Bottom line: no tested configuration has a positive expected ROI on any venue where it can actually be executed. Registry verdict: KILL. The reusable outputs of this study are the infrastructure (Binance connector with spot/margin/futures modes, minute + funding data pipelines, the corrected anti-lookahead grid engine) and the method lesson: always replicate a microstructure edge on the execution venue's own prints before believing it.
Generated 2026-07-04 · LEAN v2.5 (local source build) · data: Alpaca crypto bars API · artifacts & registry records: randomKnap/lean-strategy (backtests/BandGrid5m/, backtests/registry/BandGridSmaExit__*)