This commit is contained in:
aaron 2026-03-23 23:55:35 +08:00
parent 8dee4c8f7b
commit 40045b39f7
2 changed files with 204 additions and 904 deletions

File diff suppressed because it is too large Load Diff

View File

@ -83,7 +83,7 @@ class TradingDecisionMaker:
- 不要幻想"最后一段利润"
### 🚨 盈亏比铁律(违反即拒绝)
**所有交易必须满足盈亏比 1:1.5回调入场 1:1.8**
**所有交易必须满足盈亏比 1:1.2回调入场 1:1.5**
```
盈亏比 = (目标盈利 - 入场价) / (入场价 - 止损价)
@ -99,15 +99,15 @@ class TradingDecisionMaker:
- BTC 做多入场 64800回调止损 64300-0.77%止盈 65800+1.54%
- 盈亏比 = (65800 - 64800) / (64800 - 64300) = 1000 / 500 = 2.0
如果盈亏比 < 1:1.5绝对不要开仓
如果盈亏比 < 1:1.2绝对不要开仓
```
### 日内交易参数
| 参数 | 设定值 |
|------|--------|
| 止损幅度 | 1-1.5%最大1.5% |
| 止损幅度 | 优先 1.5×ATR(30m)参考范围 0.8-2% |
| 目标盈利 | 2-3%日内快速获利达到即走 |
| 盈亏比要求 | 1:1.5回调入场1:1.8 |
| 盈亏比要求 | 1:1.2回调入场1:1.5 |
| 单笔持仓时长 | 不超过4小时达到目标立即平仓 |
| 仓位大小 | 轻仓为主light/micro禁止heavy |
@ -318,7 +318,7 @@ class TradingDecisionMaker:
### 4. 价格加速检测规则(防止追涨杀跌)
**以下情况强制 HOLD禁止任何操作**
- 信号入场价距离当前价格 >= 2%价格正在快速移动
- 15m RSI > 65 < 35极端区间
- 15m RSI > 70 < 30极端区间
- 价格偏离 EMA5 > 1.5%过度延伸
- 5m 连续2根以上大阳/阴线加速中
@ -885,7 +885,7 @@ class TradingDecisionMaker:
prompt_parts.append(f"\n## 🚨 价格加速检测(防止追涨杀跌)")
prompt_parts.append(f"**以下情况强制 HOLD禁止任何新开仓操作**")
prompt_parts.append(f"1. 信号入场价距离当前价格 >= 2% → 价格正在快速移动,不要追")
prompt_parts.append(f"2. 15m RSI > 65或 < 35(空)→ 极端区间,不要追")
prompt_parts.append(f"2. 15m RSI > 70或 < 30(空)→ 极端区间,不要追")
prompt_parts.append(f"3. 价格偏离 EMA5 > 1.5% → 过度延伸,不要追")
prompt_parts.append(f"4. 5m 连续2根以上大阳/阴线 → 加速中,不要追")
prompt_parts.append(f"")
@ -932,13 +932,13 @@ class TradingDecisionMaker:
# 盈亏比检查规则(新增)
prompt_parts.append(f"\n## 盈亏比检查(日内交易铁律)")
prompt_parts.append(f"⚠️ 所有交易必须满足盈亏比 >= 1:1.5回调入场>= 1:1.8")
prompt_parts.append(f"⚠️ 所有交易必须满足盈亏比 >= 1:1.2回调入场>= 1:1.5")
prompt_parts.append(f"")
prompt_parts.append(f"盈亏比计算公式:")
prompt_parts.append(f" 做多盈亏比 = (止盈价 - 入场价) / (入场价 - 止损价)")
prompt_parts.append(f" 做空盈亏比 = (入场价 - 止盈价) / (止损价 - 入场价)")
prompt_parts.append(f"")
prompt_parts.append(f"⚠️ 如果盈亏比 < 1:1.5**不要开仓(返回 HOLD**")
prompt_parts.append(f"⚠️ 如果盈亏比 < 1:1.2**不要开仓(返回 HOLD**")
# 计算并显示盈亏比
signals = context.get('signals', [])
@ -971,7 +971,7 @@ class TradingDecisionMaker:
if rr_ratio >= 1.5:
status = f"✅ 通过 (1:{rr_ratio:.1f})"
else:
status = f"❌ 拒绝 (1:{rr_ratio:.1f} < 1:1.5)"
status = f"❌ 拒绝 (1:{rr_ratio:.1f} < 1:1.2)"
prompt_parts.append(f"\n信号 {action} @ ${entry:,.2f}:")
prompt_parts.append(f" - 止损: ${stop_loss:,.2f} (风险 {risk_ratio:.0f} / {rr_percent:.1f}%)")
@ -1138,7 +1138,7 @@ class TradingDecisionMaker:
f"超过最大仓位金额 (保证金 ${margin:.2f} → 持仓价值 ${position_value:.2f}, 总计 ${new_total_value:,.2f} > ${max_position_value:,.2f})"
)
# 盈亏比检查:所有交易必须满足盈亏比 >= 1:1.5
# 盈亏比检查:所有交易必须满足盈亏比 >= 1:1.2
action = decision.get('action', '')
entry_price = decision.get('entry_price')
stop_loss = decision.get('stop_loss')
@ -1180,7 +1180,7 @@ class TradingDecisionMaker:
# 检查盈亏比
if risk > 0 and reward > 0:
rr_ratio = reward / risk
min_rr_ratio = 1.5 # 最小盈亏比 1:1.5
min_rr_ratio = 1.2 # 最小盈亏比 1:1.2
if rr_ratio < min_rr_ratio:
logger.warning(f"⚠️ 决策被拒绝: 盈亏比不足 (1:{rr_ratio:.2f} < 1:{min_rr_ratio:.1f})")