change something

This commit is contained in:
jackyu66git
2025-09-18 02:37:28 +08:00
parent ee1689664d
commit 4766e38125
4 changed files with 54 additions and 17 deletions
+19 -5
View File
@@ -42,10 +42,12 @@ class ChanKLC():
self.strength = klu.strength
self.last_top_klc = None
self.last_bottom_klc = None
self.bb_out = True
self.bb_out = False
self.macd = 0
self.signal = 0
self.state = Chan_MACD_STATE.UNKNOWN
self.continue_div = False
self.separate_div = 0
def set_last_top_klu(self, last_top_klc):
self.last_top_klc = last_top_klc
def set_last_bottom_klc(self, last_bottom_klc):
@@ -70,15 +72,19 @@ class ChanKLC():
for klu in self.klus:
if klu.macd_state != Chan_MACD_STATE.UNKNOWN:
self.state = klu.macd_state
if klu.separate_div > 0:
self.separate_div = True
if klu.continue_div:
self.continue_div = klu.continue_div
if self.high >= klu.bbup302 and klu.bbup302 > 0 and (self.klc_fx_type == Chan_KLC_FX.TOP1 or self.klc_fx_type == Chan_KLC_FX.TOP2):
self.bb_out = True
#print(self.end_time, self.high, klu.bbup302, self.klc_fx_type)
if self.high >= klu.bbup30 and klu.bbup30 > 0 and self.next and (self.next.macd - self.macd) < 0:
self.klc_fx_type = Chan_KLC_FX.TOP4
self.klc_fx_type = Chan_KLC_FX.TOP4
#self.bb_out = True
if self.low <= klu.bblow302 and klu.bblow302 > 0 and (self.klc_fx_type == Chan_KLC_FX.BOTTOM1 or self.klc_fx_type == Chan_KLC_FX.BOTTOM2):
self.bb_out = True
if self.low <= klu.bblow30 and klu.bblow30 > 0 and self.next and (self.macd - self.next.macd) < 0:
self.klc_fx_type = Chan_KLC_FX.BOTTOM4
self.klc_fx_type = Chan_KLC_FX.BOTTOM4
#self.bb_out = True
if self.klc_fx_type == Chan_KLC_FX.TOP1 or self.klc_fx_type == Chan_KLC_FX.TOP2:
#print(self.end_time, self.fx, self.macd, self.macdhist, len(self.klus))
if self.macdhist < 0 and self.macd > 0:
@@ -87,6 +93,10 @@ class ChanKLC():
if self.state == Chan_MACD_STATE.HIGH_EMPTY and self.macd > 0:
#print(self.end_time, self.state, self.macd, self.klc_fx_type)
self.klc_fx_type = Chan_KLC_FX.TOP6
self.bb_out = True
if self.continue_div:
self.klc_fx_type = Chan_KLC_FX.TOP7
self.bb_out = True
else:
if self.klc_fx_type == Chan_KLC_FX.BOTTOM1 or self.klc_fx_type == Chan_KLC_FX.BOTTOM2:
if self.macdhist > 0 and self.macd < 0:
@@ -94,7 +104,11 @@ class ChanKLC():
self.bb_out = True
if self.state == Chan_MACD_STATE.HIGH_EMPTY and self.macd < 0:
self.klc_fx_type = Chan_KLC_FX.BOTTOM6
self.bb_out = True
#print(self.end_time, self.state, self.macd, self.klc_fx_type)
if self.continue_div:
self.klc_fx_type = Chan_KLC_FX.BOTTOM7
self.bb_out = True
def cal_macd_state(self, dir):
macd_state = 0
return macd_state