1
This commit is contained in:
parent
7e62247217
commit
b4b001833f
|
|
@ -199,9 +199,9 @@ def _get_trading_config():
|
|||
'MIN_POSITION_PERCENT': 0.01, # 最小仓位1%
|
||||
'MIN_MARGIN_USDT': 5.0, # 最小保证金5美元
|
||||
'MIN_CHANGE_PERCENT': 0.5, # 最小价格变动0.5%
|
||||
'TOP_N_SYMBOLS': 8, # 选择信号最强的8个优先处理
|
||||
'SCAN_EXTRA_SYMBOLS_FOR_SUPPLEMENT': 8, # 智能补单:多返回8个候选,冷却时仍可尝试后续交易对
|
||||
'MAX_SCAN_SYMBOLS': 250, # 扫描前250个(增加覆盖率,从27.6%提升到46.0%)
|
||||
'TOP_N_SYMBOLS': 20, # 选择信号最强的20个优先处理(2026-02-06优化:扩大候选池以捕获更多机会)
|
||||
'SCAN_EXTRA_SYMBOLS_FOR_SUPPLEMENT': 15, # 智能补单:多返回15个候选,冷却时仍可尝试后续交易对
|
||||
'MAX_SCAN_SYMBOLS': 500, # 扫描前500个(覆盖所有交易对,确保不遗漏高波动币种)
|
||||
'EXCLUDE_MAJOR_COINS': True, # 排除主流币(BTC、ETH、BNB等),专注于山寨币
|
||||
'STOP_LOSS_PERCENT': 0.12, # 止损12%(保证金百分比)
|
||||
'TAKE_PROFIT_PERCENT': 0.10, # 第二目标/单目标止盈10%
|
||||
|
|
|
|||
|
|
@ -407,14 +407,10 @@ class TradingStrategy:
|
|||
# MACD金叉,做多信号(严格4H趋势向上)
|
||||
# OPTIMIZATION: 允许明确向上趋势或中性趋势(如果是中性,后续需依靠高分信号确认)
|
||||
if trend_4h in ('up', 'neutral'):
|
||||
# OPTIMIZATION: 添加 RSI 过滤,避免追高
|
||||
if rsi is None or rsi < 70:
|
||||
signal_strength += TREND_SIGNAL_WEIGHTS['macd_cross']
|
||||
reasons.append("MACD金叉")
|
||||
if direction is None:
|
||||
direction = 'BUY'
|
||||
else:
|
||||
reasons.append(f"MACD金叉但RSI超买({rsi:.1f}),禁止追多")
|
||||
signal_strength += TREND_SIGNAL_WEIGHTS['macd_cross']
|
||||
reasons.append("MACD金叉")
|
||||
if direction is None:
|
||||
direction = 'BUY'
|
||||
else:
|
||||
reasons.append(f"MACD金叉但4H趋势相反({trend_4h}),禁止逆势")
|
||||
|
||||
|
|
@ -422,14 +418,10 @@ class TradingStrategy:
|
|||
# MACD死叉,做空信号(严格4H趋势向下)
|
||||
# OPTIMIZATION: 允许明确向下趋势或中性趋势
|
||||
if trend_4h in ('down', 'neutral'):
|
||||
# OPTIMIZATION: 添加 RSI 过滤,避免杀跌
|
||||
if rsi is None or rsi > 30:
|
||||
signal_strength += TREND_SIGNAL_WEIGHTS['macd_cross']
|
||||
reasons.append("MACD死叉")
|
||||
if direction is None:
|
||||
direction = 'SELL'
|
||||
else:
|
||||
reasons.append(f"MACD死叉但RSI超卖({rsi:.1f}),禁止追空")
|
||||
signal_strength += TREND_SIGNAL_WEIGHTS['macd_cross']
|
||||
reasons.append("MACD死叉")
|
||||
if direction is None:
|
||||
direction = 'SELL'
|
||||
else:
|
||||
reasons.append(f"MACD死叉但4H趋势相反({trend_4h}),禁止逆势")
|
||||
|
||||
|
|
@ -438,35 +430,31 @@ class TradingStrategy:
|
|||
if current_price > ema20 > ema50: # 上升趋势
|
||||
# OPTIMIZATION: 允许明确向上趋势或中性趋势
|
||||
if trend_4h in ('up', 'neutral'):
|
||||
# OPTIMIZATION: 添加 RSI 过滤
|
||||
if rsi is None or rsi < 70:
|
||||
# 冲突检查:如果已有方向且与当前不符,则是严重冲突
|
||||
if direction == 'SELL':
|
||||
reasons.append("❌ 信号冲突:MACD看空但EMA看多")
|
||||
signal_strength = 0
|
||||
direction = None
|
||||
else:
|
||||
signal_strength += TREND_SIGNAL_WEIGHTS['ema_cross']
|
||||
reasons.append("EMA20上穿EMA50,上升趋势")
|
||||
if direction is None:
|
||||
direction = 'BUY'
|
||||
# 冲突检查:如果已有方向且与当前不符,则是严重冲突
|
||||
if direction == 'SELL':
|
||||
reasons.append("❌ 信号冲突:MACD看空但EMA看多")
|
||||
signal_strength = 0
|
||||
direction = None
|
||||
else:
|
||||
signal_strength += TREND_SIGNAL_WEIGHTS['ema_cross']
|
||||
reasons.append("EMA20上穿EMA50,上升趋势")
|
||||
if direction is None:
|
||||
direction = 'BUY'
|
||||
else:
|
||||
reasons.append(f"1H均线向上但4H趋势相反({trend_4h}),禁止逆势")
|
||||
elif current_price < ema20 < ema50: # 下降趋势
|
||||
# OPTIMIZATION: 允许明确向下趋势或中性趋势
|
||||
if trend_4h in ('down', 'neutral'):
|
||||
# OPTIMIZATION: 添加 RSI 过滤
|
||||
if rsi is None or rsi > 30:
|
||||
# 冲突检查:如果已有方向且与当前不符,则是严重冲突
|
||||
if direction == 'BUY':
|
||||
reasons.append("❌ 信号冲突:MACD看多但EMA看空")
|
||||
signal_strength = 0
|
||||
direction = None
|
||||
else:
|
||||
signal_strength += TREND_SIGNAL_WEIGHTS['ema_cross']
|
||||
reasons.append("EMA20下穿EMA50,下降趋势")
|
||||
if direction is None:
|
||||
direction = 'SELL'
|
||||
# 冲突检查:如果已有方向且与当前不符,则是严重冲突
|
||||
if direction == 'BUY':
|
||||
reasons.append("❌ 信号冲突:MACD看多但EMA看空")
|
||||
signal_strength = 0
|
||||
direction = None
|
||||
else:
|
||||
signal_strength += TREND_SIGNAL_WEIGHTS['ema_cross']
|
||||
reasons.append("EMA20下穿EMA50,下降趋势")
|
||||
if direction is None:
|
||||
direction = 'SELL'
|
||||
else:
|
||||
reasons.append(f"1H均线向下但4H趋势相反({trend_4h}),禁止逆势")
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,11 @@ try:
|
|||
('ATR_TAKE_PROFIT_MULTIPLIER', 2.0, 'float', 'risk', 'ATR止盈倍数'),
|
||||
# Also ensure USE_ATR_STOP_LOSS is True
|
||||
('USE_ATR_STOP_LOSS', True, 'bool', 'risk', '开启ATR止损'),
|
||||
]
|
||||
# 2026-02-06 Optimization: Increase candidate pool
|
||||
('TOP_N_SYMBOLS', 20, 'int', 'scanner', '候选池大小(优化后20)'),
|
||||
('SCAN_EXTRA_SYMBOLS_FOR_SUPPLEMENT', 15, 'int', 'scanner', '补单候选池(优化后15)'),
|
||||
('MAX_SCAN_SYMBOLS', 500, 'int', 'scanner', '最大扫描数量(优化后500)'),
|
||||
]
|
||||
|
||||
print("Updating Global Strategy Config...")
|
||||
for key, value, type_, category, desc in updates:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user