Add Top and Bottom

This commit is contained in:
jackyu66git
2025-04-24 19:31:01 +08:00
parent b849ce8ec8
commit 9cb242f706
7 changed files with 142 additions and 17 deletions
+21 -1
View File
@@ -32,7 +32,27 @@ class ChanKLC():
self.distance = 0
self.klc_fx_type = Chan_KLC_FX.UNKNOWN
def set_klc_fx_type(self, klc_fx_type):
self.klc_fx_type = klc_fx_type
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'])
if self.check_klc_fx_type(klc_fx_type):
self.klc_fx_type = klc_fx_type
def check_klc_fx_type(self, klc_fx_type):
if klc_fx_type == Chan_KLC_FX.BOTTOM1:
features = self.cal_klu_features()
if features['klu_macd'] > 0:
print(self.start_time, klc_fx_type, features['klu_macd'])
return False
else:
return True
elif klc_fx_type == Chan_KLC_FX.TOP1:
features = self.get_feature_data()
if features['klu_macd'] < 0:
print(self.start_time, klc_fx_type, features['klu_macd'])
return False
else:
return True
else:
return True
def add_klu(self, klu):
self.klus.append(klu)
def set_end_klu(self, klu):