根据新的条件进行交易,添加交易规则

This commit is contained in:
Porter
2025-09-15 10:29:53 +08:00
parent 3c360ea35b
commit 0b9f63409c
8 changed files with 149 additions and 71 deletions
+24 -5
View File
@@ -651,12 +651,31 @@ class ChanKLU:
if (self.macd == 0 and self.signal == 0 and self.macdhist == 0) or self.ema52 == 0:
self.macd_state = Chan_MACD_STATE.UNKNOWN
return self.macd_state
if self.macd > 0:
if self.macd < self.signal and self.close > self.ema52 and self.low < self.ema52:
self.near0_return = 0
# 归零轴判断
if self.signal > 0:
if self.macd < self.signal:
if 0 < self.low - self.ema52 < 100:
self.near0_return = 6
elif self.close > self.ema52 and self.low < self.ema52 and self.open > self.ema52:
self.near0_return = 7
elif self.close < self.ema52 and self.open > self.ema52 and self.high > self.ema52 and self.low < self.ema52:
self.near0_return = 8
elif self.close < self.ema52 and self.open < self.ema52 and self.high > self.ema52 and self.low < self.ema52:
self.near0_return = 9
elif self.close > self.ema52 and self.open > self.ema52 and self.high > self.ema52 and self.low < self.ema52:
self.near0_return = 10
else:
if self.macd > self.signal and self.close < self.ema52 and self.high > self.ema52:
self.near0_return = 0
if self.macd > self.signal:
if 0 < self.ema52 - self.high < 100:
self.near0_return = 61
elif self.close < self.ema52 and self.high > self.ema52 and self.open < self.ema52:
self.near0_return = 71
elif self.close < self.ema52 and self.open > self.ema52 and self.high > self.ema52 and self.low < self.ema52:
self.near0_return = 81
elif self.close > self.ema52 and self.open < self.ema52 and self.high > self.ema52 and self.low < self.ema52:
self.near0_return = 91
elif self.close > self.ema52 and self.high > self.ema52 and self.open > self.ema52 and self.low < self.ema52:
self.near0_return = 101
# CROSS0 仅以 Signal 穿越零轴判定
if self.pre.signal >= 0 and self.signal < 0:
self.macd_state = Chan_MACD_STATE.CROSS0_DOWN