# Swing Trend/Retest Research Sleeve Pattern

Use this pattern when an intraday crypto paper/live-preview candidate is technically safe but has weak true-lifecycle evidence from fees, stops, time exits, or local-top entries.

## Goal

Build a separate **paper-only / research-only** swing sleeve instead of loosening live gates or over-tuning the failing intraday path.

## Implementation steps

1. Keep the existing intraday candidate running only as evidence collection.
2. Add a new strategy ID and isolated runtime directory, for example `candidate_swing_trend_retest_research` under `runtime/experiments/<strategy_id>/`.
3. Implement entry logic as a pure function/dataclass that requires:
   - primary liquid coin universe only,
   - confirmed higher-timeframe trend (`current > fast SMA > slow SMA` or equivalent),
   - meaningful pullback from swing high,
   - retest level held,
   - reclaim confirmation,
   - liquidity/spread/funding checks,
   - expected move comfortably above realistic round-trip cost.
4. Use realistic lifecycle simulation, not instant synthetic exits:
   - persist `open_positions`,
   - block same-coin re-entry with `already_open`,
   - set a longer max hold than intraday (for example 96 ticks vs 24),
   - journal entry, stop, MFE/MAE, exit reason, fees/slippage, and net PnL.
5. Wire supervisor aliases such as `swing`, `swing_retest`, and the full strategy ID.
6. Include the sleeve in strategy scorecards as `Research`, with blockers such as `research_only_no_live_authority`, `no_swing_retest_entries_yet`, `swing_sample_too_small`, and `swing_net_pnl_not_positive_yet`.
7. Start it only after verifying exact paper-only process identity and env flags from `/proc/<pid>/environ`:
   - `CTB_STRATEGY_ID` matches,
   - `CTB_PAPER_TRADING=true`,
   - `CTB_DRY_RUN=false`,
   - command points to the paper runtime,
   - no live/signed mainnet flags.

## Tests to add

- Pure strategy tests: valid pullback/reclaim builds an `OrderIntent`; no pullback, weak trend, bad universe, high spread/funding all block.
- Runtime test: mocked market data opens a persistent paper lifecycle position and sets the swing `max_hold_ticks`.
- Supervisor test: aliases resolve to the swing strategy and unsafe/stale PIDs are not trusted.
- Scorecard test: missing or tiny swing evidence remains Research/Blocked and never borrows intraday readiness.

## Reporting pattern

Report to the user concisely:

```text
built / started / paper-only verified
entries, exits, open positions, open notional, closed PnL
mainnet_signed_action=false
live_order_allowed=false/None
no live recommendation until enough positive closed lifecycle evidence exists
```

Do not claim edge quality from open positions or zero-exit samples.