更新包含关系

This commit is contained in:
jackyu66git
2025-11-18 02:52:54 +08:00
parent d61cbbec21
commit 6383f19004
3 changed files with 17 additions and 10 deletions
+10 -6
View File
@@ -35,10 +35,10 @@ class ChanKLU:
self.upper_shadow = self.high - max(self.close, self.open)
self.lower_shadow = min(self.close, self.open) - self.low
self.body_ratio = self.body / self.range
self.upper_shadow_ratio = self.upper_shadow / self.range
self.lower_shadow_ratio = self.lower_shadow / self.range
self.upper_shadow_ratio = self.upper_shadow / self.body
self.lower_shadow_ratio = self.lower_shadow / self.body
self.exception = False
self.cal_exception()
#self.cal_exception()
self.candle_dir = Chan_K_DIR.CROSS if self.close == self.open else Chan_K_DIR.BULL if self.close > self.open else Chan_K_DIR.BEAR
self.continue_div = 0
@@ -53,6 +53,7 @@ class ChanKLU:
self.macd_state = Chan_MACD_STATE.UNKNOWN
self.macd_hist_gap = 0
self.trend = Chan_PRICE_TREND.UNKNOWN
self.seg_histset_index = 0
# === 归零轴细化与模式/背离 ===
self.zero_axis = False # 是否归零轴(穿越或接近)
self.zero_axis_state = "none" # {none,crossing,near}
@@ -70,19 +71,22 @@ class ChanKLU:
self.macd_state = state
def set_pattern(self, pattern):
self.pattern = pattern
def set_seg_histset_index(self, seg_histset_index):
self.seg_histset_index = seg_histset_index
#print(self.time, self.seg_histset_index)
def to_string(self):
return f"{self.time} {self.candle_dir} {self.pattern}"
def cal_exception(self):
if self.upper_shadow_ratio > 5 or self.lower_shadow_ratio > 5:
self.exception = True
#print(self.time, self.upper_shadow_ratio, self.lower_shadow_ratio, self.body, self.lower_shadow, self.upper_shadow, self.high, self.low, self.close, self.open)
self.exception = False
#self.exception = False
def set_trend(self, trend):
self.trend = trend
def set_separate_div(self, separate_div):
self.separate_div = separate_div
if self.klc:
if self.klc.klc_fx_type != Chan_KLC_FX.UNKNOWN:
if self.klc and self.klc.pre and self.klc.next:
if self.klc.klc_fx_type != Chan_KLC_FX.UNKNOWN or self.klc.pre.klc_fx_type != Chan_KLC_FX.UNKNOWN or self.klc.next.klc_fx_type != Chan_KLC_FX.UNKNOWN:
self.separate_div = 99
else:
self.separate_div = 0