ZhouYongyou
041d6d4048
fix(prompts): add explicit stop-loss direction logic for long/short positions
...
Address DaDaManMan's error where AI set stop-loss incorrectly for short position.
## Problem
AI attempted to set stop-loss at $107,500 for SHORT position at $108,230,
causing validation error: "空单止损必须高于当前价格"
Root cause: Prompts lacked explicit guidance on stop-loss direction logic.
## Solution
### adaptive.txt (Chinese):
- Add "止损方向逻辑" section with clear rules
- Long position: stop_loss < entry_price (protect downside)
- Short position: stop_loss > entry_price (protect upside)
- Include examples and common mistakes to avoid
### nof1.txt (English):
- Add "Stop-Loss Direction Logic" section
- Same directional rules with detailed explanations
- Include real error example from production logs
- Emphasize validation failures when rules are violated
## Impact
- ✅ Prevents AI from setting illogical stop-loss prices
- ✅ Reduces validation errors and failed trades
- ✅ Provides clear examples with entry/stop-loss pairs
- ✅ Addresses DaDaManMan's reported issue directly
## Files Changed
- prompts/adaptive.txt (+19 lines)
- prompts/nof1.txt (+25 lines)
Fixes : #272 (DaDaManMan's comment)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-03 20:21:47 +08:00
ZhouYongyou
221b03b383
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 >
2025-11-03 19:23:04 +08:00
ZhouYongyou
b3b68b2b62
refactor(prompts): unify action schema & optimize trading discipline
...
## Core Changes
### 1. adaptive.txt - Adopt v5.5.6.1 strict strategy
- Migrate from dual-strategy system to unified adaptive approach
- Maintain strict confidence threshold ≥85 (anti-overtrading)
- Remove complex market state detection, focus on signal quality
- Explicitly disable partial_close (full exit only)
- -160 lines (removed redundant strategy logic)
### 2. nof1.txt - Fix contradictions & align standards
- ✅ Fix: Remove "NO partial exits" contradiction (now explicitly supported)
- ✅ Unify: Change confidence threshold from 60 → 75
- ✅ Unify: Change risk-reward ratio from 2:1 → 3:1
- Add confidence level guidance (75-85: good, 85-100: high)
- +85 lines (enhanced risk management framework)
### 3. default.txt - Add standardized output format
- Add structured thinking summary format
- Add comprehensive JSON schema documentation
- Add required fields rules for all action types
- +36 lines (improved contract clarity)
## Action Schema Migration
All prompts now use unified action naming:
- ✅ open_long / open_short (was: buy_to_enter / sell_to_enter)
- ✅ close_long / close_short (was: close)
- ✅ update_stop_loss / update_take_profit (new)
- ✅ partial_close (new, nof1 only)
- ✅ hold / wait (unchanged)
## Confidence Scale Migration
- ✅ Changed from 0-1 float to 0-100 integer across all prompts
- ✅ Opening threshold: adaptive=85, nof1=75, default=75
- ✅ Prevents overtrading through strict quality control
## Risk-Reward Standardization
- ✅ Minimum RR ratio: 1:3 across all prompts
- ✅ Replaces previous 1:2 requirement in nof1.txt
## Breaking Changes
- Backend must support new action names
- Confidence field now expects integer 0-100 (not float 0-1)
- partial_close action available in nof1.txt only
## Prompt Positioning
- **adaptive.txt**: Strict strategy (conf≥85, RR≥1:3, no partial exits)
- **nof1.txt**: English framework (conf≥75, RR≥1:3, supports partial_close)
- **default.txt**: Balanced CN strategy (conf≥75, RR≥1:3)
Related: feature/partial-close-dynamic-tpsl
2025-11-03 14:52:31 +08:00