Skip to content

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 ​

text
# Good
Buy when RSI(14) drops below 30

# Not as good
Buy when RSI is low

2. State both entry and exit ​

text
# 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 strategy

3. Combine conditions with "AND" / "OR" ​

text
Buy conditions:
1. MACD(12,26,9) golden cross
2. AND close above EMA(200)
3. AND Bollinger band width is contracting

4. Make risk parameters explicit ​

text
- Stop-loss 2%
- Take-profit 5%
- Timeframe 1h
- Symbol BTC/USDT

Supported indicators ​

IndicatorParametersExample
SMAperiodSMA(20)
EMAperiodEMA(200)
RSIperiodRSI(14)
MACDfast, slow, signalMACD(12,26,9)
Bollinger Bandsperiod, stdBB(20, 2)
ATRperiodATR(14)
VWAP-VWAP
StochRSIperiod, smoothK, smoothDStochRSI(14,3,3)
SuperTrendperiod, multiplierSuperTrend(10, 3)

Supported operators ​

OperatorMeaning
<, >less than / greater than
<=, >=less or equal / greater or equal
==equal
crosses abovecrosses above
crosses belowcrosses 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: DslEditor renders in real time, directly editable
  • Logic diagram: StrategyVisualizer draws 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? ​

ErrorFix
"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)

TodoAI · Turn trading ideas into automated strategies