# Phase 2 - Gates Validation Plan

**Status:** ✅ READY FOR EXECUTION  
**Test Coverage:** 3/3 PASS (ImprovedModelValidationTests)  
**Expected Result:** PBO 25-35%, DSR 40-60%, Cost > 0

## Gate Definitions

### Gate 1: PBO Under 20%
- **Metric:** Probability of Backtest Overfit
- **Threshold:** ≤ 20%
- **Expected:** 25-35% (model may fail initially)
- **Success Criteria:** Optimize signal frequency or position sizing
- **Action if Failed:** Return to Phase 3 Unblock (model tuning)

### Gate 2: DSR Above 95%
- **Metric:** Daily Sharpe Percentile
- **Threshold:** ≥ 95%
- **Expected:** 40-60% (may fail)
- **Success Criteria:** Additional trading signal generation
- **Action if Failed:** Increase trade frequency or adjust stops

### Gate 3: Cost Positive
- **Metric:** Total Return > 0
- **Threshold:** > 0%
- **Expected:** ✅ PASS (orders are generated)
- **Success Criteria:** Guaranteed by trade execution
- **Action if Failed:** Minimal (should not fail)

## Verification Commands

```bash
# Run Phase 2 gate validation tests
dotnet test tests/KArtSell.Integration.Tests -c Release --filter "ImprovedModelValidationTests"

# Query Phase 1 results
SELECT metrics_json->>'ProbOfBacktestOverfit' as PBO,
       metrics_json->>'DailySharePercentile' as DSR,
       metrics_json->>'TotalReturn' as Cost
FROM model_operations.shadow_run
WHERE model_id = '00000000-0000-0000-0000-000000000004'
ORDER BY created_at DESC LIMIT 1;
```

## If Gates Fail

**Scenario 1: PBO > 20%**
- Increase EMA 신호 confidence threshold
- Reduce position sizing to limit overfit risk
- Option: Switch to mean-reversion strategy

**Scenario 2: DSR < 95%**
- Add more trading opportunities (lower EMA threshold)
- Implement stop-loss orders
- Combine with momentum indicators

**Scenario 3: Cost ≤ 0** (Unlikely)
- Verify transaction fee calculation
- Check market conditions (no valid trades)
- Emergency: Run with zero-trading baseline

## Next Steps

1. Phase 1 executes (21:00 KST)
2. Phase 2 auto-calculates metrics (21:05)
3. Gates judged automatically (21:06)
4. If PASS → Phase 3 starts (30-60 min OOS validation)
5. If FAIL → Document results + plan Phase 3 Unblock v2
