Change some klc and bi recognition
This commit is contained in:
+38
-5
@@ -312,6 +312,7 @@ class ChanLun():
|
||||
self.last_peak['low'] = l
|
||||
#klu = KLU(self.create_item_dict(item_data, GetColumnNameFromFieldList(fields)))
|
||||
klu = ChanKLU(time_str, o, h, l, c, v)
|
||||
#print(klu.time, klu.open, klu.high, klu.low, klu.close, klu.volume)
|
||||
klu.set_idx(i)
|
||||
klu_list.append(klu)
|
||||
if last_klu:
|
||||
@@ -571,6 +572,13 @@ class ChanLun():
|
||||
else:
|
||||
last_down_bi = bi
|
||||
down_bi_list.append(bi)
|
||||
if len(seg_list) > 0:
|
||||
seg = seg_list[-1]
|
||||
if seg.end_bi and len(bi_list) > seg.end_bi.index + 1:
|
||||
bi_index = seg.end_bi.index
|
||||
for index in range(bi_index+1, len(bi_list)):
|
||||
bi = bi_list[index]
|
||||
|
||||
return seg_list
|
||||
|
||||
def get_bi_zs_list(self, bi_list):
|
||||
@@ -729,12 +737,37 @@ class ChanLun():
|
||||
last_bottom = None
|
||||
for klc in klc_list:
|
||||
fx = self.check_fx(klc)
|
||||
|
||||
# Do nothing
|
||||
if fx == Chan_FX_TYPE.UNKNOWN:
|
||||
klc.set_fx(fx)
|
||||
if len(bi_list) > 0:
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
last_bi = bi_list[-1]
|
||||
#print(klc.start_time, last_bi.start_time, last_bi.end_time, last_bi.dir, last_bi.high, last_bi.low, last_bottom.end_time, "last bi")
|
||||
if last_top and last_bi.dir == Chan_BI_DIR.DOWN:
|
||||
if last_bottom and klc.high > last_bi.high:
|
||||
last_bi.set_end_klc(last_bottom, klc)
|
||||
bi = ChanBI(last_bottom, len(bi_list), Chan_BI_DIR.UP)
|
||||
last_bi.set_next(bi)
|
||||
bi.set_pre(last_bi)
|
||||
for klc_index in range(last_bi.end_klc.index, len(klc_list)):
|
||||
bi.add_klc(klc_list[klc_index])
|
||||
bi_list.append(bi)
|
||||
last_top = klc
|
||||
klc.set_bi(bi)
|
||||
#print(klc.start_time, bi.start_time, bi.end_time, bi.dir, bi.high, bi.low)
|
||||
else:
|
||||
if last_bottom and last_bi.dir == Chan_BI_DIR.UP:
|
||||
if last_top and klc.low < last_bi.low:
|
||||
last_bi.set_end_klc(last_top, klc)
|
||||
bi = ChanBI(last_top, len(bi_list), Chan_BI_DIR.DOWN)
|
||||
last_bi.set_next(bi)
|
||||
bi.set_pre(last_bi)
|
||||
for klc_index in range(last_bi.end_klc.index, len(klc_list)):
|
||||
bi.add_klc(klc_list[klc_index])
|
||||
bi_list.append(bi)
|
||||
last_bottom = klc
|
||||
klc.set_bi(bi)
|
||||
#print(klc.start_time, bi.start_time, bi.end_time, bi.dir, bi.high, bi.low)
|
||||
else:
|
||||
if fx == Chan_FX_TYPE.TOP:
|
||||
if last_top:
|
||||
@@ -754,7 +787,7 @@ class ChanLun():
|
||||
last_top = klc
|
||||
#print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Top Change 1")
|
||||
klc.set_klc_fx_type(Chan_KLC_FX.TOP1)
|
||||
#print(klc.end_time, klc.fx, "一类卖点Sell 1")
|
||||
print(klc.end_time, klc.fx, "一类卖点Sell 1")
|
||||
#klc.set_fx(fx)
|
||||
#klc.set_state("10")
|
||||
bi_list[-1].add_klc(klc)
|
||||
@@ -804,7 +837,7 @@ class ChanLun():
|
||||
bi.add_klc(klc)
|
||||
bi_list.append(bi)
|
||||
last_top = klc
|
||||
#print(klc.end_time, klc.fx, bi_list[-1].dir, "Last Top Change 2")
|
||||
print(klc.end_time, klc.fx, bi_list[-1].dir, "Last Top Change 2")
|
||||
klc.set_klc_fx_type(Chan_KLC_FX.TOP2)
|
||||
#klc.set_state('30')
|
||||
bi_list[-1].add_klc(klc)
|
||||
|
||||
Reference in New Issue
Block a user