1、vp策略-v2

This commit is contained in:
2025-10-06 22:13:38 +08:00
parent 4712565749
commit 9358dba814
10 changed files with 2229 additions and 9205 deletions

View File

@@ -120,7 +120,7 @@ class ResultAnalyzer:
) # 明确标题
print("图表绘制完成。")
def analyze_indicators(self):
def analyze_indicators(self, profit_offset: float = 0.0) -> None:
"""
分析所有平仓交易的指标值与实现盈亏的关系,并绘制累积盈亏曲线图。
图表将展示指标值区间与对应累积盈亏的关系,帮助找出具有概率优势的指标区间。
@@ -156,7 +156,7 @@ class ResultAnalyzer:
and np.isnan(trade.indicator_dict[indicator_name])
):
indi_values.append(trade.indicator_dict[indicator_name])
pnls.append(trade.realized_pnl)
pnls.append(trade.realized_pnl - profit_offset)
if not indi_values:
print(f"指标 '{indicator_name}' 没有对应的有效平仓交易数据。跳过绘图。")