添加k线动能理论第一部分

This commit is contained in:
jackyu66git
2025-07-25 01:22:53 +08:00
parent 15773ac457
commit b843e30ed8
4 changed files with 19 additions and 8 deletions
+12 -1
View File
@@ -43,6 +43,8 @@ class ChanKLC():
self.last_top_klc = None
self.last_bottom_klc = None
self.bb_out = False
self.macd = 0
self.signal = 0
def set_last_top_klu(self, last_top_klc):
self.last_top_klc = last_top_klc
def set_last_bottom_klc(self, last_bottom_klc):
@@ -75,7 +77,13 @@ class ChanKLC():
self.bb_out = True
if self.low <= klu.bblow30 and klu.bblow30 > 0:
self.klc_fx_type = Chan_KLC_FX.BOTTOM4
#self.bb_out = True
if self.fx ==Chan_FX_TYPE.TOP:
if self.macd > 0:
self.bb_out = True
else:
if self.fx == Chan_FX_TYPE.BOTTOM:
if self.macd < 0:
self.bb_out = True
def cal_indicators(self):
for index in range(1, len(self.klus)):
self.volume += self.klus[index].volume
@@ -86,6 +94,9 @@ class ChanKLC():
self.volume_ratio = self.volume_ratio / len(self.klus)
self.volume = self.volume / len(self.klus)
self.macdhist = self.macdhist / len(self.klus)
if len(self.klus) > 0:
self.macd = self.klus[-1].macd
self.signal = self.klus[-1].signal
def cal_shape_1(self):
for index in range(1, len(self.klus)):
self.body += self.klus[index].body
+2 -2
View File
@@ -817,7 +817,7 @@ class ChanLun():
#klc.set_state("20")
bi_list[-1].add_klc(klc)
klc.set_bi(bi_list[-1])
klc.set_klc_fx_type(Chan_KLC_FX.TOP3)
#klc.set_klc_fx_type(Chan_KLC_FX.TOP3)
klc.set_last_top_klu(last_top)
#print(klc.start_time, klc.fx, "二类卖点Sell 1")
else:
@@ -938,7 +938,7 @@ class ChanLun():
#klc.set_state("-20")
bi_list[-1].add_klc(klc)
klc.set_bi(bi_list[-1])
klc.set_klc_fx_type(Chan_KLC_FX.BOTTOM3)
#klc.set_klc_fx_type(Chan_KLC_FX.BOTTOM3)
klc.set_last_bottom_klc(last_bottom)
#print(last_bottom.start_time, last_bottom.end_time, "--------------------------------1")
#print(klc.start_time, klc.fx, "二类买点Buy 1")
+3 -3
View File
@@ -255,9 +255,9 @@ def get_a_stock_kl_data(symbol, timeframe, limit=1000, start_time=None, end_time
return None
def add_indicators(df):
fast = 8
slow = 16
period = 6
fast = 12
slow = 26
period = 9
macd = ta.MACD(df, fastperiod=fast, slowperiod=slow, signalperiod=period)
df['macd'] = macd['macd']
+2 -2
View File
@@ -4379,7 +4379,7 @@
if (fx.fx_strength < 1.0) { // 降低阈值让更多分型显示
displayText = fx.fx_strength >= 1.5 ? '' : '' // 0.8以上显示点,0.8以下不显示文本
}
displayText = fx.fx_type.replace("TOP", "").replace("BOTTOM", "").replace("1", "").replace("2", "").replace("3", "");
displayText = fx.fx_type.replace("TOP", "").replace("BOTTOM", "").replace("11", "").replace("12", "").replace("13", "");
// 添加标记配置
const markerConfig = {
time: timestamp,
@@ -4520,7 +4520,7 @@
if (fx.fx_strength < 2.0){ // 调整小周期阈值
displayText = fx.fx_strength >= 1.5 ? '' : '' // 0.6以上显示点
}
displayText = fx.fx_type.replace("TOP", "").replace("BOTTOM", "").replace("1", "").replace("2", "").replace("3", "");
displayText = fx.fx_type.replace("TOP", "").replace("BOTTOM", "").replace("11", "").replace("21", "").replace("13", "");
// 小周期KLU分型标记配置
const markerConfig = {
time: timestamp,