A Strategy Is Not A Prompt
A chat prompt is cheap.
A strategy is not.
If a user writes “buy more when BTC is cheap,” the engine cannot run that sentence. It has to know what cheap means, what data to read, how much cash exists, what happens when cash is short, which branch fired, and what state carries into the next candle.
So the first real work was not execution. It was the spec.
Strategy Lab uses an explicit strategy shape: market, timeframe, portfolio, execution, indicators, external_series, rules, and constraints.
Rules become decision trees. IF nodes choose then or else. ACTION nodes do work. Some branches contain actions[], which means order matters: set state first, then buy. No collapsing that into vibes.
The current action set is small on purpose:
cashflowadds simulated capitalbuysimulates a BTC buysetwrites strategy state
State exists because real strategies remember things. A running high. A regime flag. A monthly counter. A buy count. The spec reads state with get(...) and writes it with set, while protected values like cash and BTC value stay read-only.
The language has data reads: price(), ma(...), highest_close(...), time(...), series(...). It has arithmetic. It has external series declarations for things like Fear & Greed or CBBI. It has validation that rejects unknown functions, unsafe expressions, undeclared data, live-trading fields, and arbitrary code.
That is the point. The strategy has to become something boring enough to inspect.
Then the backtest can leave a trace:
- cashflows
- orders
- requested spend
- actual spend
- partial fills
- unfilled attempts
- variables
- indicators
- equity curve
- strategy graph
The trace is where bad strategies start to look bad. Too much cash sitting unused. Too many partial orders. A beautiful return number with a broken deployment story.
We started with BTC daily DCA-style strategies because DCA is the smallest useful sandbox. Cash comes in. Rules decide whether to buy. The engine records what happened. It is small enough to debug and real enough to expose the hard parts.
This is not the final scope.
The direction is still bigger: user describes a strategy, the system turns it into a spec, the validator checks it, Strategy Lab tests it, and later execution runs only after login, API keys, limits, and controls are in place.
Before the bot, the language.