新的策略,先开单,明天继续添加条件

This commit is contained in:
jackyu66git
2025-10-16 02:44:21 +08:00
parent eb3f394386
commit a1f8c6c605
6 changed files with 579 additions and 55 deletions
+9 -9
View File
@@ -61,7 +61,7 @@ class ChanKLC():
#print(self.start_time, klc_fx_type, self.get_feature_data()['klu_macd'], self.get_feature_data()['klu_macdhist'], self.get_feature_data()['klu_rsi'])
self.klc_fx_type = klc_fx_type
#self.cal_fx()
#self.cal_bb_out()
self.cal_bb_out()
def add_klu(self, klu):
self.klus.append(klu)
def set_end_klu(self, klu):
@@ -100,15 +100,16 @@ class ChanKLC():
self.klc_fx_type = Chan_KLC_FX.BOTTOM8
def cal_bb_out(self):
for klu in self.klus:
if self.high >= klu.bbup302 and klu.bbup302 > 0 and (self.klc_fx_type == Chan_KLC_FX.TOP1 or self.klc_fx_type == Chan_KLC_FX.TOP2):
#print(self.end_time, self.high, klu.bbup302, self.klc_fx_type)
if self.high >= klu.bbup30 and klu.bbup30 > 0 and self.next and (self.next.macd - self.macd) < 0:
if self.klc_fx_type == Chan_KLC_FX.TOP1 or self.klc_fx_type == Chan_KLC_FX.TOP2:
#print(self.start_time, self.klc_fx_type, klu.high, klu.bb52upper, self.macd, self.next.macd, klu.time)
if self.high >= klu.bb52upper and klu.bb52upper > 0 and self.next and self.high > self.next.high:
self.klc_fx_type = Chan_KLC_FX.TOP4
#self.bb_out = True
if self.low <= klu.bblow302 and klu.bblow302 > 0 and (self.klc_fx_type == Chan_KLC_FX.BOTTOM1 or self.klc_fx_type == Chan_KLC_FX.BOTTOM2):
if self.low <= klu.bblow30 and klu.bblow30 > 0 and self.next and (self.macd - self.next.macd) < 0:
print(self.end_time, self.klc_fx_type)
if self.klc_fx_type == Chan_KLC_FX.BOTTOM1 or self.klc_fx_type == Chan_KLC_FX.BOTTOM2:
#print(self.start_time, self.klc_fx_type, klu.low, klu.bb52lower, self.macd, self.next.macd, klu.time)
if self.low <= klu.bb52lower and klu.bb52lower > 0 and self.next and self.low < self.next.low:
self.klc_fx_type = Chan_KLC_FX.BOTTOM4
#self.bb_out = True
print(self.end_time, self.klc_fx_type)
def cal_indicators(self):
for index in range(1, len(self.klus)):
self.volume += self.klus[index].volume
@@ -126,7 +127,6 @@ class ChanKLC():
if len(self.klus) > 0:
self.macd = self.klus[-1].macd
self.signal = self.klus[-1].signal
self.body = abs(self.close - self.open)
self.upper_shadow = self.high - max(self.close, self.open)
self.lower_shadow = min(self.close, self.open) - self.low