当前行情价格必须低于ema50

This commit is contained in:
zhangkun9038@dingtalk.com 2025-08-23 00:07:57 +08:00
parent c5b5c8e235
commit 1763df6b55

View File

@ -798,7 +798,7 @@ class FreqaiPrimer(IStrategy):
logger.info(f"[{pair}] 🟢 牛市绿色通道:持仓{open_trades}≤2个25USDT入场5条件需要满足{satisfied_count}/4个")
elif trend_status == "bullish":
# 牛市正常通道:持仓>2个75USDT入场必须满足全部7个条件
# 牛市正常通道:持仓>2个75USDT入场必须满足全部7个条件且价格必须低于EMA50
cond1 = (dataframe["&-price_value_divergence"] < self.buy_threshold * 1.5) # 放宽到1.5倍
cond2 = (dataframe["volume_z_score"] > volume_z_score_threshold * 0.7) # 降低成交量要求
cond3 = (dataframe["rsi"] < rsi_threshold * 1.2) # 放宽RSI要求
@ -806,12 +806,12 @@ class FreqaiPrimer(IStrategy):
cond5 = (dataframe["stochrsi_k"] < stochrsi_threshold * 1.2) # 放宽STOCHRSI要求
cond6 = pd.Series([True] * len(dataframe), index=dataframe.index) # 取消熊市过滤
cond7 = pd.Series([True] * len(dataframe), index=dataframe.index) # 取消超买过滤
buy_condition = cond1 & cond2 & cond3 & cond4 & cond5 & cond6 & cond7
buy_condition = cond1 & cond2 & cond3 & cond4 & cond5 & cond6 & cond7 & price_below_ema50 # 必须低于EMA50
entry_tag = "bull_normal"
logger.info(f"[{pair}] 🚀 牛市正常通道:持仓{open_trades}>2个75USDT入场必须满足全部7个条件")
elif trend_status == "bearish":
# 下跌趋势:严格入场条件,只抄底
# 下跌趋势:严格入场条件,只抄底且价格必须低于EMA50
cond1 = (dataframe["&-price_value_divergence"] < self.buy_threshold * 0.7) # 严格到0.7倍
cond2 = (dataframe["volume_z_score"] > volume_z_score_threshold * 1.3) # 提高成交量要求
cond3 = (dataframe["rsi"] < rsi_threshold * 0.8) # 严格RSI要求
@ -819,12 +819,12 @@ class FreqaiPrimer(IStrategy):
cond5 = (dataframe["stochrsi_k"] < stochrsi_threshold * 0.8) # 严格STOCHRSI要求
cond6 = ~bearish_signal_aligned # 保持熊市过滤
cond7 = ~stochrsi_overbought_aligned # 保持超买过滤
buy_condition = cond1 & cond2 & cond3 & cond4 & cond5 & cond6 & cond7
buy_condition = cond1 & cond2 & cond3 & cond4 & cond5 & cond6 & cond7 & price_below_ema50 # 必须低于EMA50
entry_tag = "bearish"
logger.info(f"[{pair}] 📉 下跌趋势策略:严格入场条件")
else: # ranging
# 震荡趋势:使用原策略
# 震荡趋势:使用原策略且价格必须低于EMA50
cond1 = (dataframe["&-price_value_divergence"] < self.buy_threshold)
cond2 = (dataframe["volume_z_score"] > volume_z_score_threshold)
cond3 = (dataframe["rsi"] < rsi_threshold)
@ -832,7 +832,7 @@ class FreqaiPrimer(IStrategy):
cond5 = (dataframe["stochrsi_k"] < stochrsi_threshold)
cond6 = ~bearish_signal_aligned
cond7 = ~stochrsi_overbought_aligned
buy_condition = cond1 & cond2 & cond3 & cond4 & cond5 & cond6 & cond7
buy_condition = cond1 & cond2 & cond3 & cond4 & cond5 & cond6 & cond7 & price_below_ema50 # 必须低于EMA50
entry_tag = "ranging"
logger.info(f"[{pair}] ⚖️ 震荡趋势策略:标准入场条件")