use ema300
This commit is contained in:
parent
4d7784e6e3
commit
baf77c2994
@ -258,6 +258,7 @@ class FreqaiPrimer(IStrategy):
|
||||
|
||||
# 计算主时间框架(3m)指标
|
||||
dataframe["ema200"] = ta.EMA(dataframe, timeperiod=200)
|
||||
dataframe["ema300"] = ta.EMA(dataframe, timeperiod=300)
|
||||
dataframe["price_value_divergence"] = (dataframe["close"] - dataframe["ema200"]) / dataframe["ema200"]
|
||||
upperband, middleband, lowerband = ta.BBANDS(dataframe["close"], timeperiod=20, nbdevup=2.0, nbdevdn=2.0)
|
||||
dataframe["bb_upperband"] = upperband
|
||||
@ -433,6 +434,7 @@ class FreqaiPrimer(IStrategy):
|
||||
cond5 = (dataframe["stochrsi_k"] < stochrsi_threshold)
|
||||
cond6 = ~bearish_signal_aligned
|
||||
cond7 = ~stochrsi_overbought_aligned
|
||||
cond8 = (dataframe["close"] >= dataframe["ema300"])
|
||||
|
||||
# 记录 cond6 和 cond7 的触发情况
|
||||
logger.debug(f"[{pair}] cond6 (非熊市) 触发率: {(~bearish_signal_aligned).mean():.2%}, "
|
||||
@ -457,6 +459,7 @@ class FreqaiPrimer(IStrategy):
|
||||
f"close={bb_close_value:.6f} <= bb_lowerband={bb_lower_value:.6f}: {cond4.iloc[-1]}, "
|
||||
f"stochrsi_k={stochrsi_value:.2f} < {stochrsi_threshold:.2f}: {cond5.iloc[-1]}, "
|
||||
f"非熊市={cond6.iloc[-1]}, "
|
||||
f"ema300={cond8.iloc[-1]}, "
|
||||
f"STOCHRSI未持续超买={cond7.iloc[-1]}")
|
||||
else:
|
||||
logger.warning(f"[{pair}] &-price_value_divergence 列缺失,跳过买入信号生成")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user