fix(strategy): 添加负动量空仓机制避免持仓惯性亏损
当所有候选标的动量得分低于min_score时,策略自动清仓而非继续持有之前的负动量组合。 修复问题: - 旧逻辑:target为空时继续持有current_held(负动量标的) - 新逻辑:target为空时清仓(current_held='') 回测效果: - 累计收益从11872%提升至14580%(+2708%) - 最大回撤从-71.9%改善至-61.1%(+10.9%) - 2000年互联网泡沫期间空仓77天(24.8%) - 2001年空仓31天,收益从-48.7%改善至-41.1%
This commit is contained in:
@@ -151,6 +151,11 @@ class TopNSelector(SignalGenerator):
|
||||
if should:
|
||||
current_held = target
|
||||
last_rebalance_idx = i
|
||||
else:
|
||||
# 目标信号为空(所有标的动量得分低于min_score),清仓
|
||||
# 不继续持有负动量标的,转为空仓
|
||||
current_held = ''
|
||||
last_rebalance_idx = i
|
||||
|
||||
signals.append(current_held)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user