解决除以0的问题

This commit is contained in:
jackyu66git
2026-02-02 12:44:30 +08:00
parent cefd048ab5
commit da3d7cde25
2 changed files with 6 additions and 3 deletions
+3
View File
@@ -1405,6 +1405,9 @@ class TF_DF():
upper_ratio = upper_shadow / total_range
lower_ratio = lower_shadow / total_range
#print(klu.time, upper_ratio, lower_ratio, body_ratio, upper_ratio/body_ratio, lower_ratio/body_ratio)
# 避免body_ratio为0时的除零错误
if body_ratio == 0:
return
# 锤子线/上吊线 - 反转信号
if lower_ratio / body_ratio >= 2:
# 锤子线:底部反转,需要前面一段