diff --git a/ChanLun.py b/ChanLun.py index aa432ce..33952b6 100644 --- a/ChanLun.py +++ b/ChanLun.py @@ -32,10 +32,11 @@ class ChanLun(): time8h = 480 time12h = 720 time1d = 1440 - timeframes = [time1, time3, time5, time15] + timeframes = [time1, time3, time5, time15, time30, time60] + tf_df_dict = {} def init_data(self, dataframe, ticker_indicator): for timeframe in self.timeframes: - klu_list, klc_list, bi_list = self.get_list_by_time(dataframe, ticker_indicator, timeframe) + self.tf_df_dict[timeframe] = TF_DF(timeframe, dataframe, ticker_indicator) def calculate_bsp(self, dataframe, ticker_indicator): return dataframe @@ -54,14 +55,14 @@ class ChanLun(): if klc.high > klc.pre.high and klc.high > klc.next.high: if klc.pre.pre and klc.high > klc.pre.pre.high and klc.next.next and klc.high > klc.next.next.high: if klc.pre.pre.pre and klc.high > klc.pre.pre.pre.high and klc.next.next.next and klc.high > klc.next.next.next.high: - if klc.macd > 0 and klc.macd > klc.signal and klc.signal > klc.macdhist: + if klc.signal > 0 and klc.macd > klc.signal: klc.set_fx(Chan_FX_TYPE.TOP) #print(klc.start_time, klc.end_time,klc.next.start_time, klc.next.end_time,klc.fx, "TOP") return Chan_FX_TYPE.TOP elif klc.low < klc.pre.low and klc.low < klc.next.low: if klc.pre.pre and klc.low < klc.pre.pre.low and klc.next.next and klc.low < klc.next.next.low: if klc.pre.pre.pre and klc.low < klc.pre.pre.pre.low and klc.next.next.next and klc.low < klc.next.next.next.low: - if klc.macd < 0 and klc.macd < klc.signal and klc.signal < klc.macdhist: + if klc.signal < 0 and klc.macd < klc.signal: klc.set_fx(Chan_FX_TYPE.BOTTOM) #print(klc.start_time, klc.end_time,klc.next.start_time, klc.next.end_time,klc.fx, "BOTTOM") return Chan_FX_TYPE.BOTTOM diff --git a/TF_DF.py b/TF_DF.py index 28e849c..3f2d7be 100644 --- a/TF_DF.py +++ b/TF_DF.py @@ -37,7 +37,8 @@ class TF_DF(): self.bi_list = self.cal_bi_list(self.klc_list) self.seg_list = self.cal_seg_list(self.bi_list) self.zs_list = self.cal_zs_list(self.bi_list, self.seg_list) - return True + self.chanmacd = ChanMACD(self.klu_list) + self.klu_list = self.chanmacd.cal_macd_state() def check_fx(self, klc): if klc.pre and klc.next: if klc.high > klc.pre.high and klc.high > klc.next.high: