← LeaderboardThe Skill Leaderboard

exit-manager

Evaluate exit rules for saved long positions without placing broker orders. Evaluates stop loss, take profit, trailing stop, timeout, regime-based exit, drawdown exit, and cooldown after stop loss. Outputs sell/hold decisions per position with rationale. Use when monitoring open positions, checking if a position should be closed, or managing risk on existing trades.

Published by tradermonty ↗tradermonty/claude-trading-skills

Try your first task

A source-grounded starter task has not been verified for this skill yet.

SKILL.md

name: exit-managerdescription: Evaluate exit rules for saved long positions without placing broker orders. Evaluates stop loss, take profit, trailing stop, timeout, regime-based exit, drawdown exit, and cooldown after stop loss. Outputs sell/hold decisions per position with rationale. Use when monitoring open positions, checking if a position should be closed, or managing risk on existing trades.

Exit Manager

Overview

Evaluates open positions against multiple exit criteria and produces a sell/hold decision for each. Supports:

  • Stop Loss: Fixed percentage below entry price
  • Take Profit: Fixed percentage above entry price (risk/reward ratio)
  • Trailing Stop: Dynamic stop that follows price upward
  • Timeout: Close positions held longer than N days without sufficient profit
  • Regime Exit: Close all positions if market breadth drops below critical level
  • Drawdown Exit: Close position if unrealized loss exceeds threshold
  • Cooldown: Don't re-enter a symbol closed by stop loss within N days. Disabled by default (--cooldown-days 0); enable with --cooldown-days N.

When to Use

  • User asks "should I sell this position?" or "check my exits"
  • Monitoring open positions for stop loss / take profit triggers
  • After a market regime change (breadth drops, top risk rises)
  • As part of an automated trading loop (monitor mode)
  • When reviewing positions held longer than expected

Prerequisites

  • No API keys required; reads saved position data only and never contacts a broker
  • Python 3.9+ with standard library only
  • Long positions only: qty, entry price, and current price must be finite and positive. Shorts and zero quantities are rejected.
  • symbol is required. Optional P&L values must be finite; when omitted, they are derived from prices and quantity. Day counts must be non-negative integers.
  • Invalid input fails the whole batch with exit code 2 and a position/field error on stderr; no normal SELL/HOLD report is emitted.

Workflow

Step 1: Gather Position Data

For each open position, collect:

  • symbol: Ticker
  • qty: Shares held
  • avg_entry_price: Cost basis per share
  • current_price: Current market price
  • highest_price: Highest price seen since entry (REQUIRED for trailing stop; falls back to avg_entry_price if absent, which disables trailing. Re-feed prior highest_price output or persisted positions_state.json.)
  • unrealized_plpc: Unrealized P&L percentage
  • days_held: Days since position opened (optional, for timeout)

Ask for a saved JSON array, or an object containing a positions or result array. Do not connect to a broker or place an order. P&L percentage values are fractions (0.02 means 2%). --breadth accepts a finite value from 0 to 100, and --cooldown-days must be non-negative.

python3 skills/exit-manager/scripts/exit_manager.py \
  --positions positions.json --profile moderate --output-dir reports/

Step 2: Configure Exit Rules

Default rules (adjust per profile):

RuleConservativeModerateAggressive
Stop Loss %2%3%5%
Take Profit %4%6%10%
Trailing Stop %1.5%2%3%
Timeout (days)101520
Timeout min profit %2%2%3%
Regime exit (breadth)< 20< 20< 15
Position drawdown exit-5%-7%-10%
Cooldown after stop (days, --cooldown-days; 0=disabled default)553

Step 3: Evaluate Each Position

For each position, check in order (first trigger wins):

  1. Cooldown Violation (highest priority): If cooldown_days > 0 AND days_since_stop < cooldown_days → SELL
  2. Regime Exit: If breadth < critical threshold → SELL ALL
  3. Stop Loss: If current_price ≤ entry × (1 - stop_pct) → SELL
  4. Position Drawdown: If unrealized_plpc ≤ drawdown_threshold → SELL
  5. Trailing Stop: If current_price ≤ highest_price × (1 - trail_pct) → SELL
  6. Take Profit: If current_price ≥ entry × (1 + target_pct) → SELL
  7. Timeout: If days_held ≥ timeout_days AND profit < min_profit_pct → SELL
  8. HOLD: If none of the above → HOLD

Step 4: Review Exit Decisions

For each SELL decision:

  • Present the proposed exit and its reason for the user's review
  • Log the hypothetical exit reason and supplied P&L without changing broker or thesis position state
  • Treat SELL as an analytical label; this skill does not authorize or execute an order

For HOLD decisions:

  • Update trailing stop level if price has moved up
  • Log the hold reason. The caller must persist highest_price and provide it on the next run.

Step 5: Report

Generate a summary:

Exit Manager Report
===================
Positions evaluated: 4
Sells: 1 (DPZ - stop loss hit)
Holds: 3 (COST, NXPI, PANW)

Details:
- COST: HOLD (up 0.30%, trailing stop at $1,063.44)
- DPZ: SELL (stop loss hit at $338.00, entry $348.71)
- NXPI: HOLD (up 1.44%, trailing stop at $253.90)
- PANW: HOLD (up 0.36%, trailing stop at $399.89)

Output Format

JSON output for each position:

{
  "symbol": "DPZ",
  "decision": "SELL",
  "reason": "stop_loss",
  "entry_price": 348.71,
  "current_price": 338.00,
  "stop_price": 338.2487,
  "target_price": 369.6326,
  "trailing_stop": 341.7358,
  "unrealized_pl": -10.71,
  "unrealized_plpc": -0.03071,
  "days_held": 5
}

Key Principles

  1. Stop loss first: Always check stop loss before take profit.
  2. Regime override: If the market is in critical condition, exit all positions.
  3. Trailing stop protects profits: Once a position is profitable, the trailing stop locks in gains.
  4. Timeout prevents capital stagnation: Don't hold losing positions indefinitely.
  5. Cooldown prevents re-entry loops: After a stop loss, wait N days before re-entering.
  6. Log everything: Every exit decision and reason must be recorded for post-trade review.

Resources

  • scripts/exit_manager.py: Main evaluation script (CLI interface)
  • references/exit_rules.md: Detailed exit rule methodology and examples
exit-manager by tradermonty · The Skill Leaderboard