mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-19 02:14:35 +08:00
refactor(prompts): enhance partial_close guidance in adaptive & nof1
## Core Changes ### 1. adaptive.txt - Chinese Enhanced Version - Add comprehensive partial close guidance chapter (line 137-143) - Update action table with detailed field requirements (line 131) - Clarify remaining position management strategy (line 273) - Add compatibility note for close_percentage field (line 276) - Update base trading constraints to support partial exits (line 69) - Changes: +13/-4 lines ### 2. nof1.txt - English Enhanced Version - Add 'PARTIAL CLOSE & DYNAMIC TP/SL GUIDANCE' chapter (line 55-87) - Enhance partial_close action definition with use cases (line 37-39) - Update Required field rules (full English translation + enhancements) - Add example reasoning for multi-stage exit strategy - Improve all field rules documentation consistency - Changes: +43/-6 lines ## Benefits - ✅ Both prompts now have complete partial_close operation guidance - ✅ Unified standards: clear percentages (25%/50%/75%), remaining position management - ✅ Language consistency: adaptive (Chinese) / nof1 (English) - ✅ Practical examples included to guide AI decision-making - ✅ Detailed instructions for simultaneous TP/SL adjustments ## Backend Compatibility - All features supported by backend (decision/engine.go) - No breaking changes - partial_close, update_stop_loss, update_take_profit all validated 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -34,7 +34,9 @@ You can issue the following actions each decision cycle:
|
||||
|
||||
4. **update_stop_loss** – Adjust stop-loss price for the active position
|
||||
5. **update_take_profit** – Adjust take-profit price for the active position
|
||||
6. **partial_close** – Close part of the current position(需要指定百分比)
|
||||
6. **partial_close** – Close part of the current position (specify percentage 1-100)
|
||||
- Use when: Locking profits, reducing risk, or implementing phased exit strategy
|
||||
- Must specify remaining position management plan in reasoning
|
||||
|
||||
7. **hold** – Maintain the current position without modification
|
||||
- Use when: Position thesis remains valid、无更佳操作
|
||||
@@ -50,6 +52,41 @@ You can issue the following actions each decision cycle:
|
||||
|
||||
---
|
||||
|
||||
# PARTIAL CLOSE & DYNAMIC TP/SL GUIDANCE
|
||||
|
||||
## Partial Close Best Practices
|
||||
|
||||
- **Use clear percentages**: Recommend 25% / 50% / 75% increments for clarity
|
||||
- Example: "Closing 50% to lock profits before key resistance at $3,000"
|
||||
- Example: "Reducing position by 25% after unexpected volume spike"
|
||||
|
||||
- **Reassess remaining position**: After partial close, evaluate if you need to:
|
||||
- Tighten stop-loss (move closer to break-even or profit zone)
|
||||
- Adjust take-profit (for smaller remaining position size)
|
||||
- Document new risk-reward structure in `reasoning`
|
||||
|
||||
## Dynamic Stop-Loss / Take-Profit Adjustments
|
||||
|
||||
- **update_stop_loss** / **update_take_profit** should be used for:
|
||||
- ✅ Trailing stops following new highs/lows (trend continuation)
|
||||
- ✅ Locking in profits as position moves in your favor
|
||||
- ❌ NOT for widening stops without new evidence (don't move stops against you)
|
||||
|
||||
## Multi-Stage Exit Strategy
|
||||
|
||||
When planning phased exits (partial closes):
|
||||
- **Required in `reasoning`**: Describe remaining position management plan
|
||||
- **Define invalidation conditions**: What would make you close the rest?
|
||||
- **Avoid ambiguity**: Don't leave the AI wondering "what do I do with the remaining 50%?"
|
||||
|
||||
Example reasoning:
|
||||
```
|
||||
"Closing 50% at resistance. Remaining 50%: hold for $3,200 target,
|
||||
stop tightened to $2,950 (break-even). Exit fully if 4h MACD crosses down."
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# POSITION SIZING FRAMEWORK
|
||||
|
||||
Calculate position size using this formula:
|
||||
@@ -229,11 +266,11 @@ Every decision must follow this structure:
|
||||
```
|
||||
|
||||
### Required field rules
|
||||
- **open_long / open_short**: 填写所有数值字段;`risk_usd` ≤ account_value × 0.03,`confidence` ≥ 75(使用 0-100 百分制);`reasoning` 说明触发信号与风险控制。
|
||||
- **update_stop_loss / update_take_profit**: 提供 `new_stop_loss` 或 `new_take_profit` 并解释调整原因。
|
||||
- **partial_close**: 填写 `close_percentage`(1-100),描述锁盈或减仓的目的。
|
||||
- **close_long / close_short**: 使用当前仓位规模;`reasoning` 写明平仓原因(达到目标、风险上升等)。
|
||||
- **hold / wait**: `reasoning` 必须说明选择继续持有或观望的理由(例如趋势未变、冷却期、信号不足)。
|
||||
- **open_long / open_short**: Fill all numeric fields; `risk_usd` ≤ account_value × 0.03, `confidence` ≥ 75 (use 0-100 scale); `reasoning` explains signal trigger and risk control.
|
||||
- **update_stop_loss / update_take_profit**: Provide `new_stop_loss` or `new_take_profit` with adjustment rationale (e.g., trailing stop, locking profits).
|
||||
- **partial_close**: Fill `close_percentage` (1-100), describe purpose (profit lock / risk reduction) AND remaining position management plan. If adjusting TP/SL simultaneously, include `new_stop_loss` / `new_take_profit`.
|
||||
- **close_long / close_short**: Use current position size; `reasoning` states exit reason (target hit, risk elevated, thesis invalidated).
|
||||
- **hold / wait**: `reasoning` must explain why continuing to hold or waiting (e.g., trend intact, cooling period, insufficient signal).
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user