修改了一些东西
This commit is contained in:
+13
-11
@@ -47,7 +47,9 @@ class ChanKLC():
|
|||||||
self.signal = 0
|
self.signal = 0
|
||||||
self.state = Chan_MACD_STATE.UNKNOWN
|
self.state = Chan_MACD_STATE.UNKNOWN
|
||||||
self.continue_div = False
|
self.continue_div = False
|
||||||
self.separate_div = 0
|
self.separate_div = False
|
||||||
|
self.ema52 = klu.ema52
|
||||||
|
self.ema24 = klu.ema24
|
||||||
def set_last_top_klu(self, last_top_klc):
|
def set_last_top_klu(self, last_top_klc):
|
||||||
self.last_top_klc = last_top_klc
|
self.last_top_klc = last_top_klc
|
||||||
def set_last_bottom_klc(self, last_bottom_klc):
|
def set_last_bottom_klc(self, last_bottom_klc):
|
||||||
@@ -62,21 +64,17 @@ class ChanKLC():
|
|||||||
self.end_klu = klu
|
self.end_klu = klu
|
||||||
self.end_time = klu.time
|
self.end_time = klu.time
|
||||||
self.close = klu.close
|
self.close = klu.close
|
||||||
self.cal_indicators()
|
|
||||||
self.cal_shape_1()
|
|
||||||
self.strength = self.cal_klc_strength()
|
|
||||||
self.cal_bb_out()
|
|
||||||
if self.pre:
|
|
||||||
self.pre.cal_bb_out()
|
|
||||||
def cal_bb_out(self):
|
|
||||||
return
|
|
||||||
for klu in self.klus:
|
for klu in self.klus:
|
||||||
if klu.macd_state != Chan_MACD_STATE.UNKNOWN:
|
|
||||||
self.state = klu.macd_state
|
|
||||||
if klu.separate_div > 0:
|
if klu.separate_div > 0:
|
||||||
self.separate_div = True
|
self.separate_div = True
|
||||||
if klu.continue_div:
|
if klu.continue_div:
|
||||||
self.continue_div = klu.continue_div
|
self.continue_div = klu.continue_div
|
||||||
|
if klu.macd_state != Chan_MACD_STATE.UNKNOWN:
|
||||||
|
self.state = klu.macd_state
|
||||||
|
self.cal_indicators()
|
||||||
|
def cal_bb_out(self):
|
||||||
|
return
|
||||||
|
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):
|
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)
|
#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.high >= klu.bbup30 and klu.bbup30 > 0 and self.next and (self.next.macd - self.macd) < 0:
|
||||||
@@ -119,10 +117,14 @@ class ChanKLC():
|
|||||||
self.rsi += self.klus[index].rsi
|
self.rsi += self.klus[index].rsi
|
||||||
self.volume_ratio += self.klus[index].volume_ratio
|
self.volume_ratio += self.klus[index].volume_ratio
|
||||||
self.macdhist += self.klus[index].macdhist
|
self.macdhist += self.klus[index].macdhist
|
||||||
|
self.ema52 += self.klus[index].ema52
|
||||||
|
self.ema24 += self.klus[index].ema24
|
||||||
self.rsi = self.rsi / len(self.klus)
|
self.rsi = self.rsi / len(self.klus)
|
||||||
self.volume_ratio = self.volume_ratio / len(self.klus)
|
self.volume_ratio = self.volume_ratio / len(self.klus)
|
||||||
self.volume = self.volume / len(self.klus)
|
self.volume = self.volume / len(self.klus)
|
||||||
self.macdhist = self.macdhist / len(self.klus)
|
self.macdhist = self.macdhist / len(self.klus)
|
||||||
|
self.ema52 = self.ema52 / len(self.klus)
|
||||||
|
self.ema24 = self.ema24 / len(self.klus)
|
||||||
if len(self.klus) > 0:
|
if len(self.klus) > 0:
|
||||||
self.macd = self.klus[-1].macd
|
self.macd = self.klus[-1].macd
|
||||||
self.signal = self.klus[-1].signal
|
self.signal = self.klus[-1].signal
|
||||||
|
|||||||
+1
-5
@@ -1,6 +1,6 @@
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
from ChanEnum import Chan_FX_TYPE, Chan_KLINE_DIR, Chan_BI_DIR, Chan_SEG_DIR, Chan_ZS_DIR, Chan_BSP_DIR, Chan_BSP_TYPE, Chan_KLC_FX
|
from ChanEnum import Chan_FX_TYPE, Chan_KLINE_DIR, Chan_BI_DIR, Chan_SEG_DIR, Chan_ZS_DIR, Chan_BSP_DIR, Chan_BSP_TYPE, Chan_KLC_FX, Chan_MACD_STATE
|
||||||
from ChanKLU import ChanKLU
|
from ChanKLU import ChanKLU
|
||||||
from ChanKLC import ChanKLC
|
from ChanKLC import ChanKLC
|
||||||
from ChanBI import ChanBI
|
from ChanBI import ChanBI
|
||||||
@@ -53,15 +53,11 @@ class ChanLun():
|
|||||||
def check_fx(self, klc):
|
def check_fx(self, klc):
|
||||||
if klc.pre and klc.next:
|
if klc.pre and klc.next:
|
||||||
if klc.high > klc.pre.high and klc.high > klc.next.high:
|
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.signal > 0 and klc.macd > klc.signal:
|
if klc.signal > 0 and klc.macd > klc.signal:
|
||||||
klc.set_fx(Chan_FX_TYPE.TOP)
|
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")
|
#print(klc.start_time, klc.end_time,klc.next.start_time, klc.next.end_time,klc.fx, "TOP")
|
||||||
return Chan_FX_TYPE.TOP
|
return Chan_FX_TYPE.TOP
|
||||||
elif klc.low < klc.pre.low and klc.low < klc.next.low:
|
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.signal < 0 and klc.macd < klc.signal:
|
if klc.signal < 0 and klc.macd < klc.signal:
|
||||||
klc.set_fx(Chan_FX_TYPE.BOTTOM)
|
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")
|
#print(klc.start_time, klc.end_time,klc.next.start_time, klc.next.end_time,klc.fx, "BOTTOM")
|
||||||
|
|||||||
@@ -42,15 +42,11 @@ class TF_DF():
|
|||||||
def check_fx(self, klc):
|
def check_fx(self, klc):
|
||||||
if klc.pre and klc.next:
|
if klc.pre and klc.next:
|
||||||
if klc.high > klc.pre.high and klc.high > klc.next.high:
|
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.macd > 0 and klc.macd > klc.signal and klc.signal > klc.macdhist:
|
||||||
klc.set_fx(Chan_FX_TYPE.TOP)
|
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")
|
#print(klc.start_time, klc.end_time,klc.next.start_time, klc.next.end_time,klc.fx, "TOP")
|
||||||
return Chan_FX_TYPE.TOP
|
return Chan_FX_TYPE.TOP
|
||||||
elif klc.low < klc.pre.low and klc.low < klc.next.low:
|
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.macd < 0 and klc.macd < klc.signal and klc.signal < klc.macdhist:
|
||||||
klc.set_fx(Chan_FX_TYPE.BOTTOM)
|
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")
|
#print(klc.start_time, klc.end_time,klc.next.start_time, klc.next.end_time,klc.fx, "BOTTOM")
|
||||||
|
|||||||
Reference in New Issue
Block a user