Add Top and Bottom
This commit is contained in:
+34
-13
@@ -551,7 +551,7 @@ class ChanLun():
|
||||
# A new top found
|
||||
#last_top.set_fx(Chan_FX_TYPE.UNKNOWN)
|
||||
last_top = klc
|
||||
print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Top Change 1")
|
||||
#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.start_time, klc.fx, "一类卖点Sell 1")
|
||||
#klc.set_fx(fx)
|
||||
@@ -578,7 +578,7 @@ class ChanLun():
|
||||
#last_top.set_fx(Chan_FX_TYPE.PTOP)
|
||||
last_top = klc
|
||||
last_bottom = pre_last_bi.start_klc
|
||||
print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Top Bottom Change 1")
|
||||
#print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Top Bottom Change 1")
|
||||
klc.set_klc_fx_type(Chan_KLC_FX.TOP2)
|
||||
#print(klc.start_time, last_bi.start_klc.start_time, "New TOP Found reset last bi")
|
||||
klc.set_state("10")
|
||||
@@ -602,7 +602,7 @@ class ChanLun():
|
||||
bi.add_klc(klc)
|
||||
bi_list.append(bi)
|
||||
last_top = klc
|
||||
print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Top Change 2")
|
||||
#print(klc.start_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)
|
||||
@@ -616,7 +616,7 @@ class ChanLun():
|
||||
last_bi.set_start_klc(klc, Chan_BI_DIR.DOWN)
|
||||
#last_top.set_fx(Chan_FX_TYPE.UNKNOWN)
|
||||
last_top = klc
|
||||
print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Top Change 3")
|
||||
#print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Top Change 3")
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
#print(klc.start_time, klc.fx, "笔卖点Sell 3")
|
||||
@@ -637,7 +637,7 @@ class ChanLun():
|
||||
else:
|
||||
# First temp top and last bottom confirmed
|
||||
last_top = klc
|
||||
print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Top Change 4")
|
||||
#print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Top Change 4")
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
#print(klc.start_time, klc.fx, "一类卖点Sell 1")
|
||||
@@ -649,7 +649,7 @@ class ChanLun():
|
||||
bi_list.append(bi)
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Top Change 5")
|
||||
#print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Top Change 5")
|
||||
#print(klc.start_time, 'Create first top')
|
||||
#print(klc.start_time, klc.fx, "笔卖点Sell 1")
|
||||
#klc.fx = Bottom ========================
|
||||
@@ -669,7 +669,7 @@ class ChanLun():
|
||||
# A new bottom found
|
||||
#last_bottom.set_fx(Chan_FX_TYPE.UNKNOWN)
|
||||
last_bottom = klc
|
||||
print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Bottom Change 1")
|
||||
#print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Bottom Change 1")
|
||||
klc.set_klc_fx_type(Chan_KLC_FX.BOTTOM1)
|
||||
#print(klc.start_time, klc.fx, "一类买点Buy 1")
|
||||
klc.set_state("-10")
|
||||
@@ -697,7 +697,7 @@ class ChanLun():
|
||||
#last_bottom.set_fx(Chan_FX_TYPE.PBOTTOM)
|
||||
last_bottom = klc
|
||||
last_top = pre_last_bi.start_klc
|
||||
print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Top Bottom Change 2")
|
||||
#print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Top Bottom Change 2")
|
||||
klc.set_klc_fx_type(Chan_KLC_FX.BOTTOM2)
|
||||
#print(klc.start_time, last_bi.start_klc.start_time, "New BOTTOM Found reset last bi")
|
||||
klc.set_state("-10")
|
||||
@@ -721,7 +721,7 @@ class ChanLun():
|
||||
bi.add_klc(klc)
|
||||
bi_list.append(bi)
|
||||
last_bottom = klc
|
||||
print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Bottom Change 2")
|
||||
#print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Bottom Change 2")
|
||||
klc.set_klc_fx_type(Chan_KLC_FX.BOTTOM2)
|
||||
klc.set_state('-30')
|
||||
bi_list[-1].add_klc(klc)
|
||||
@@ -735,7 +735,7 @@ class ChanLun():
|
||||
last_bi.set_start_klc(klc, Chan_BI_DIR.UP)
|
||||
#last_bottom.set_fx(Chan_FX_TYPE.UNKNOWN)
|
||||
last_bottom = klc
|
||||
print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Bottom Change 3")
|
||||
#print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Bottom Change 3")
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
#print(klc.start_time, klc.fx, "笔买点Buy 3")
|
||||
@@ -757,7 +757,7 @@ class ChanLun():
|
||||
else:
|
||||
# First temp bottom and last top confirmed
|
||||
last_bottom = klc
|
||||
print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Bottom Change 4")
|
||||
#print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Bottom Change 4")
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
#print(klc.start_time, klc.fx, "一类买点Buy 1")
|
||||
@@ -769,7 +769,7 @@ class ChanLun():
|
||||
bi_list.append(bi)
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Bottom Change 5")
|
||||
#print(klc.start_time, klc.fx, bi_list[-1].dir, "Last Bottom Change 5")
|
||||
#print(klc.start_time, klc.fx, "笔买点Buy 4")
|
||||
#if klc.fx != Chan_FX_TYPE.UNKNOWN:
|
||||
#print(klc.start_time, klc.fx, klc.index)
|
||||
@@ -1661,6 +1661,15 @@ class ChanLun():
|
||||
else:
|
||||
ax1.text(big_dates_num[text_index], seg.end_bi.end_klc.low-1, seg_macd_div, color='green', fontsize=14, alpha=0.6)
|
||||
big_klc = self.get_klc_list(big_df)
|
||||
self.cal_bi_list(big_klc)
|
||||
for klc in big_klc:
|
||||
if klc.klc_fx_type != Chan_KLC_FX.UNKNOWN:
|
||||
text_index = klc.end_klu.index
|
||||
if klc.fx == Chan_FX_TYPE.BOTTOM:
|
||||
ax1.text(big_dates_num[text_index], klc.low, str(klc.klc_fx_type).replace("Chan_KLC_FX.", ""), color='green', fontsize=6, alpha=1)
|
||||
else:
|
||||
ax1.text(big_dates_num[text_index], klc.high, str(klc.klc_fx_type).replace("Chan_KLC_FX.", ""), color='red', fontsize=6, alpha=1)
|
||||
"""
|
||||
model = xgb.Booster()
|
||||
model.load_model("30m_modelchan_xgb_model.json")
|
||||
for klc in big_klc:
|
||||
@@ -1671,7 +1680,8 @@ class ChanLun():
|
||||
if predict > 0.35 and klc.fx == Chan_FX_TYPE.TOP:
|
||||
text_index = klc.end_klu.index
|
||||
ax1.text(big_dates_num[text_index], klc.low-1, predict, color='green', fontsize=14, alpha=0.6)
|
||||
|
||||
"""
|
||||
|
||||
"""
|
||||
# 绘制大周期买卖点
|
||||
marker_styles = {
|
||||
@@ -1825,6 +1835,15 @@ class ChanLun():
|
||||
else:
|
||||
ax2.text(small_dates_num[text_index], seg.end_bi.end_klc.low-1, seg_macd_div, color='green', fontsize=14, alpha=0.8)
|
||||
small_klc = self.get_klc_list(small_df)
|
||||
self.cal_bi_list(small_klc)
|
||||
for klc in small_klc:
|
||||
if klc.klc_fx_type != Chan_KLC_FX.UNKNOWN:
|
||||
text_index = klc.end_klu.index
|
||||
if klc.fx == Chan_FX_TYPE.BOTTOM:
|
||||
ax2.text(small_dates_num[text_index], klc.low, str(klc.klc_fx_type).replace("Chan_KLC_FX.", ""), color='green', fontsize=6, alpha=1)
|
||||
else:
|
||||
ax2.text(small_dates_num[text_index], klc.high, str(klc.klc_fx_type).replace("Chan_KLC_FX.", ""), color='red', fontsize=6, alpha=1)
|
||||
"""
|
||||
model = xgb.Booster()
|
||||
model.load_model("5m_modelchan_xgb_model.json")
|
||||
for klc in small_klc:
|
||||
@@ -1836,6 +1855,8 @@ class ChanLun():
|
||||
text_index = klc.end_klu.index
|
||||
ax2.text(small_dates_num[text_index], klc.low-1, predict, color='green', fontsize=14, alpha=0.6)
|
||||
"""
|
||||
|
||||
"""
|
||||
# 绘制小周期买卖点
|
||||
for idx, point in small_buy_sell_points.items():
|
||||
if idx < 0 or idx >= len(small_df):
|
||||
|
||||
Reference in New Issue
Block a user