# Trading Wizard Guide

Step-by-step guided setup for creating and validating AI trading strategies.

---

## Overview

The Trading Wizard walks you through the complete process of creating a trading strategy:

1. **Welcome** — Choose your creation method
2. **Create** — Build your strategy
3. **Critique** — AI review for issues
4. **Backtest** — Test against history
5. **Validate** — Walk-forward testing
6. **Stress Test** — Crisis scenario testing
7. **Complete** — Launch paper trading

Each step has clear requirements before you can proceed.

---

## Starting the Wizard

### Access
1. Go to **Trading > Strategies**
2. Click **Guided Setup** (or **New Strategy**)
3. The wizard opens at Step 1

### Quick Path Option
For experienced users:
- Toggle **Quick Path** in the Welcome step
- Skips optional validation steps (Critique, Validate)
- Faster iteration, less safety checking

---

## Step 1: Welcome

Choose how you want to create your strategy.

### Creation Methods

| Method | Best For | Description |
|--------|----------|-------------|
| **Plain English** | Beginners | Describe strategy in natural language |
| **Visual Builder** | Intermediate | Drag-and-drop signal blocks |
| **DSL Editor** | Advanced | Write strategy code directly |
| **Templates** | Quick start | Start from pre-built strategies |

### Templates Available

| Template | Strategy Type | Risk Level |
|----------|--------------|------------|
| Momentum Rider | RSI + Volume breakout | Aggressive |
| Mean Reversion Pro | Bollinger Band bounce | Moderate |
| Trend Follower | EMA crossover + ADX | Moderate |
| Volatility Harvester | VIX-based sizing | Aggressive |
| Crypto Funding Arb | Funding rate extremes | Conservative |
| Multi-Asset Diversifier | Cross-asset correlation | Conservative |

### To Proceed
- Select a creation method
- Click **Continue**

---

## Step 2: Create

Build your trading strategy.

### Using Plain English
1. Describe your strategy in the text box
2. Example: "Buy SPY when RSI drops below 30 and price is above the 200-day moving average. Sell when RSI goes above 70 or I lose 5%."
3. Click **Translate**
4. AI converts to executable strategy
5. Review the generated logic
6. Make adjustments if needed

### Using Visual Builder
1. Select signal blocks from the palette
2. Drag to the canvas
3. Connect blocks to build logic
4. Configure parameters for each block
5. Add entry and exit conditions

### Using DSL Editor
1. Write strategy code directly
2. Use signal primitives (see [Algorithm Reference](./14-algorithm-reference.md))
3. Syntax highlighting helps identify errors
4. Click **Validate** to check for issues

### Using Templates
1. Browse available templates
2. Click **Use Template**
3. Customize parameters as needed
4. Adjust to your preferences

### To Proceed
- Strategy must be valid (no syntax errors)
- Click **Save & Continue**
- Your strategy receives an ID

---

## Step 3: Critique (Optional)

AI performs an adversarial review of your strategy.

### What the AI Checks
- **Logic flaws** — Contradictions or impossible conditions
- **Risk issues** — Missing stop losses, excessive leverage
- **Best practices** — Common mistakes and improvements
- **Market assumptions** — Unrealistic expectations

### Review Results

| Assessment | Meaning | Action |
|------------|---------|--------|
| **Pass** | No major issues | Proceed to backtest |
| **Warnings** | Minor concerns | Review and decide |
| **Block** | Critical issues | Must fix before proceeding |

### Understanding Warnings
Each warning includes:
- What the issue is
- Why it matters
- How to fix it

### To Proceed
- Assessment cannot be "Block"
- Address warnings or acknowledge them
- Click **Continue**

---

## Step 4: Backtest

Test your strategy against 90 days of historical data.

### Running the Backtest
1. Click **Run Backtest**
2. Wait for completion (usually 30-60 seconds)
3. Review results

### Key Metrics

| Metric | What It Measures | Good Value |
|--------|------------------|------------|
| **Total Return** | Overall profit/loss | Positive |
| **Sharpe Ratio** | Risk-adjusted return | ≥ 0.5 to proceed |
| **Max Drawdown** | Worst decline | ≤ 25% to proceed |
| **Win Rate** | Profitable trades % | > 50% |
| **Trade Count** | Number of trades | Enough for statistics |
| **Profit Factor** | Gross profit / gross loss | > 1.5 |

### Understanding the Equity Curve
- Shows portfolio value over time
- Smooth upward = consistent gains
- Volatile = higher risk strategy
- Big drops = significant drawdowns

### Adjusting Strategy
If results are poor:
1. Click **Edit Strategy**
2. Return to Create step
3. Modify parameters
4. Re-run backtest

### To Proceed
- Sharpe Ratio ≥ 0.5
- Max Drawdown ≤ 25%
- Click **Continue**

---

## Step 5: Validate (Optional)

Walk-forward testing validates the strategy on unseen data.

### What Walk-Forward Does
1. **Train Period**: Strategy optimized on 70% of data
2. **Test Period**: Performance measured on remaining 30%
3. **Comparison**: Are results consistent?

### Why This Matters
- Prevents overfitting to historical data
- Shows if strategy generalizes
- More realistic performance estimate

### Key Metric: OOS/IS Ratio
- **Out-of-Sample (OOS)**: Test period performance
- **In-Sample (IS)**: Training period performance
- **Ratio**: OOS ÷ IS

| Ratio | Interpretation |
|-------|----------------|
| ≥ 0.9 | Excellent — results consistent |
| 0.7-0.9 | Good — acceptable degradation |
| 0.5-0.7 | Concerning — possible overfitting |
| < 0.5 | Poor — likely overfit |

### To Proceed
- OOS/IS Ratio ≥ 0.7
- Click **Continue**

---

## Step 6: Stress Test

Test your strategy against historical crisis periods.

### Crisis Scenarios

| Scenario | Period | What Happened |
|----------|--------|---------------|
| 2008 Financial Crisis | Sep-Nov 2008 | -40% market drop |
| 2010 Flash Crash | May 6, 2010 | 9% drop in minutes |
| 2015 China Devaluation | Aug 2015 | Global selloff |
| 2018 Volmageddon | Feb 2018 | VIX spike |
| 2020 COVID Crash | Feb-Mar 2020 | -34% in weeks |
| 2022 Bear Market | Jan-Oct 2022 | Prolonged decline |

### Running Stress Tests
1. Click **Run Stress Tests**
2. Each scenario is simulated
3. Results show per-scenario performance

### Understanding Results
For each scenario:
- **Return**: How the strategy performed
- **Max Drawdown**: Worst point during crisis
- **Recovery**: How quickly it recovered

### Acceptable Results
- No single scenario with > 50% drawdown
- Strategy should survive (not thrive) in crises
- Some loss is expected in extreme events

### To Proceed
- No scenario with drawdown > 50%
- Click **Continue**

---

## Step 7: Complete

Review your strategy and start paper trading.

### Summary Review
- Strategy logic recap
- All test results at a glance
- Key metrics highlighted
- Risk parameters confirmed

### Starting Paper Trading
1. Review the summary
2. Confirm position sizing
3. Click **Start Paper Trading**
4. Strategy begins running in paper mode

### What Happens Next
- Strategy monitors the market in real-time
- Simulated trades execute based on your rules
- Track performance on the Trading Dashboard
- No real money at risk

---

## Progress Persistence

### Auto-Save
- Progress saved automatically
- Can close and return later
- 24-hour expiry on saved progress

### Resuming
- Return to the wizard
- Prompt asks to resume or start fresh
- Resume picks up where you left off

### Starting Over
- Click **Reset** at any time
- Clears saved progress
- Start from Step 1

---

## Graduation Tracker

After completing the wizard, your strategy enters the graduation track.

### Tiers

| Tier | Status | Requirements |
|------|--------|--------------|
| **Mock** | Available | Default starting point |
| **Paper** | Unlocked | Broker configured |
| **Live** | Locked | Meet graduation requirements |

### Live Graduation Requirements

| Requirement | Threshold | Why |
|-------------|-----------|-----|
| Days in Paper | 30 | Prove consistency |
| Trade Count | 50+ | Statistical significance |
| Sharpe Ratio | ≥ 1.0 | Quality returns |
| Max Drawdown | ≤ 15% | Risk control |

### Tracking Progress
1. Go to **Trading > Graduation**
2. See all your strategies
3. View progress on each requirement
4. Strategies highlight when ready to graduate

---

## Getting Help

### Ask AI Buttons
Throughout the wizard, click **Ask AI** for explanations:
- What is Sharpe Ratio?
- Why does drawdown matter?
- How does walk-forward work?
- What is overfitting?

### Mini-Tours
Click **Take a Tour** for guided walkthroughs of specific features.

### Tips in Each Step
Look for the 💡 icons — they provide contextual tips.

---

## Common Issues

### Strategy Won't Save
- Check for syntax errors
- Ensure all required fields are filled
- Try a simpler strategy first

### Backtest Takes Too Long
- Complex strategies take longer
- Large symbol universes are slower
- Try reducing scope

### Can't Proceed Past Backtest
- Sharpe must be ≥ 0.5
- Drawdown must be ≤ 25%
- Adjust strategy and re-test

### Walk-Forward Ratio Too Low
- Strategy may be overfit
- Simplify the logic
- Reduce the number of parameters

---

## Best Practices

### Do
- Start simple and add complexity
- Read the critique feedback carefully
- Pay attention to drawdown, not just returns
- Understand why a strategy works

### Don't
- Skip the optional steps initially
- Ignore warnings from the critique
- Chase the highest backtest returns
- Rush to live trading

---

## Next Steps

After completing the wizard:

1. **Monitor paper trading** — Check daily performance
2. **Review trades** — Understand what's happening
3. **Wait for graduation** — Meet the requirements
4. **[Set up a broker](./04-broker-setup.md)** — Enable live trading when ready

---

*The wizard is designed to help you build robust strategies. Take your time with each step.*
