去掉trim data,修改check_fx回去
This commit is contained in:
@@ -175,7 +175,7 @@ class TF_DF():
|
||||
else:
|
||||
klu_state_list.append("0")
|
||||
return klu_state_list
|
||||
def check_fx(self, klc):
|
||||
def check_fx1(self, klc):
|
||||
if klc.pre and klc.next:
|
||||
if klc.high > klc.pre.high and klc.high > klc.next.high and klc.low > klc.pre.low and klc.low > klc.next.low:
|
||||
if klc.pre.pre and klc.next.next:
|
||||
@@ -192,7 +192,7 @@ class TF_DF():
|
||||
#print(klc.start_time, klc.end_time,klc.next.start_time, klc.next.end_time, klc.macd, klc.state, klc.fx, "BOTTOM")
|
||||
return Chan_FX_TYPE.BOTTOM
|
||||
return Chan_FX_TYPE.UNKNOWN
|
||||
def check_fx1(self, klc):
|
||||
def check_fx(self, klc):
|
||||
if klc.pre and klc.next:
|
||||
if klc.high > klc.pre.high and klc.high > klc.next.high and klc.low > klc.pre.low and klc.low > klc.next.low:
|
||||
#if (klc.close > klc.ema52 or klc.next.close > klc.next.ema52) and klc.macd > 0:
|
||||
@@ -954,6 +954,7 @@ class TF_DF():
|
||||
if fx == Chan_FX_TYPE.UNKNOWN:
|
||||
if len(bi_list) > 0:
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
#continue
|
||||
if len(bi_list) > 0 and klc.end_klu:
|
||||
last_bi = bi_list[-1]
|
||||
@@ -1074,7 +1075,7 @@ class TF_DF():
|
||||
#print(klc.end_time, klc.fx, bi_list[-1].dir, "Last Top Change 2")
|
||||
klc.set_klc_fx_type(Chan_KLC_FX.TOP2)
|
||||
self.check_fx_pattern(klc)
|
||||
bi_list[-1].add_klc(klc)
|
||||
#bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
#print(klc.start_time, last_bottom.start_time, "Normal TOP Found, Confirm down bi 4")
|
||||
# last bottom = None 初始化的时候用,其他时间不用
|
||||
@@ -1189,7 +1190,7 @@ class TF_DF():
|
||||
#print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Bottom Change 2")
|
||||
klc.set_klc_fx_type(Chan_KLC_FX.BOTTOM2)
|
||||
self.check_fx_pattern(klc)
|
||||
bi_list[-1].add_klc(klc)
|
||||
#bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
#print(klc.start_time, last_top.start_time, "Normal Bottom Found, Confirm up bi 6")
|
||||
# last_top = None 初始化的时候用,其他时间不用
|
||||
@@ -1237,6 +1238,7 @@ class TF_DF():
|
||||
#print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Bottom Change 5")
|
||||
#print(klc.start_time, klc.fx, "笔买点Buy 4")
|
||||
self.get_above_zero_bsp(klc_list)
|
||||
#print(bi_list[-1].start_time, bi_list[-1].end_time, len(bi_list[-1].klc_list))
|
||||
return bi_list
|
||||
def get_above_zero_bsp(self, klc_list):
|
||||
buy_bsp_list = []
|
||||
@@ -1260,12 +1262,12 @@ class TF_DF():
|
||||
#print(klc.end_time, "Sell BSP Found")
|
||||
return buy_bsp_list
|
||||
def check_top_fx(self, last_bottom, klc):
|
||||
if (last_bottom.high > klc.pre.low or last_bottom.high > klc.next.low) and (klc.index - last_bottom.index < 10):
|
||||
if (last_bottom.high > klc.pre.low or last_bottom.high > klc.next.low) and (klc.index - last_bottom.index < 100):
|
||||
return False
|
||||
return True
|
||||
|
||||
def check_bottom_fx(self, last_top, klc):
|
||||
if (last_top.low < klc.pre.high or last_top.low < klc.next.high) and (klc.index - last_top.index < 10):
|
||||
if (last_top.low < klc.pre.high or last_top.low < klc.next.high) and (klc.index - last_top.index < 100):
|
||||
return False
|
||||
return True
|
||||
# 建议用这种方式生成笔中枢
|
||||
@@ -1364,7 +1366,7 @@ class TF_DF():
|
||||
zs.set_dd(min(bi_lows))
|
||||
zs.bi_list = bis_for_zs
|
||||
bi = bis_for_zs[-1]
|
||||
if bi.end_klc:
|
||||
if bi.is_sure:
|
||||
zs.set_end_bi(bi, bi.sure_time)
|
||||
|
||||
start_idx = start_idx + len(added_after_leave)
|
||||
@@ -1404,7 +1406,7 @@ class TF_DF():
|
||||
break
|
||||
|
||||
if has_leave:
|
||||
if last_bi_of_zs.end_klc:
|
||||
if last_bi_of_zs.is_sure:
|
||||
last_zs.set_end_bi(last_bi_of_zs, last_bi_of_zs.sure_time)
|
||||
return bi_zs_list
|
||||
def find_all_bsp(self, bi_list, bi_zs_list):
|
||||
@@ -1434,12 +1436,12 @@ class TF_DF():
|
||||
# 中枢结束后的第一笔(离开笔)
|
||||
last_zs_bi = zs.bi_list[-1]
|
||||
if last_zs_bi.dir == Chan_BI_DIR.UP:
|
||||
if last_zs_bi.end_klc.high <= zs.zg or (last_zs_bi.next and last_zs_bi.next.is_sure and last_zs_bi.next.end_klc.low < zs.zd):
|
||||
if last_zs_bi.is_sure and last_zs_bi.end_klc.high <= zs.zg or (last_zs_bi.next and last_zs_bi.next.is_sure and last_zs_bi.next.end_klc.low < zs.zd):
|
||||
leave_bi = last_zs_bi.next
|
||||
else:
|
||||
leave_bi = last_zs_bi
|
||||
else:
|
||||
if last_zs_bi.end_klc.low >= zs.zd or (last_zs_bi.next and last_zs_bi.next.is_sure and last_zs_bi.next.end_klc.high > zs.zg):
|
||||
if last_zs_bi.is_sure and last_zs_bi.end_klc.low >= zs.zd or (last_zs_bi.next and last_zs_bi.next.is_sure and last_zs_bi.next.end_klc.high > zs.zg):
|
||||
leave_bi = last_zs_bi.next
|
||||
else:
|
||||
leave_bi = last_zs_bi
|
||||
@@ -1578,13 +1580,13 @@ class TF_DF():
|
||||
# 确定离开笔:中枢最后一笔之后的第一笔
|
||||
if last_zs_bi.dir == Chan_BI_DIR.UP:
|
||||
# 中枢最后一笔向上,如果没有真正离开中枢,取下一笔
|
||||
if last_zs_bi.end_klc.high <= zs.zg:
|
||||
if last_zs_bi.is_sure and last_zs_bi.end_klc.high <= zs.zg:
|
||||
leave_bi = last_zs_bi.next
|
||||
else:
|
||||
leave_bi = last_zs_bi
|
||||
else:
|
||||
# 中枢最后一笔向下,如果没有真正离开中枢,取下一笔
|
||||
if last_zs_bi.end_klc.low >= zs.zd:
|
||||
if last_zs_bi.is_sure and last_zs_bi.end_klc.low >= zs.zd:
|
||||
leave_bi = last_zs_bi.next
|
||||
else:
|
||||
leave_bi = last_zs_bi
|
||||
|
||||
Reference in New Issue
Block a user