- Introduced a new "tilt" parameter to the strength scoring system, allowing for the assessment of triangle slope directionality. - Renamed existing parameters: "拟合贴合度" to "形态规则度" and "边界利用率" to "价格活跃度" for improved clarity. - Updated normalization methods for all strength components to ensure they remain within the [0, 1] range, facilitating LLM tuning. - Enhanced documentation to reflect changes in parameter names and scoring logic, including detailed explanations of the new tilt parameter. - Modified multiple source files and scripts to accommodate the new scoring structure and ensure backward compatibility. Files modified: - `src/converging_triangle.py`, `src/converging_triangle_optimized.py`, `src/triangle_detector_api.py`: Updated parameter names and scoring logic. - `scripts/plot_converging_triangles.py`, `scripts/generate_stock_viewer.py`: Adjusted for new scoring parameters in output. - New documentation files created to explain the renaming and new scoring system in detail.
2.4 KiB
2.4 KiB
收敛三角形函数本身
总体思路:用户可调整"强度分"中的每个参数,最终筛选出符合预期的个股。
-
"拟合贴合度"与"边界利用率",是否可以合并为一个维度? ✅ 已完成
- 结论:不建议合并,两者测量的是不同维度
- 优化:重命名为"形态规则度"和"价格活跃度",更直观
- 详情:见
docs/命名优化_拟合贴合度_边界利用率_重命名.md
-
"强度分"中需要新增"角度"参数:即斜率、三角形的旋转角度。 ✅ 已完成
- 实现方式:新增"倾斜度分"作为第6个维度
- 权重分配:从突破幅度分中分配5%(50% → 45%)
- 详情:见
docs/强度分_增加角度参数_深度分析.md
-
"强度分"内所有参数需保持在 0-1 区间,便于 LLM 调参;要求均匀/正态分布,默认值为 0.5。 目前所有 6 个强度分参数都已经在 0-1 区间内。以下是各分量的归一化方式总结:
| 分量 | 归一化方式 | 范围保证 |
|---|---|---|
突破幅度分 (price_score) |
np.tanh(pct * 15.0) |
tanh 输出 [0, 1](因为 pct ≥ 0) |
收敛度分 (convergence_score) |
max(0, min(1, 1 - width_ratio)) |
显式 clamp 到 [0, 1] |
成交量分 (volume_score) |
min(1, max(0, volume_ratio - 1)) |
显式 clamp 到 [0, 1] |
形态规则度 (geometry_score) |
exp(-error * 20) + clamp |
指数衰减 + 显式 clamp |
价格活跃度 (activity_score) |
逐日计算 1 - blank_ratio 的平均 + clamp |
每日 clamp + 最终 clamp |
倾斜度分 (tilt_score) |
(1 ± tilt) / 2 + clamp |
显式 clamp 到 [0, 1] |
形态规则度和价格活跃度的归一化详解
关于形态规则度 (geometry_score) 和价格活跃度 (activity_score) 这两个分量的详细归一化实现,请参阅:
详细文档:docs/强度分_形态规则度和价格活跃度_归一化详解.md
核心要点:
- 形态规则度:使用指数衰减映射
exp(-mean_rel_error * 20),测量枢轴点到拟合线的贴合程度 - 价格活跃度:使用线性反转
1 - blank_ratio+ 双重clamp,逐日计算通道空间利用率后取平均
两者都严格保证输出在 [0, 1] 区间,满足强度分系统的设计要求。