添加klu的3种形态识别
This commit is contained in:
+4
-2
@@ -35,8 +35,8 @@ class ChanKLU:
|
||||
self.upper_shadow = self.high - max(self.close, self.open)
|
||||
self.lower_shadow = min(self.close, self.open) - self.low
|
||||
self.body_ratio = self.body / self.range
|
||||
self.upper_shadow_ratio = self.upper_shadow / self.body
|
||||
self.lower_shadow_ratio = self.lower_shadow / self.body
|
||||
self.upper_shadow_ratio = self.upper_shadow / self.range
|
||||
self.lower_shadow_ratio = self.lower_shadow / self.range
|
||||
self.exception = False
|
||||
self.cal_exception()
|
||||
self.candle_dir = Chan_K_DIR.CROSS if self.close == self.open else Chan_K_DIR.BULL if self.close > self.open else Chan_K_DIR.BEAR
|
||||
@@ -70,6 +70,8 @@ class ChanKLU:
|
||||
self.macd_state = state
|
||||
def set_pattern(self, pattern):
|
||||
self.pattern = pattern
|
||||
def to_string(self):
|
||||
return f"{self.time} {self.candle_dir} {self.pattern}"
|
||||
def cal_exception(self):
|
||||
if self.upper_shadow_ratio > 5 or self.lower_shadow_ratio > 5:
|
||||
self.exception = True
|
||||
|
||||
Reference in New Issue
Block a user