I Made Claude Run 100 Trials to Beat My 0DTE Strategy Pt4

I used Claude Code and Optuna to run 100 machine learning trials optimizing 10 parameters of my Kalman breakout strategy — Part 4 of 7 building my first 0DTE options algo bot from scratch. In this video: • Optuna ML optimizer setup: TPE sampler, 10 parameters, 100 trials • Walk-forward validation structure: train 2023, validate early 2024, test late 2024 • How Kalman filters, KNN smoothing, and MAE bands work together visually • Finding and fixing a scoring bug where the objective mis-calculated drawdown • Vectorizing the data loader to eliminate a bottleneck slowing each trial to 3+ min • 100 trials kicked off at the end — results coming in Part 5 After the Part 3 backtest, the next question is: can we do better? Optuna answers that by intelligently searching the parameter space instead of brute-force grid search. With 10 parameters — lookbacks, band multipliers, VIX thresholds, delta targets, take profit levels — the number of possible combinations is too large to test manually. Optuna's TPE sampler finds high-performing regions of that space efficiently, pruning bad trials early to focus compute on promising configurations. The walk-forward structure is critical here. Training on 2023 data and validating on 2024 data means the optimizer never sees the test set during training — the same discipline that separates a real edge from an overfit. Any configuration that looks great on 2023 but falls apart on early 2024 gets cut before it ever reaches the live test window. This episode also covers a real debugging session: the objective function had a bug mis-scoring account balance vs drawdown, giving false confidence to aggressive configs. Claude identifies it, we fix it, run a smoke test, then kick off the full 100-trial run. Part 5 is where the optimized parameters come back. 🔗 Open an Alpaca paper trading account (free): https://alpaca.markets 🔗 Part 1 — The Foundation:    • 0DTE Options Backtesting Pt1: The Part Mos...   🔗 Part 2 — Building the Strategy:    • I Made Claude Code a Kalman Breakout Bot —...   🔗 Part 3 — Backtest Results:    • I Made Claude Backtest My 0DTE Options Bot...   TIMESTAMPS: 0:00 - Intro: Optimizing the AI Breakout Strategy with Optuna 1:00 - Trading Journey + Indicator Breakdown Request 2:03 - Kalman Filter Explained (Noise-Cancelling Headphones Analogy) 3:08 - KNN Smoothing and MAE Breakout Bands Explained 4:13 - Visualizing How All Three Work Together for Entry Signals 5:17 - Reviewing Strategy and Current Results 6:20 - Optuna vs Manual Tuning — Why ML Wins 7:28 - Optuna Setup: TPE Sampler, 10 Parameters, Walk-Forward 8:29 - Walk-Forward Structure: Train 2023, Validate 2024, Test Late 2024 9:30 - Vectorized Implementation for Speed 10:34 - What Optuna Actually Does (Hyperparameter Tuning Explained) 11:37 - Seeding Optuna with Existing Parameters 12:38 - Running First 3 Trials — Speed and Alignment Check 14:47 - Verifying Optimizer Aligns with Live Backtest Behavior 15:56 - Reviewing 2023 and 2024 Baseline Curves 17:03 - Finding the Scoring Bug (Drawdown Miscalculation) 18:05 - 100 Trials Reveal: Baseline Is Too Aggressive 19:11 - In-Sample Overfitting Risk Analysis 20:13 - Fixing the Bug and Rerunning 21:18 - Smoke Test: Single Trial to Verify the Fix 29:13 - Identifying and Vectorizing the Data Bottleneck 31:43 - Single Trial QA Pass Before Full Run 34:59 - Loading 2023 + 2024 Data, Pre-Indexing for Speed 36:01 - 100 Trials Running — Results in Part 5 🔔 Subscribe — Part 5 brings back the optimized parameters. ──────────────────────────────── ⚠️ DISCLAIMER ──────────────────────────────── Educational content only. NOT financial advice. I am NOT a financial advisor. All trading involves substantial risk of loss. Past bot performance does not guarantee future results. You are solely responsible for your own financial decisions. 📺 Full Series (watch in order):    • Build a 0DTE Options Trading Bot with Pyth...