← Back to list

How to Go from One Backtest to Hundreds — and Find the Strategy the Market Is Hiding

If you’ve been following this series, you already have the expectancy skill running in OpenCode. You know how to backtest RSI on TSLA. You…

Unicorn Day · 2026-06-03 22:01 · 2 claps · 4.6 min read paywalled
#backtesting #open-code #algorithmic-trading #quantitative-finance #trading-strategy
Open on Medium ↗
Wiki topics: ECO · Economy · General 💻 · Programming 🏃 · Running & Endurance

How to Go from One Backtest to Hundreds — and Find the Strategy the Market Is Hiding

If you’ve been following this series, you already have the expectancy skill running in OpenCode. You know how to backtest RSI on TSLA. You know what expectancy means and why it beats win rate as a decision metric.

[embed]Teaching Your AI Assistant to Backtest Trading Strategies in Seconds A reusable “skill” for OpenCode that turns plain English into professional backtests — complete with expectancy, profit…medium.com

This article is about what comes next — and it’s where the real edge lives.

The Problem with Testing One Indicator at a Time

The previous article showed how to run a single backtest with a plain English prompt:

“Backtest TSLA with RSI 14 over 3 years”

That’s genuinely useful. But it’s still just one data point. You don’t know if RSI is the best choice, or if the 14-period window is the best parameter, or if there’s a completely different indicator that crushes it on TSLA’s particular price behavior.

The skill was designed to be reusable. The unlock is asking it to run everything at once.

Step 1: Sweep Every Indicator

The first upgrade is a single prompt asking OpenCode to iterate across all supported indicators and parameter ranges, then rank by expectancy with a minimum trade filter:

“Can you modify python expectancy_skill.py — ticker TSLA — years 3 so it tests every indicator to find the best expectancy for TSLA?”

OpenCode extends the script with a loop, runs each indicator across its natural parameter space, filters out any result with fewer than 5 trades (statistically meaningless), and returns a ranked table.

Here’s what came back for TSLA over 3 years:

STOCH leads on raw expectancy. But there’s a catch hiding in plain sight: only 5–6 trades over three years. That’s less than two signals per year. High expectancy on sparse trades is a fragile result — a single bad trade restructures the entire statistic.

BBANDS and RSI generate more trades (9 each) at nearly the same win rate. That’s a more robust signal.

The sweep tells you which indicators have any edge. It also immediately surfaces which results to trust.

Step 2: Extend the Indicator Library

Before going further, this is also the point where you expand what the skill can test. The base script covers MA, RSI, MACD, BBANDS, and STOCH. You can unlock ATR (volatility breakout) and OBV (volume divergence) with a single request:

“Yes, add ATR (volatility-based breakout) and OBV (volume divergence) to the expectancy script.”

Now both appear in every subsequent sweep automatically.

And if you want to go further — much further — vectorbt wraps three external libraries that collectively add over 300 additional indicators:

“Run the full expectancy sweep on TSLA using all TA-Lib momentum indicators over 3 years.”

The same ranking framework handles them all. One prompt. Hundreds of indicators evaluated.

Step 3: Combine the Top Performers

Here’s where the methodology gets genuinely powerful.

Single indicators generate a signal whenever their one condition is met. Combined indicators use AND logic — both conditions must fire simultaneously. The entry bar is higher. The trades are fewer but higher quality.

“Can you run expectancy_skill.py — ticker TSLA — years 3 with all possible combinations of two indicators to find the one with the best expectancy?”

OpenCode runs every pair, enforces the 5-trade minimum, and returns a ranked combination table:

Two things stand out immediately.

First: RSI + BBANDS dominates every slot in the top 5. STOCH combinations.

Second: the combination table tells a different story than the single-indicator table. RSI(14) ranked 5th alone. In combination with BBANDS(20), it produces a 9.41 profit factor — the highest in the entire table. The indicators aren’t just additive; they’re filtering each other’s noise.

That 9.41 profit factor on RSI(14) + BBANDS(20) means for every dollar lost, the strategy returned $9.41 in profit. Even with only 5 trades, that’s a signal worth investigating.

Step 4: Drill Into the Trade Log

Numbers in a ranking table are the beginning, not the end. The next prompt asks for the actual trade history:

“Give me RSI(14) + BBANDS(20) — TSLA 3yr with the transaction log and chart.”

5 trades. 80% win rate. $974 average expectancy per trade. $4,872 total net profit.

The Full Prompt Sequence

To replicate this exact workflow on any ticker:

  1. “Test every indicator on [TICKER] over [N] years and rank by expectancy (minimum 5 trades)”
  2. “Add [INDICATOR] to the expectancy script, then re-run the sweep”
  3. “Run all two-indicator combinations on [TICKER] over [N] years, minimum 5 trades, ranked by expectancy”
  4. “Give me [TOP COMBO] — [TICKER] [N]yr with the full transaction log and chart”

Four prompts. The skill handles everything else — downloading data, running vectorbt, calculating expectancy, generating the ranking table, producing the annotated chart.

What This Approach Actually Changes

Most retail backtesting is hypothesis-driven: you have a theory about an indicator, you test it, you see what happens. This workflow inverts that. You let the math surface the hypothesis — then you go examine whether it makes intuitive sense.

RSI(7) + BBANDS(15) at $1,730 expectancy wasn’t something anyone would have guessed going in. Neither was the discovery that STOCH — a strong single-indicator performer — collapses entirely in combination. Those findings only emerge when you can run everything at once and let the numbers speak first.

That’s the real unlock of having the skill. It makes exhaustive search cheap enough so we actually can do it.


메타데이터
post_id
91baff25db26
slug
how-to-go-from-one-backtest-to-hundreds-and-find-the-strategy-the-market-is-hiding-91baff25db26
url
https://medium.com/@wl8380/how-to-go-from-one-backtest-to-hundreds-and-find-the-strategy-the-market-is-hiding-91baff25db26
canonical_url
https://medium.com/@wl8380/how-to-go-from-one-backtest-to-hundreds-and-find-the-strategy-the-market-is-hiding-91baff25db26
author_url
https://medium.com/@wl8380
status
ok
fetched_at
2026-06-09 15:37:30