添加klc识别ema线接触

This commit is contained in:
jackyu66git
2026-02-08 22:01:45 +08:00
parent b9c11b6163
commit 10b8ba398b
6 changed files with 305 additions and 32 deletions
+6 -4
View File
@@ -69,6 +69,8 @@ class ChanKLU:
self.mode4_touch52_no_zero = False # 先触碰EMA52但黄白线未归零
self.div_type = "none" # {bearish, bullish, hidden_bearish, hidden_bullish, none}
self.div_score = 0.0 # 背离强度(0-100)
self.ema_dir = 0
self.get_ema_dir()
#print(self.open, self.close, self.high, self.low, self.candle_dir, self.strength)
def set_macd_state(self, state):
self.macd_state = state
@@ -123,14 +125,14 @@ class ChanKLU:
return 0
else:
return 0
def ema_pattern(self):
def get_ema_dir(self):
if self.check_indicators():
if self.ema24 > self.ema52 and self.ema52 > self.ema104 and self.ema104 > self.ema156:
return 1
self.ema_dir = 1
elif self.ema24 < self.ema52 and self.ema52 < self.ema104 and self.ema104 < self.ema156:
return -1
self.ema_dir = -1
else:
return 0
self.ema_dir = 0
def check_indicators(self):
if self.ema156 == 0:
return False