add macd判断背离,使用分型和隐形形态实现第二类买卖点

This commit is contained in:
jackyu66git
2025-08-18 01:14:36 +08:00
parent 45595fe0f8
commit b15ba06a00
12 changed files with 2422 additions and 816 deletions
+10 -5
View File
@@ -30,7 +30,7 @@ class ChanKLC():
self.klc_fx_type = Chan_KLC_FX.UNKNOWN
self.rsi = klu.rsi
self.volume_ratio = klu.volume_ratio
self.macdhist = 0
self.macdhist = klu.macdhist
self.body = klu.body
self.upper_shadow = klu.upper_shadow
self.lower_shadow = klu.lower_shadow
@@ -65,25 +65,30 @@ class ChanKLC():
self.cal_bb_out()
if self.pre:
self.pre.cal_bb_out()
#self.bb_out = True
def cal_bb_out(self):
for klu in self.klus:
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
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
if self.fx ==Chan_FX_TYPE.TOP:
self.klc_fx_type = Chan_KLC_FX.BOTTOM4
if self.fx == Chan_FX_TYPE.TOP:
#print(self.end_time, self.fx, self.macd, self.macdhist, len(self.klus))
if self.macd > 0:
self.bb_out = True
if self.macdhist < 0:
self.klc_fx_type = Chan_KLC_FX.TOP5
else:
if self.fx == Chan_FX_TYPE.BOTTOM:
if self.macd < 0:
self.bb_out = True
if self.macdhist > 0:
self.klc_fx_type = Chan_KLC_FX.BOTTOM5
#self.bb_out = True
def cal_macd_state(self, dir):
macd_state = 0
return macd_state