fix: 选参逻辑——先胜率≥50%再取收益最高(原取收益最高可能选中低胜率参数)
This commit is contained in:
@@ -151,12 +151,14 @@ def mine(market="a", regimes=None):
|
||||
verified = None
|
||||
if c is not None:
|
||||
# 多参数模拟验证,取最优
|
||||
best = None
|
||||
# 先筛胜率≥50%的参数,再取其中收益最高(2026-08-16 修正:原取收益最高可能选中胜率<50%参数)
|
||||
passed_params = []
|
||||
for tp, sl, mh in [(20, 10, 40), (25, 10, 45), (30, 12, 50), (15, 8, 35)]:
|
||||
r = _simulate_verify(market, rg, panel, c, tp, sl, mh)
|
||||
if r and (best is None or r[2] > best[2]):
|
||||
best = (tp, sl, mh, *r)
|
||||
if best:
|
||||
if r and r[1] >= 50 and r[2] > 0:
|
||||
passed_params.append((tp, sl, mh, *r))
|
||||
if passed_params:
|
||||
best = max(passed_params, key=lambda x: x[5]) # (tp,sl,mh,tn,twr,tavg) -> tavg=index5
|
||||
tp, sl, mh, tn, twr, tavg = best
|
||||
if twr >= 50 and tavg > 0:
|
||||
cand = {
|
||||
|
||||
Reference in New Issue
Block a user