fix: knife-catch gate (RSI<8 + downtrend = SKIP), BTC macro gate both directions. YES bets were 15% WR losing -4. Root cause: buying dips in downtrend.

This commit is contained in:
drjones
2026-08-03 02:30:28 -07:00
parent 0427f015bc
commit b1c871c198
8 changed files with 119 additions and 4 deletions

14
bot.py
View File

@@ -385,14 +385,20 @@ def decide(cfg, conn, price):
if mode == "DOWN_SPAM": return mom, lv, lc, lw, "DOWN", "spam-mode short"
if mode == "UP_SPAM": return mom, lv, lc, lw, "UP", "spam-mode long"
# ── RSI contrarian: only on TRUE extremes + reversal confirmation ──
# ── RSI contrarian: only on TRUE extremes + trend alignment ──
r = rsi(conn)
ix_pre = intel(cfg.get("coin","BTC"))
chg24 = ix_pre.get("chg24", 0)
if r is not None:
# Require BOTH extreme RSI AND momentum already reversing
# Fade DOWN only when: extreme OB + momentum reversing + not deep downtrend
if r > 92 and mom == "DOWN" and mom_score > 0.01:
return mom, lv, lc, lw, "DOWN", f"⚠ RSI {r:.0f} extreme OB + momentum reversing → fade DOWN"
if r < 8 and mom == "UP" and mom_score > 0.01:
# Fade UP only when: extreme OS + momentum reversing + NOT in deep downtrend (don't catch falling knives)
if r < 8 and mom == "UP" and mom_score > 0.01 and chg24 > -0.5:
return mom, lv, lc, lw, "UP", f"⚠ RSI {r:.0f} extreme OS + momentum reversing → fade UP"
# RSI extreme in downtrend → SKIP, don't catch the knife
if r < 8 and chg24 <= -0.5:
return mom, lv, lc, lw, "SKIP", f"⚠ RSI {r:.0f} extreme OS but 24h {chg24:.1f}% downtrend — no knife catch"
# ── swing threshold gate ──
thr = cfg.get("swing_threshold_pct", 0.005)
@@ -401,7 +407,7 @@ def decide(cfg, conn, price):
if lv not in ("UP", "DOWN"):
return mom, lv, lc, lw, "SKIP", f"passes: {lw}"
# ── BTC macro correlation: don't fight the trend ──
# ── BTC macro correlation: don't fight the trend (both directions) ──
coin = cfg.get("coin","BTC")
ix = intel(coin)
btc_chg = ix.get("chg24", 0)