전략수정 및 버그수정

This commit is contained in:
2026-02-22 23:29:22 +09:00
parent d49c6209cb
commit 7867ced1b6
3 changed files with 25 additions and 14 deletions

View File

@@ -210,7 +210,7 @@ def check_buy_signal(
if regime == MarketRegime.BULL:
rsi_ok = rsi <= 30 # ← 25 → 30으로 완화: 진입 기회 ~2배 증가
vol_ok = current_volume >= avg_volume_20d * 2 # 거래량 20일평균 200% 이상
if rsi_ok or vol_ok:
if rsi_ok or (vol_ok and rsi <= 50): # vol_ok 단독 시 RSI 50 상한 (과열 진입 차단)
bb_low_minus = bb_lower * 0.97 # -3%
bb_low_plus = bb_lower * 1.015 # +1.5%
if bb_low_minus <= close <= bb_low_plus:
@@ -299,16 +299,17 @@ def check_exit_signal(
# ── 3. 2차 익절: 1차 완료 후 ─────────────────────────────────────
if remaining_pct <= threshold:
# 3a. 트레일링 스탑: 취고가 대비 -3% 하락 시 잔여 전량 청산
# 수익 구존 보장 위해 진입가 위 구간에서만 적용
# 3a. 트레일링 스탑: 최고가 대비 -3% 하락 시 잔여 전량 청산
# close > entry_price 조건 제거 → dead zone 차단
# (entry 아래로 떨어져도 trailing_high가 entry보다 높으면 즉시 청산)
if trailing_high is not None and trailing_high > entry_price:
trail_stop = trailing_high * 0.97
if close < trail_stop and close > entry_price:
if close < trail_stop:
return ExitSignal(
action="SELL_ALL",
reason=(
f"트레일링 청산: close={close:.0f} < 취고가×0.97={trail_stop:.0f} "
f"(취고가={trailing_high:.0f})"
f"트레일링 청산: close={close:.0f} < 최고가×0.97={trail_stop:.0f} "
f"(최고가={trailing_high:.0f})"
),
sell_pct=1.0,
)