添加新的bb2633,笔识别改回去了
This commit is contained in:
+36
-3
@@ -71,6 +71,9 @@ class ChanKLU:
|
||||
self.div_score = 0.0 # 背离强度(0-100)
|
||||
self.ema_dir = 0
|
||||
self.get_ema_dir()
|
||||
self.bb2633upper = 0
|
||||
self.bb2633lower = 0
|
||||
self.bb2633middle = 0
|
||||
#print(self.open, self.close, self.high, self.low, self.candle_dir, self.strength)
|
||||
def set_macd_state(self, state):
|
||||
self.macd_state = state
|
||||
@@ -90,9 +93,37 @@ class ChanKLU:
|
||||
self.trend = trend
|
||||
def set_separate_div(self, separate_div):
|
||||
self.separate_div = separate_div
|
||||
bb2633_status = self.check_bb2633()
|
||||
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
|
||||
fx = self.check_fx_dir(self.klc.pre, self.klc.next)
|
||||
if fx == Chan_FX_TYPE.TOP:
|
||||
if self.macdhist > 0:
|
||||
self.separate_div = separate_div
|
||||
else:
|
||||
self.separate_div = 0
|
||||
elif fx == Chan_FX_TYPE.BOTTOM:
|
||||
if self.macdhist < 0:
|
||||
self.separate_div = separate_div
|
||||
else:
|
||||
self.separate_div = 0
|
||||
if bb2633_status == 0:
|
||||
self.separate_div = 0
|
||||
def check_bb2633(self, threadhold=300):
|
||||
#print(self.time, self.high, self.bb2633upper, self.low, self.bb2633lower)
|
||||
if abs(self.high - self.bb2633upper) < threadhold:
|
||||
print(self.time, self.high, self.bb2633upper)
|
||||
return 1
|
||||
if abs(self.low - self.bb2633lower) < threadhold:
|
||||
print(self.time, self.low, self.bb2633lower)
|
||||
return -1
|
||||
return 0
|
||||
def check_fx_dir(self, pre, next):
|
||||
fx = Chan_FX_TYPE.UNKNOWN
|
||||
if pre.klc_fx_type == Chan_KLC_FX.TOP1 or pre.klc_fx_type == Chan_KLC_FX.TOP2 or next.klc_fx_type == Chan_KLC_FX.TOP1 or next.klc_fx_type == Chan_KLC_FX.TOP2 or self.klc.klc_fx_type == Chan_KLC_FX.TOP1 or self.klc.klc_fx_type == Chan_KLC_FX.TOP2:
|
||||
fx = Chan_FX_TYPE.TOP
|
||||
elif pre.klc_fx_type == Chan_KLC_FX.BOTTOM1 or pre.klc_fx_type == Chan_KLC_FX.BOTTOM2 or next.klc_fx_type == Chan_KLC_FX.BOTTOM1 or next.klc_fx_type == Chan_KLC_FX.BOTTOM2 or self.klc.klc_fx_type == Chan_KLC_FX.BOTTOM1 or self.klc.klc_fx_type == Chan_KLC_FX.BOTTOM2:
|
||||
fx = Chan_FX_TYPE.BOTTOM
|
||||
return fx
|
||||
def set_next(self, next):
|
||||
self.next = next
|
||||
#if self.fx_type != Chan_FX_TYPE.UNKNOWN and self.fx_strength > 1:
|
||||
@@ -151,7 +182,9 @@ class ChanKLU:
|
||||
self.volume_ratio = float(item['volume_ratio']) if 'volume_ratio' in item and item['volume_ratio'] else 0
|
||||
self.bb52upper = float(item['bb52upper']) if 'bb52upper' in item and item['bb52upper'] else 0
|
||||
self.bb52lower = float(item['bb52lower']) if 'bb52lower' in item and item['bb52lower'] else 0
|
||||
|
||||
self.bb2633upper = float(item['bb2633upper']) if 'bb2633upper' in item and item['bb2633upper'] else 0
|
||||
self.bb2633lower = float(item['bb2633lower']) if 'bb2633lower' in item and item['bb2633lower'] else 0
|
||||
self.bb2633middle = float(item['bb2633middle']) if 'bb2633middle' in item and item['bb2633middle'] else 0
|
||||
def cal_macd_state(self):
|
||||
# 按定义精简实现:优先级 CROSS0 > 位置(HIGH/HE/RETURN_ZERO) > NEAR0 > UNKNOWN
|
||||
# 首条或缺前一根
|
||||
|
||||
Reference in New Issue
Block a user