add changes
This commit is contained in:
+12
-1
@@ -1,7 +1,7 @@
|
||||
import copy
|
||||
from typing import Dict, Optional
|
||||
|
||||
from ChanEnum import Chan_FX_TYPE, Chan_KLINE_DIR, Chan_BI_DIR
|
||||
from ChanEnum import Chan_FX_TYPE, Chan_KLINE_DIR, Chan_BI_DIR, Chan_KLC_FX
|
||||
import ChanKLU
|
||||
import ChanCTime
|
||||
|
||||
@@ -29,6 +29,10 @@ class ChanKLC():
|
||||
self.bi_macdhist = 0
|
||||
self.bi_macd_div = 0.0
|
||||
self.bi = None
|
||||
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
|
||||
def add_klu(self, klu):
|
||||
self.klus.append(klu)
|
||||
def set_end_klu(self, klu):
|
||||
@@ -123,6 +127,12 @@ class ChanKLC():
|
||||
self.bi_macdhist += klc.get_macdhist()
|
||||
elif bi.dir == Chan_BI_DIR.DOWN and klc.get_macdhist() < 0:
|
||||
self.bi_macdhist -= klc.get_macdhist()
|
||||
self.distance = self.index - bi.start_klc.index
|
||||
if False:
|
||||
if bi.is_sure:
|
||||
print(self.start_time, self.distance, bi.index, bi.start_time, bi.dir, bi.end_time)
|
||||
else:
|
||||
print(self.start_time, self.distance, bi.index, bi.start_time, bi.dir)
|
||||
def get_macdhist(self):
|
||||
self.macdhist = 0
|
||||
for klu in self.klus:
|
||||
@@ -164,6 +174,7 @@ class ChanKLC():
|
||||
features['klc_pre_fx'] = (0 if self.pre.fx == Chan_FX_TYPE.UNKNOWN else 1 if self.pre.fx == Chan_FX_TYPE.TOP else 2) if self.pre else 0 #10
|
||||
features['klc_pre_pre_fx'] = (0 if self.pre.pre.fx == Chan_FX_TYPE.UNKNOWN else 1 if self.pre.pre.fx == Chan_FX_TYPE.TOP else 2) if self.pre and self.pre.pre else 0 #11
|
||||
features['klc_pre_pre_pre_fx'] = (0 if self.pre.pre.pre.fx == Chan_FX_TYPE.UNKNOWN else 1 if self.pre.pre.pre.fx == Chan_FX_TYPE.TOP else 2) if self.pre and self.pre.pre and self.pre.pre.pre else 0 #12
|
||||
features['klc_distance'] = self.distance #13
|
||||
# New Add 20250422
|
||||
#features['klc_macdhist'] = self.get_macdhist() #11
|
||||
#features['klc_bi_macdhist'] = self.bi_macdhist #12
|
||||
|
||||
Reference in New Issue
Block a user