$npx -y skills add agiprolabs/claude-trading-skills --skill strategy-frameworkStandardized template for defining trading strategies with entry rules, exit rules, position sizing, risk parameters, and performance criteria
| 1 | # Strategy Framework |
| 2 | |
| 3 | A standardized system for defining, documenting, testing, and managing trading strategies. This skill provides templates and tools that enforce discipline, enable reproducibility, and make strategies testable. |
| 4 | |
| 5 | ## Why a Strategy Framework Matters |
| 6 | |
| 7 | Trading without a written strategy framework leads to: |
| 8 | - **Inconsistency**: ad-hoc decisions driven by emotion rather than rules |
| 9 | - **Untestability**: vague ideas that cannot be backtested or evaluated |
| 10 | - **Scope creep**: strategies that drift without version-controlled definitions |
| 11 | - **Unmanaged risk**: missing stop losses, position limits, or drawdown halts |
| 12 | |
| 13 | A strategy framework forces you to: |
| 14 | 1. State a falsifiable hypothesis about a market inefficiency |
| 15 | 2. Define precise, machine-testable entry and exit rules |
| 16 | 3. Specify position sizing and risk parameters before trading |
| 17 | 4. Set minimum performance criteria for continuation or retirement |
| 18 | 5. Track changes through versioned strategy documents |
| 19 | |
| 20 | ## Strategy Definition Template |
| 21 | |
| 22 | Every strategy must be documented using the standard template. The full copy-paste template is in `references/strategy_template.md`. |
| 23 | |
| 24 | ### Core Sections |
| 25 | |
| 26 | **Identity** |
| 27 | ``` |
| 28 | Name: SOL-EMA-Cross v1.0 |
| 29 | Asset class: Solana tokens (top 50 by 24h volume) |
| 30 | Timeframe: Primary 1H, confirmation 4H |
| 31 | Style: Trend following |
| 32 | ``` |
| 33 | |
| 34 | **Edge Hypothesis**: State what market inefficiency you are exploiting and why it exists. |
| 35 | |
| 36 | ``` |
| 37 | Hypothesis: Solana mid-cap tokens exhibit momentum persistence |
| 38 | on the 1H timeframe due to retail herding behavior and low |
| 39 | institutional participation. EMA crossovers capture the |
| 40 | initiation of these trends. |
| 41 | ``` |
| 42 | |
| 43 | **Entry Rules**: Specific, testable conditions combined with AND/OR logic. |
| 44 | |
| 45 | ```python |
| 46 | def entry_signal(data: pd.DataFrame) -> bool: |
| 47 | """All conditions must be True (AND logic).""" |
| 48 | ema_cross = data["ema_12"] > data["ema_26"] # EMA 12 crossed above 26 |
| 49 | ema_rising = data["ema_26"].diff(3) > 0 # 26 EMA trending up |
| 50 | volume_ok = data["volume"] > data["vol_sma_20"] * 1.5 # Volume confirmation |
| 51 | regime_ok = data["adx"] > 20 # Trending regime |
| 52 | return ema_cross & ema_rising & volume_ok & regime_ok |
| 53 | ``` |
| 54 | |
| 55 | **Exit Rules**: Every strategy needs multiple exit mechanisms. |
| 56 | |
| 57 | | Exit Type | Method | Parameters | |
| 58 | |-----------|--------|------------| |
| 59 | | Stop Loss | ATR-based | 2.0 × ATR(14) below entry | |
| 60 | | Take Profit | Risk multiple | 3.0 × risk (3:1 R:R) | |
| 61 | | Trailing Stop | Chandelier | 3.0 × ATR(14) from highest high | |
| 62 | | Time Stop | Bar count | Close if flat after 20 bars | |
| 63 | | Signal Exit | EMA reversal | EMA 12 crosses below EMA 26 | |
| 64 | |
| 65 | **Position Sizing**: Method and parameters. See the `position-sizing` skill for details. |
| 66 | |
| 67 | ```python |
| 68 | risk_per_trade = 0.02 # 2% of portfolio |
| 69 | stop_distance_pct = 0.05 # 5% from entry (ATR-derived) |
| 70 | position_size = (portfolio * risk_per_trade) / stop_distance_pct |
| 71 | ``` |
| 72 | |
| 73 | **Risk Parameters**: Portfolio-level guardrails. See the `risk-management` skill. |
| 74 | |
| 75 | ``` |
| 76 | Max concurrent positions: 5 |
| 77 | Risk per trade: 2% of portfolio |
| 78 | Daily loss limit: 5% of portfolio |
| 79 | Max drawdown halt: 15% — stop trading, review strategy |
| 80 | Correlated exposure limit: 10% (e.g., meme tokens combined) |
| 81 | ``` |
| 82 | |
| 83 | **Filters**: Conditions that prevent entry even if signals fire. |
| 84 | |
| 85 | ```python |
| 86 | def filters_pass(token: dict, market: dict) -> bool: |
| 87 | """All filters must pass before entry is allowed.""" |
| 88 | volume_ok = token["volume_24h"] > 500_000 # Min $500K volume |
| 89 | liquidity_ok = token["liquidity"] > 100_000 # Min $100K liquidity |
| 90 | age_ok = token["age_days"] > 7 # Not brand new |
| 91 | holders_ok = token["holder_count"] > 500 # Sufficient distribution |
| 92 | regime_ok = market["regime"] != "crisis" # No crisis regime |
| 93 | return all([volume_ok, liquidity_ok, age_ok, holders_ok, regime_ok]) |
| 94 | ``` |
| 95 | |
| 96 | **Performance Criteria**: When to continue, review, or retire. |
| 97 | |
| 98 | ``` |
| 99 | Continue: Sharpe > 1.0, PF > 1.5, Win Rate > 40%, MDD < 20% |
| 100 | Review: Any metric degrades 25% from baseline |
| 101 | Retire: Rolling 30-day Sharpe < 0, or 3 consecutive losing months |
| 102 | ``` |
| 103 | |
| 104 | ## Strategy Lifecycle |
| 105 | |
| 106 | ### 1. Hypothesis |
| 107 | |
| 108 | Identify a market inefficiency and explain why it exists and why it might persist. |
| 109 | |
| 110 | **Good hypothesis**: "New PumpFun tokens that reach 80+ SOL in bonding curve within 10 minutes have a 65% probability of graduating to Raydium, creating a predictable price spike at graduation." |
| 111 | |
| 112 | **Bad hypothesis**: "SOL will go up." (Not specific, not testable, no edge identified.) |
| 113 | |
| 114 | ### 2. Definition |
| 115 | |
| 116 | Write the full strategy document using the template in `references/strategy_template.md`. Every field must be filled. If you cannot fill a field, the strategy is not ready. |
| 117 | |
| 118 | ### 3. Backtest |
| 119 | |
| 120 | Test on historical data using `vectorbt` or equivalent. Requirements: |
| 121 | - Minimum 100 trades in the test period |
| 122 | - Use walk-forward validation (train on 70% |