Initial commit: Hermes Agent skills collection

- Trading skills (OKX, dividend, lottery, quantitative)
- Creative skills (ASCII art, diagrams, video)
- Development skills (GitHub, debugging, TDD)
- Research skills (arXiv, blog monitoring)
- Productivity skills (email, documents, notes)
- MCP integration skills
- Custom user skills
This commit is contained in:
Hermes Skills Manager
2026-07-05 02:31:15 -04:00
commit 6770bc9b9d
908 changed files with 239614 additions and 0 deletions
@@ -0,0 +1,71 @@
# A+E+D 止盈止损策略
三合一套餐:多周期ATR融合(A) + 跟踪止损(E) + 自适应盈亏比(D)
## 第一层:入场止损 — 多周期ATR融合 (A)
```
SL距离 = (ATR_1H × 0.5 + ATR_4H × 0.3 + ATR_1D × 0.2) × 1.5
做多: SL = 入场价 - SL距离
做空: SL = 入场价 + SL距离
```
**为什么用多周期:** 1H(50%)应对短期波动,4H(30%)做主心骨,1D(20%)兜底。避免单根4H大K线拉偏ATR导致止损过宽。
## 第二层:跟踪止损 (E) — 持仓后动态调整
```
阶段1:初始SL = 第一层的SL距离
阶段2:浮盈 > ATR融合×1.0 → SL移到入场±ATR融合×0.3(保本)
阶段3:浮盈 > ATR融合×2.0 → SL跟踪,跟踪距离=ATR融合×1.2
```
实现方式:trading cron 定时轮询(15min间隔),reduceOnly模式。
## 第三层:自适应盈亏比 (D)
趋势强度判断(EMA12-EMA26斜率):
| 斜率 | 趋势 | R:R | 策略 |
|------|------|:---:|------|
| > +0.5 | strong_up | 3.0 | 强趋势多拿一会 |
| < -0.5 | strong_down | 3.0 | 强趋势多拿一会 |
| \|slope\| < 0.1 | ranging | 1.5 | 震荡见好就收 |
| 其他 | weak_trend | 2.0 | 正常 |
## 完整流程
```python
def calc_tp_sl(entry, side, exchange, symbol):
# A: 多周期ATR
fused, _, _, _ = calc_multi_atr(exchange, symbol)
sl_distance = fused if fused else entry * 0.03
# D: 自适应R:R
trend, slope = estimate_trend_strength(exchange, symbol)
rr = {'strong_up':3.0,'strong_down':3.0,'ranging':1.5}.get(trend, 2.0)
if side == 'sell':
sl = entry + sl_distance
tp = entry - sl_distance * rr
else:
sl = entry - sl_distance
tp = entry + sl_distance * rr
return tp, sl, rr, trend
# E: 跟踪止损(持仓后循环执行)
def update_trail(entry, current, side, fused):
upl = abs(current - entry) # 每张
if upl > fused * 2.0: # 阶段3
trail = fused * 1.2
return current - trail if side == 'buy' else current + trail
if upl > fused * 1.0: # 阶段2
return entry + fused * 0.3 if side == 'sell' else entry - fused * 0.3
return None # 保持初始SL
```
## 参数调整
- **高波动币种** (ATR% > 5%):×1.5 → ×2.0
- **低波动币种** (ATR% < 1%):×1.5 → ×1.0
- **数据不足**:退回到单4H ATR×1.5