添加高位空判断top,bottom
This commit is contained in:
@@ -68,11 +68,13 @@ class Chan_KLC_FX(Enum):
|
|||||||
TOP3 = auto()
|
TOP3 = auto()
|
||||||
TOP4 = auto()
|
TOP4 = auto()
|
||||||
TOP5 = auto()
|
TOP5 = auto()
|
||||||
|
TOP6 = auto()
|
||||||
BOTTOM1 = auto()
|
BOTTOM1 = auto()
|
||||||
BOTTOM2 = auto()
|
BOTTOM2 = auto()
|
||||||
BOTTOM3 = auto()
|
BOTTOM3 = auto()
|
||||||
BOTTOM4 = auto()
|
BOTTOM4 = auto()
|
||||||
BOTTOM5 = auto()
|
BOTTOM5 = auto()
|
||||||
|
BOTTOM6 = auto()
|
||||||
UNKNOWN = auto()
|
UNKNOWN = auto()
|
||||||
# 统一的MACD状态枚举,包含所有可能的状态
|
# 统一的MACD状态枚举,包含所有可能的状态
|
||||||
class Chan_MACD_STATE(Enum):
|
class Chan_MACD_STATE(Enum):
|
||||||
|
|||||||
+9
-1
@@ -45,6 +45,7 @@ class ChanKLC():
|
|||||||
self.bb_out = True
|
self.bb_out = True
|
||||||
self.macd = 0
|
self.macd = 0
|
||||||
self.signal = 0
|
self.signal = 0
|
||||||
|
self.state = Chan_MACD_STATE.UNKNOWN
|
||||||
def set_last_top_klu(self, last_top_klc):
|
def set_last_top_klu(self, last_top_klc):
|
||||||
self.last_top_klc = last_top_klc
|
self.last_top_klc = last_top_klc
|
||||||
def set_last_bottom_klc(self, last_bottom_klc):
|
def set_last_bottom_klc(self, last_bottom_klc):
|
||||||
@@ -67,6 +68,8 @@ class ChanKLC():
|
|||||||
self.pre.cal_bb_out()
|
self.pre.cal_bb_out()
|
||||||
def cal_bb_out(self):
|
def cal_bb_out(self):
|
||||||
for klu in self.klus:
|
for klu in self.klus:
|
||||||
|
if klu.macd_state != Chan_MACD_STATE.UNKNOWN:
|
||||||
|
self.state = klu.macd_state
|
||||||
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):
|
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
|
self.bb_out = True
|
||||||
#print(self.end_time, self.high, klu.bbup302, self.klc_fx_type)
|
#print(self.end_time, self.high, klu.bbup302, self.klc_fx_type)
|
||||||
@@ -81,12 +84,17 @@ class ChanKLC():
|
|||||||
if self.macdhist < 0 and self.macd > 0:
|
if self.macdhist < 0 and self.macd > 0:
|
||||||
self.klc_fx_type = Chan_KLC_FX.TOP5
|
self.klc_fx_type = Chan_KLC_FX.TOP5
|
||||||
self.bb_out = True
|
self.bb_out = True
|
||||||
|
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
|
||||||
else:
|
else:
|
||||||
if self.fx == Chan_FX_TYPE.BOTTOM:
|
if self.fx == Chan_FX_TYPE.BOTTOM:
|
||||||
if self.macdhist > 0 and self.macd < 0:
|
if self.macdhist > 0 and self.macd < 0:
|
||||||
self.klc_fx_type = Chan_KLC_FX.BOTTOM5
|
self.klc_fx_type = Chan_KLC_FX.BOTTOM5
|
||||||
self.bb_out = True
|
self.bb_out = True
|
||||||
|
if self.state == Chan_MACD_STATE.HIGH_EMPTY and self.macd < 0:
|
||||||
|
self.klc_fx_type = Chan_KLC_FX.BOTTOM6
|
||||||
|
#print(self.end_time, self.state, self.macd, self.klc_fx_type)
|
||||||
def cal_macd_state(self, dir):
|
def cal_macd_state(self, dir):
|
||||||
macd_state = 0
|
macd_state = 0
|
||||||
return macd_state
|
return macd_state
|
||||||
|
|||||||
Reference in New Issue
Block a user