AI Strategy Generator
The AI Strategy Generator is TodoAI's core entry point. Go to Strategy → click New Strategy → choose AI Generator, and describe your idea in plain English. The system will auto-generate executable rules.
For details on the "two-stage pipeline" mechanics, see AI Pipeline. This page is about how to use it.
How to write a good prompt
1. Be specific about the indicator
# Good
Buy when RSI(14) drops below 30
# Not as good
Buy when RSI is low2. State both entry and exit
# Good
- RSI(14) < 30 to buy
- RSI(14) > 70 to sell
- Stop-loss 2%, take-profit 4%
# Not as good
- Use RSI for a reversal strategy3. Combine conditions with "AND" / "OR"
Buy conditions:
1. MACD(12,26,9) golden cross
2. AND close above EMA(200)
3. AND Bollinger band width is contracting4. Make risk parameters explicit
- Stop-loss 2%
- Take-profit 5%
- Timeframe 1h
- Symbol BTC/USDTSupported indicators
| Indicator | Parameters | Example |
|---|---|---|
| SMA | period | SMA(20) |
| EMA | period | EMA(200) |
| RSI | period | RSI(14) |
| MACD | fast, slow, signal | MACD(12,26,9) |
| Bollinger Bands | period, std | BB(20, 2) |
| ATR | period | ATR(14) |
| VWAP | - | VWAP |
| StochRSI | period, smoothK, smoothD | StochRSI(14,3,3) |
| SuperTrend | period, multiplier | SuperTrend(10, 3) |
Supported operators
| Operator | Meaning |
|---|---|
<, > | less than / greater than |
<=, >= | less or equal / greater or equal |
== | equal |
crosses above | crosses above |
crosses below | crosses below |
Template marketplace
If you don't feel like writing a description, the Strategy page offers quick-start templates:
- RSI oversold bounce — RSI<30 entry, RSI>70 exit
- MACD golden cross — MACD crosses above signal line
- Moving average breakout — Price breaks above EMA20
- Bollinger band reversal — Price touches lower band, enter
Each template has a pre-filled prompt you can adjust directly.
Editing the generated strategy
After AI generation:
- Reasoning chain: right-side timeline showing every AI thought step
- DSL source:
DslEditorrenders in real time, directly editable - Logic diagram:
StrategyVisualizerdraws rules as a tree - After editing: click "Save" to overwrite the strategy
Linking reasoning back to DSL
Each reasoning step has a "corresponding DSL line" marker — clicking it auto-scrolls DslEditor to that line and highlights it. This link is built via fuzzy matching (token overlap), not LLM-explicit annotation.
Reasoning chain edit + regenerate
You can edit a step in the reasoning chain — say, changing RSI(14) < 30 to RSI(14) < 25 — and ask Stage 2 to regenerate the DSL based on the new reasoning. This path requires the strategy to already exist (have a strategyId); it's not available during initial creation.
What if generation fails?
| Error | Fix |
|---|---|
| "AI generated invalid JSON, please retry" | Click generate again, or simplify the description |
| "Network error" | Wait 60s and retry |
| "60s timeout" | Simplify the prompt, or change timeframe |
| "Daily generation limit reached" | Upgrade to PRO/WHALE |
Known limitations
- LLMs occasionally output non-strict JSON, salvaged by
src/app/api/strategy/fix-json - Editing reasoning then regenerating only works for existing strategies
- Fuzzy-matched DSL lines aren't always 100% accurate (heuristic)