I have been writing about backtesting options strategies for years. The process has always been the same: come up with an idea, gather historical data, write code, run the backtest, tweak parameters, repeat. It works, but it is slow. A single strategy can take days or weeks to go from idea to validated results.
Last week, I did the entire thing in a single afternoon. I sat down with Claude Code (Anthropic's AI coding assistant) and went from a blank screen to a fully backtested, parameter-optimized 0DTE options strategy on SPY. Brainstorming, prototyping with real market data, building a complete Go backtest, running 105 parameter configurations, and arriving at an optimal strategy. All in one session. The result: a strategy that returned 55.2% over two years with a 7.6% max drawdown.
This is not a post about AI replacing traders. It is about how AI dramatically accelerates the research and development cycle that every serious options trader already goes through. The thinking is still yours. The edge, if there is one, still comes from your ideas and your understanding of the market. AI just compresses weeks of work into hours.

The Problem: AI Needs Data, and Most Data Tools Are Not AI-Friendly
Before I walk through the strategy itself, I need to explain the tooling that made this possible. AI coding assistants are extraordinary at writing code, analyzing results, and iterating on ideas. But they have a blind spot: they cannot trade real markets and they do not have access to historical financial data. If you ask an AI to backtest a strategy, it either hallucinates numbers or tells you to go find the data yourself.
This is the problem I solved by building Massive CLI, an open-source command-line tool that wraps the Massive financial data API. I wrote about why I built it on my personal blog. The key insight is this: AI agents like Claude Code can shell out to CLI tools. When Claude needs historical price data for SPY, it runs a command like massive stock eod --symbol SPY --start 2024-01-01 and gets back focused JSON. No API keys to configure in the chat, no bloated responses, just the data it needs piped right into its context window.
Massive CLI covers stocks, options, crypto, forex, futures, and indices. But the important thing is not the tool itself. It is the pattern: give AI agents access to real financial data through simple command-line interfaces, and they become shockingly effective research partners.
Step 1: Brainstorming Strategy Ideas with AI
I started by telling Claude Code what I was looking for: a short-term options strategy on SPY that I could backtest with the data available through Massive CLI. I gave it some context about my trading style (I have been day trading SPY and selling premium for years on this website) and asked it to brainstorm ideas.
Claude generated five strategy concepts. We discussed the pros, cons, and data requirements for each, then narrowed the list to three that were both testable and interesting:
- VIX Spike Put Credit Spreads -- sell SPY put credit spreads when the VIX spikes above a threshold, betting on mean reversion
- 0DTE Opening Range Breakout (ORB) -- buy ATM 0DTE SPY calls or puts when price breaks out of the first few minutes' trading range
- Pre-Holiday Drift Calls -- buy SPY calls before market holidays, exploiting the well-documented pre-holiday drift effect
The brainstorming phase took maybe 20 minutes. In the past, coming up with three testable hypotheses and thinking through the data requirements for each would have been an afternoon of research by itself.
Step 2: Rapid Prototyping with Real Market Data
Here is where having a CLI tool that AI can use directly made all the difference. Instead of writing code to test each idea, Claude used Massive CLI to pull the relevant data and do quick feasibility checks right in the terminal. No code needed for this stage -- just data queries and analysis.
For example, to check the VIX Spike strategy, Claude pulled historical VIX data, identified spike events, then pulled SPY option prices on those dates to see if the credit spreads would have been profitable. For the Pre-Holiday Drift, it pulled SPY prices around every market holiday for the past several years and computed the average return.
This rapid prototyping phase produced the first round of results:
- VIX Spike Put Credit Spreads: 9 trades over two years, 100% win rate, +20.75% return. Promising on the surface, but the sample size was tiny. Nine trades is not enough to draw any conclusions.
- 0DTE Opening Range Breakout (Mon/Wed/Fri): 299 trades, 42.5% win rate, +62.78% return. Large sample size, meaningful returns, and a clearly defined mechanical setup. This was the winner.
- Pre-Holiday Drift Calls: 20 trades, 35% win rate, -4.63% return. Failed. The drift effect did not translate into profitable 0DTE option trades.
The Opening Range Breakout strategy stood out immediately. Nearly 300 trades over two years gave me statistical confidence, and the return was substantial. Time to build a real backtest.
Step 3: Building a Full Backtest in Go
With the winning strategy identified, Claude Code built a complete backtesting engine in Go. This was not a toy script. The final codebase came to roughly 4,000 lines of code, handling everything from data ingestion to trade simulation to performance reporting.
As I have written about before, proper backtesting is essential for validating any options strategy. You need to account for entry and exit logic, position sizing, stop losses, profit targets, and time-based exits. You need to simulate the strategy across different market conditions -- bull markets, bear markets, choppy sideways action, volatility spikes. Half-baked backtests lead to half-baked strategies.
Here is how the 0DTE Opening Range Breakout strategy works:
- Establish the opening range: The first 5 minutes of trading (9:30-9:35 AM ET) define the high and low of the opening range
- Wait for a breakout: When SPY breaks above the opening range high, buy an ATM 0DTE call. When it breaks below the low, buy an ATM 0DTE put
- Manage the position: Stop loss at -50% of the option price, profit target at +100% (the option doubles), and a time-based exit at 3:30 PM if neither stop nor target is hit
- Trade only Monday, Wednesday, and Friday: These days showed the best historical performance
Claude Code wrote the backtester, pulled two years of intraday SPY data and 0DTE option chains through Massive CLI, and ran the initial backtest. The whole process -- writing the code, debugging it, running it, and reviewing the results -- took a few hours. Building this from scratch without AI would have taken me a week at minimum.
Step 4: Parameter Optimization (and the Stacking Trap)
With a working backtester, the next step was optimization. Claude ran 105 different parameter configurations, varying the opening range duration (5, 10, 15, 30 minutes), stop loss levels, profit targets, and day-of-week filters. This is the kind of systematic approach to parameter testing that separates rigorous backtesting from guesswork.
The results were fascinating, and they taught me something I did not expect.
Each individual parameter tweak improved the strategy in isolation. A tighter stop loss? Better. A wider opening range? Better. A different day filter? Better. So the natural instinct was to stack all the "best" parameters together. If each one improves the strategy individually, combining them all should produce the ultimate configuration, right?
Wrong.
The "kitchen sink" configuration -- every individually optimal parameter stacked together -- actually performed worse than the baseline. This is a classic overfitting trap, and it is one of the most important lessons in quantitative trading. When you optimize multiple parameters simultaneously, you are not finding a robust strategy. You are curve-fitting to historical noise. Each parameter carved away a different set of trades, and when you combined all those filters, you were left with a tiny, cherry-picked subset that happened to perform well in hindsight but had no predictive power going forward.
The winning configuration turned out to be the simplest one: a 5-minute opening range with default stop and profit targets, traded on Monday, Wednesday, and Friday. The 5-minute ORB was the single biggest improvement -- it nearly doubled the returns compared to the 15-minute and 30-minute ranges while simultaneously reducing the max drawdown. Sometimes the best optimization is knowing when to stop optimizing.
The Final Results
Here are the numbers for the optimized 0DTE Opening Range Breakout strategy, backtested over two years on a $25,000 account:
- Total profit: $13,792 (+55.2% return)
- Number of trades: 299
- Win rate: 42.5%
- Max drawdown: 7.6%
- Average trade duration: Intraday (all positions closed by 3:30 PM)
A 42.5% win rate might look low at first glance, but the math works because the winners are twice as large as the losers (the +100% profit target versus the -50% stop loss). This is a trend-following characteristic -- you lose often but your wins more than compensate. The 7.6% max drawdown is particularly appealing for a strategy trading 0DTE options, which are typically associated with extreme risk.
Important Caveats
I want to be upfront about the limitations. These backtest results are based on mid-price fills, meaning they do not account for bid/ask spreads. In reality, slippage on 0DTE options can be significant, especially in the first few minutes of the trading session when liquidity is still building. The spread costs would reduce the total return, though the magnitude depends on execution quality and the specific options traded.
This is also a backtest, not live trading. Past performance does not predict future results. Market structure changes, volatility regimes shift, and strategies that worked historically can stop working. I talk about this frequently on this website -- no strategy works forever, and the key to long-term success is adaptability.
That said, backtesting is still the single best tool we have for validating trading ideas before risking real capital. A strategy that does not work in backtesting will almost certainly not work in live trading. A strategy that does work in backtesting at least has a chance.
What This Means for Options Traders
The real story here is not the specific strategy. Opening range breakouts are not new -- traders have been using them for decades. The story is about the process. What used to take weeks now takes hours.
Think about what happened in that single session:
- Brainstormed five strategy ideas, narrowed to three
- Prototyped all three with real market data -- no code required
- Identified the winner based on actual historical performance
- Built a 4,000-line production-quality backtest
- Ran 105 parameter configurations
- Discovered a critical insight about parameter stacking that would have been easy to miss
- Arrived at an optimized strategy with documented results
This is not about replacing the trader's judgment. I brought the domain knowledge -- years of trading SPY, understanding of options mechanics, intuition about which strategies are worth testing. Claude brought the speed -- the ability to write code, pull data, run backtests, and iterate on results orders of magnitude faster than I could alone.
If you are an options trader who has ideas but gets bogged down in the implementation, AI coding assistants are about to change your life. The barrier between "I think this might work" and "here are the backtest results" has collapsed. You still need to understand trading. You still need to think critically about overfitting, market structure, and execution. But the mechanical work of translating ideas into tested strategies? That bottleneck is gone.
The Tools I Used
For anyone who wants to try a similar workflow, here is what I used:
- Claude Code -- Anthropic's AI coding assistant. It wrote the Go backtest, analyzed results, and drove the entire research process through conversation.
- Massive CLI -- The open-source command-line tool I built for accessing financial data. It gave Claude direct access to historical stock prices, option chains, and intraday data without bloating the context window.
- Massive -- The financial data API behind the CLI. It covers stocks, options, crypto, forex, futures, and indices.
- Go -- The programming language for the backtester. Fast execution was important for running 105 parameter sweeps across two years of intraday data.
The combination of an AI that can write and execute code, paired with a data source it can access natively through the command line, is what makes the workflow seamless. Without the CLI tool, I would have spent half the session just getting data into a format Claude could use. With it, Claude could focus on what it does best: writing code and analyzing results.
What I Am Doing Next
I am not trading this strategy live yet. The next step is forward testing -- running the strategy in paper trading for a few months to see if the backtest results hold up in real-time market conditions. If they do, I will allocate a small portion of capital to it and document the results right here, just like I do with my wheel strategy and other approaches.
I am also planning to use this same AI-driven workflow to explore more strategy ideas. The speed advantage is addictive. Once you can go from idea to backtest results in an afternoon, you start generating and testing ideas you never would have bothered with before. Some will fail. Some might surprise you. The point is that the cost of testing has dropped so dramatically that there is no reason not to try.
If you want to follow along as I develop and test new strategies, keep an eye on this website. I share everything -- the wins, the losses, and the lessons learned along the way.
Related Topics: 0DTE Options Strategy, Opening Range Breakout, AI Trading Strategy, Backtesting Options, SPY Options, Claude Code Trading, Zero DTE Options, Options Backtesting, Algorithmic Trading, AI Options Trading


