mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-07 11:17:56 +08:00
fix(prompts): correct risk_usd formula - remove duplicate leverage multiplication
## Problem (Issue #592) risk_usd formula incorrectly multiplies leverage twice: - Incorrect: risk_usd = |Entry - Stop| × Position Size × Leverage ❌ This causes AI to calculate risk as 10x (or leverage倍) higher than actual. ## Root Cause Position Size already includes leverage effect: - Position Size (coins) = position_size_usd / price - position_size_usd = margin × leverage - Therefore: Position Size = (margin × leverage) / price Multiplying leverage again amplifies risk calculation by "leverage" times. ## Example Scenario: $100 margin, 10x leverage, 0.02 BTC position, $500 stop distance **Correct calculation:** risk_usd = $500 × 0.02 = $10 ✅ Risk % = 10% of margin (reasonable) **Incorrect calculation (current):** risk_usd = $500 × 0.02 × 10 = $100 ❌ Risk % = 100% of margin (completely wrong!) ## Impact - AI miscalculates risk as "leverage" times higher - May refuse valid trades thinking risk is too high - Risk control logic becomes ineffective - Potential for position sizing errors ## Solution Correct formula: risk_usd = |Entry - Stop| × Position Size (coins) Added warnings: - CN: ⚠️ 不要再乘杠杆:仓位数量已包含杠杆效应 - EN: ⚠️ Do NOT multiply by leverage: Position Size already includes leverage effect ## Modified Files - prompts/adaptive.txt (line 404) - prompts/nof1.txt (line 104) Closes #592
This commit is contained in:
@@ -401,7 +401,8 @@
|
||||
- >95: 风险预算 2.5%(谨慎使用,警惕过度自信)
|
||||
|
||||
5. **risk_usd** (风险金额)
|
||||
- 计算公式: |入场价 - 止损价| × 仓位数量 × 杠杆
|
||||
- 计算公式: |入场价 - 止损价| × 仓位数量
|
||||
- ⚠️ **不要再乘杠杆**:仓位数量 = position_size_usd / 价格,已包含杠杆效应
|
||||
- 必须 ≤ 账户净值 × 风险预算(1.5-2.5%)
|
||||
|
||||
6. **slippage_buffer** (滑点缓冲 - V5.5.1 新增)
|
||||
|
||||
+2
-1
@@ -101,7 +101,8 @@ For EVERY trade decision, you MUST specify:
|
||||
- 80-100: Very high confidence (use cautiously, beware overconfidence)
|
||||
|
||||
5. **risk_usd** (float): Dollar amount at risk (distance from entry to stop loss)
|
||||
- Calculate as: |Entry Price - Stop Loss| × Position Size × Leverage
|
||||
- Calculate as: |Entry Price - Stop Loss| × Position Size (in coins)
|
||||
- ⚠️ **Do NOT multiply by leverage**: Position Size already includes leverage effect
|
||||
|
||||
|
||||
# PERFORMANCE METRICS & FEEDBACK
|
||||
|
||||
Reference in New Issue
Block a user